test: helper functions
This commit is contained in:
parent
2249424b2e
commit
5ce5ebb3b6
3 changed files with 29 additions and 1 deletions
|
@ -35,3 +35,28 @@
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
Cypress.Commands.add('getBySel', (selector, ...args) => {
|
||||||
|
return cy.get(`[data-cy=${selector}]`, ...args);
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('getBySelLike', (selector, ...args) => {
|
||||||
|
return cy.get(`[data-cy*=${selector}]`, ...args);
|
||||||
|
});
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace Cypress {
|
||||||
|
interface Chainable {
|
||||||
|
getBySel(
|
||||||
|
selector: string,
|
||||||
|
...args: any[]
|
||||||
|
): Chainable<JQuery<HTMLElement>>;
|
||||||
|
getBySelLike(
|
||||||
|
selector: string,
|
||||||
|
...args: any[]
|
||||||
|
): Chainable<JQuery<HTMLElement>>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
// https://on.cypress.io/configuration
|
// https://on.cypress.io/configuration
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
|
import '@/app/globals.css';
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands';
|
import './commands';
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
},
|
||||||
|
"types": ["node", "cypress"]
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue