gray-kilobyte-89541
11/28/2022, 6:25 PMcypress-grep in your code...square-honey-48197
11/28/2022, 6:48 PMmm/dd/yyyy string matches my desired daydate via:
the startDate I'm passing in is just 11
TypeScript
getCustomDateStartDateInput()
.invoke('val')
.then((date) => {
cy.log('Desired Date:\t' + startDate);
console.log('Actual Start Date\t' + date);
console.log(String(date).split('/')[1]);
expect(String(date).split('/')[1]).to.equal(startDate);
});
For some reason the assertion in the command palette looks like this:square-honey-48197
11/28/2022, 7:01 PMenough-truck-68085
11/28/2022, 7:11 PMbitter-judge-96754
11/28/2022, 7:40 PMvictorious-summer-2999
11/28/2022, 8:43 PMpackages/e2e/cypress/config/configFiles/cypress-desk.config.ts
import { defineConfig } from 'cypress';
export default defineConfig({
viewportWidth: 1920,
viewportHeight: 1024,
watchForFileChanges: false,
waitForAnimations: true,
numTestsKeptInMemory: 1,
defaultCommandTimeout: 15000,
requestTimeout: 15000,
video: false,
videoCompression: 0,
// screenshot: true,
chromeWebSecurity: false,
retries: {
runMode: 1,
openMode: 0,
},
e2e: {
experimentalSessionAndOrigin: true,
experimentalRunAllSpecs: true,
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
const pluginFile = require('../../plugins/index.ts');
require('cypress-grep/src/plugin')(config);
pluginFile(on, config);
return config;
},
},
});best-flower-17510
11/28/2022, 8:47 PMgray-kilobyte-89541
11/28/2022, 10:27 PMrequire('cypress-grep/src/plugin')(config);?wide-exabyte-26689
11/29/2022, 7:02 AMfresh-doctor-14925
11/29/2022, 10:19 AMvictorious-summer-2999
11/29/2022, 11:09 AMpackages/e2e/cypress/config/configFiles/cypress-desk.config.ts
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
experimentalSessionAndOrigin: true,
experimentalRunAllSpecs: true,
setupNodeEvents(on, config) {
const pluginFile = require('../../plugins/index.ts');
require('@cypress/grep/src/plugin')(config);
pluginFile(on, config);
return config;
},
},
});
packages/e2e/tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"target": "ES6",
"module": "CommonJS",
"skipLibCheck": true,
"noImplicitAny": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"allowJs": true,
"removeComments": true,
"baseUrl": "./",
"types": ["cypress", "node", "cypress-real-events", "cypress-wait-until", "cypress-grep"],
"outDir": "./dist",
"lib": ["es6", "ESNext", "dom", "ES5"],
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["./**/*.tsx", "./**/*.ts", "./**/*.d.ts"],
...
}
packages/e2e/cypress/plugins/index.ts
const registerCypressGrep = require('@cypress/grep')
registerCypressGrep();
module.exports = (on, config) => {
// we register our plugin using its register method:rough-jordan-79228
11/29/2022, 11:26 AMfresh-doctor-14925
11/29/2022, 11:31 AMgray-kilobyte-89541
11/29/2022, 11:41 AMconst registerCypressGrep = require('@cypress/grep')
registerCypressGrep();
(a good idea would be to learn how plugins are structured, and there is Node and browser parts like in this case, something I cover in my https://cypress.tips/courses/cypress-plugins course)limited-barista-33480
11/29/2022, 1:40 PMvictorious-summer-2999
11/29/2022, 1:40 PMrough-jordan-79228
11/29/2022, 1:43 PMrough-jordan-79228
11/29/2022, 1:44 PMquick-diamond-67609
11/29/2022, 1:53 PMorigin command to visit the auth app. But the entire spec will get restarted when I redirect to the next page after typing the email. When I checked the doc, I found that params are not supported in the URLs inside the origin callback function.
Can anyone suggest me an alternate solution for this?
Version: 9.6
App framework: React
js
it("should login successfully", () => {
cy.origin(
"http:localhost:3000/", //auth app URL
{ args },
({ email, otp }) => {
cy.visit("/");
cy.get(".email-field").type("test@gmail.com");
cy.get(".sbmit-btn").click();
// Should redirect to otp page => http:localhost:3000/?email=test@gmail.com
cy.get(".otp-field").type("123456");
}
);
cy.visit("/"); // Should redirect to app url (http:localhost:3001)
});
This is the sample snippet.gray-kilobyte-89541
11/29/2022, 2:35 PMfierce-terabyte-72718
11/29/2022, 4:40 PMimportant-hair-85125
11/29/2022, 5:17 PMfresh-doctor-14925
11/29/2022, 5:29 PMcool-toothbrush-53313
11/30/2022, 3:43 AMstale-optician-85950
11/30/2022, 8:48 AMfreezing-piano-2792
11/30/2022, 10:10 AM@cypress/grep completely if you're using @badeball/cypress-cucumber-preprocessorfreezing-piano-2792
11/30/2022, 10:11 AMpowerful-journalist-49461
11/30/2022, 2:29 PMfresh-doctor-14925
11/30/2022, 2:32 PMvisit() would only append it for that specific call, rather than the whole test. You can append headers in each call of your test using cy.intercept(), but given that this is due to the calls between the runner and Dashboard then I'm not even sure that would workpowerful-journalist-49461
11/30/2022, 2:35 PM