Add cypress tasks defined as commands so that
cy.task("doSomething", 1)// becomescy.doSomething(1)
with type support and go to definition IDE utils.
// likely create object with `import * as tasks from ...`const tasks = { getUUID: () => 'a uuid' };addTasks(tasks);// type def, see above `addCommands` for further namespace extension detailstype Commands = typeof commands & Tasks<typeof tasks>;declare global { // ...
Then also add tasks in cypress.config.ts
import * as tasks from "./cypress/support/tasks";export default defineConfig({ // ... other config setupNodeEvents: (on, config) => { on("task", tasks); },});
afterwards, tasks will be available as commands that return well-typed promises
cy.getUUID().then(uuid => ...)`
Add cypress tasks defined as commands so that
with type support and go to definition IDE utils.
Then also add tasks in cypress.config.ts
afterwards, tasks will be available as commands that return well-typed promises