Bird
0
0

Given the following Cypress test code snippet, what will cy.checkA11y() do?

medium📝 Predict Output Q13 of 15
Cypress - Plugins and Ecosystem
Given the following Cypress test code snippet, what will cy.checkA11y() do?
cy.visit('/home')
cy.injectAxe()
cy.checkA11y()
ARun accessibility checks on the entire page and report any violations
BReload the page and ignore accessibility
COnly check the header element for accessibility
DThrow an error because cy.checkA11y() needs arguments
Step-by-Step Solution
Solution:
  1. Step 1: Understand the code sequence

    The code visits the page, injects axe, then runs cy.checkA11y() without arguments.
  2. Step 2: Know default behavior of cy.checkA11y()

    Without arguments, cy.checkA11y() runs accessibility checks on the whole page and reports violations.
  3. Final Answer:

    Run accessibility checks on the entire page and report any violations -> Option A
  4. Quick Check:

    cy.checkA11y() default = full page check [OK]
Quick Trick: cy.checkA11y() without args checks whole page [OK]
Common Mistakes:
  • Thinking it only checks part of the page
  • Assuming it throws error without args
  • Confusing it with page reload

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes