Some rules not running with Cypress
See original GitHub issueExpectation: Run the document-title
and html-has-lang
rules when running axe-core inside Cypress (Which runs the whole app inside an iFrame)
Actual: The rules are identified as inapplicable
Motivation:
The document-title
and html-has-lang
rules should be able to run correctly when the whole app being tested is mounted inside an iFrame, which is what happens in the case of a Cypress test.
Currently I think what’s happening is that these 2 rules use the window-is-top.js
check, which causes the rule to only run for the root/top window object - i.e. not the actual window to be tested in a Cypress test.
Could there be a way to define a “root” or “top” window/document, so that this window-is-top
code checks against a specific window object, instead of the default top window?
axe-core version: 3.2.2
Browser: Chrome
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
Thanks for the issue. We’ll have to investigate to see what can be done.
With Cypress - axe.run()
injectAxe(); injectIframes(); cy.window({ log: false }).then(async (win: Window) => { const { includedImpacts, ...axeOptions } = options || {}; win.axe.configure({ branding: { application: 'cypress' } }); const results: axe.AxeResults = await win.axe.run( context || win.document, axeOptions );
we were able to run the above mentioned rules successfully getting the results properly.