component-driven / component-driven/cypress-axe
Using the skipFailures flag results in tests failing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 641
- Forks
- 90
- Avg merge
- 6h 8m
- Merged PRs (30d)
- 1
Description
I was trying out the skipFailures flag on some Cypress tests, and while it works in most scenarios, it does fail on a few specific tests due to the following error:
Cannot read properties of undefined (reading 'run')
at Context.eval (webpack:///node_modules/cypress-axe/dist/index.js:52:1)
From previous event:
at Context.thenFn (http://localhost:3333/__cypress/runner/cypress_runner.js:156453:24)
at Context.then (http://localhost:3333/__cypress/runner/cypress_runner.js:156892:22)
at Context.<anonymous> (http://localhost:3333/__cypress/runner/cypress_runner.js:171546:22)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:170970:16)
From previous event:
at runCommand (http://localhost:3333/__cypress/runner/cypress_runner.js:170949:9)
at next (http://localhost:3333/__cypress/runner/cypress_runner.js:171095:15)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:171123:17)
From previous event:
at next (http://localhost:3333/__cypress/runner/cypress_runner.js:171095:35)
From previous event:
at Promise.catch.err.name (http://localhost:3333/__cypress/runner/cypress_runner.js:171136:38)
From previous event:
at run (http://localhost:3333/__cypress/runner/cypress_runner.js:171129:22)
at $Cy.cy.<computed> [as injectAxe] (http://localhost:3333/__cypress/runner/cypress_runner.js:171586:12)
at Context.runnable.fn (http://localhost:3333/__cypress/runner/cypress_runner.js:171813:22)
at callFn (http://localhost:3333/__cypress/runner/cypress_runner.js:105099:22)
at Test.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://localhost:3333/__cypress/runner/cypress_runner.js:105086:8)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:177607:29)
From previous event:
at Object.onRunnableRun (http://localhost:3333/__cypress/runner/cypress_runner.js:177595:18)
at $Cypress.action (http://localhost:3333/__cypress/runner/cypress_runner.js:167954:29)
at Test.Runnable.run (http://localhost:3333/__cypress/runner/cypress_runner.js:175744:14)
at Runner.../driver/node_modules/mocha/lib/runner.js.Runner.runTest (http://localhost:3333/__cypress/runner/cypress_runner.js:105758:11)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:105884:13)
at next (http://localhost:3333/__cypress/runner/cypress_runner.js:105667:15)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:105677:8)
at next (http://localhost:3333/__cypress/runner/cypress_runner.js:105579:15)
at <unknown> (http://localhost:3333/__cypress/runner/cypress_runner.js:105645:6)
at timeslice (http://localhost:3333/__cypress/runner/cypress_runner.js:99571:28)
This is the test in question that fails:
describe("and When user selects an active element", () => {
it("should navigate away to product page", () => {
cy.injectAxe()
cy.get("[data-testid='element_1111111']").click().wait(333)
cy.url().should("include", "#111111")
cy.checkA11y(null, null, terminalLog, true)
})
})
Removing the flag will result in the test failing, but due to actual accessibility problems (so the package is working properly)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shown Cypress test with the skipFailures flag, then inspect cypress-axe/dist/index.js around line 52 and the cy.injectAxe and cy.checkA11y calls. Done means the flag no longer causes the undefined run error, while running without it still exposes the reported accessibility failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cypress, typescript
- Domain
- accessibility, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100