component-driven / cypress-axe

Test accessibility with axe-core in Cypress
MIT License
622 stars 86 forks source link

cy.injectAxe() is Causing Cypress Test Runner to Freeze #53

Open todd-m-kemp opened 4 years ago

todd-m-kemp commented 4 years ago

Whenever I try to use cy.injectAxe() in a test, Cypress gets stuck at the step immediately prior. The Cypress test runner itself is locked and must be force-quit.

Here is code to reproduce the problem.

context('Problem with cy.injectAxe()', function () {

  beforeEach (function () {
    // These are not real credentials.
    // Please sign up (for free) at www.vidyard.com, verify your email address, then update these accordingly before running.
    const email = 'yourEmailAddress@fake.com'
    const password = 'password123!'

    cy.visit('https://secure.vidyard.com/user/sign_in')
    cy.get('#username').type(email)
    cy.get('#password').type(password)
    cy.get('#sign-in').click()
    cy.wait(10000) // Just to make sure the page is fully loaded.
  })

  it('Accessibility Test', function () {
    // When the lines below are commented out, there is no issue.
    // When the lines are let to run, the Cypress Test Runner gets stuck on the cy.wait step.
    // Cypress will be completely frozen and must be force quit.
    cy.injectAxe()
    cy.checkA11y()
  })
})

I am using Cypress version 4.12.1 and cypress-axe version 0.8.1 on macOS 10.14.6 with Chrome 84.0.4147.105 and Firefox 79.0.

todd-m-kemp commented 4 years ago

I thought I would check this again after Cypress version 5.1.0 was released and regrettably this is still a problem. ☹️

davidhousedev commented 4 years ago

@todd-m-kemp I think I'm encountering this too. I found that it was only the combination of running both injectAxe and checkA11y functions for the same page that triggered the error. I could run either of them independently and there wasn't a problem.

Additionally, I am able to run everything just fine for most of my pages, except I added a new one (which happens to be the only one that is SSR'd by gatsby) and whatever conditions exist on that page cause this freeze to occur.

In case it helps:

    "cypress-axe": "^0.8.1",
    "cypress": "^5.3.0",
cipivanov commented 3 years ago

I managed to "fix" my Cypress runner freezing issue by bumping cypress-axe to 0.13.0.