|
| 1 | +/// <reference types="cypress" /> |
| 2 | + |
| 3 | +// *********************************************** |
| 4 | +// This example commands.ts shows you how to |
| 5 | +// create various custom commands and overwrite |
| 6 | +// existing commands. |
| 7 | +// |
| 8 | +// For more comprehensive examples of custom |
| 9 | +// commands please read more here: |
| 10 | +// https://on.cypress.io/custom-commands |
| 11 | +// *********************************************** |
| 12 | + |
| 13 | +// eslint-disable-next-line @typescript-eslint/no-namespace |
| 14 | +declare namespace Cypress { |
| 15 | + // eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 16 | + interface Chainable<Subject> { |
| 17 | + login(email: string, password: string): void; |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +// -- This is a parent command -- |
| 22 | +Cypress.Commands.add('login', (email, password) => { |
| 23 | + console.log('Custom command example: Login', email, password); |
| 24 | +}); |
| 25 | +// |
| 26 | +// -- This is a child command -- |
| 27 | +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) |
| 28 | +// |
| 29 | +// |
| 30 | +// -- This is a dual command -- |
| 31 | +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) |
| 32 | +// |
| 33 | +// |
| 34 | +// -- This will overwrite an existing command -- |
| 35 | +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
0 commit comments