Published on

Cypress

Authors
  • avatar
    Name
    Timothy Blanks

Ignore app exceptions

describe('Login test', () => {
  beforeEach(() => {
    cy.visit('https://test.com/login')
    cy.get('#UserName').type('name')
    cy.get('#Password').type('password')
    cy.get('#login').click()

    // ignore unhandled app exceptions
    Cypress.on('uncaught:exception', (err, runnable) => {
      // returning false here prevents Cypress from
      // failing the test
      return false
    })
  })
})

Auto open Chrome devtools

  .. cypress.config.ts in setupNodeEvents
  on("before:browser:launch", (browser, launchOptions) => {
    if (browser.family === "chromium") {
      launchOptions.args.push("--auto-open-devtools-for-tabs");
    }
    return launchOptions;
  });