Created
August 3, 2021 07:09
-
-
Save Ebazhanov/9afbcb3630611db0d24a6ed613a283e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// *********************************************** | |
// This example commands.js shows you how to | |
// create various custom commands and overwrite | |
// existing commands. | |
// | |
// For more comprehensive examples of custom | |
// commands please read more here: | |
// https://on.cypress.io/custom-commands | |
// *********************************************** | |
// | |
// | |
// -- This is a parent command -- | |
// Cypress.Commands.add('login', (email, password) => { ... }) | |
// | |
// | |
// -- This is a child command -- | |
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | |
// | |
// | |
// -- This is a dual command -- | |
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | |
// | |
// | |
// -- This will overwrite an existing command -- | |
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | |
/** | |
* Ignore uncaught exceptions | |
* https://docs.cypress.io/api/events/catalog-of-events#App-Events | |
*/ | |
Cypress.Commands.add('ignoreUncaughtException', () => { | |
Cypress.on('uncaught:exception', (err) => { | |
// returning false here prevents Cypress from | |
// failing the test | |
return false; | |
}); | |
}); | |
declare global { | |
namespace Cypress { | |
interface Chainable<Subject> { | |
ignoreUncaughtException(): Chainable<any>; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment