Cypress · Middle · Question 71 of 77
How do you test keyboard navigation in Cypress?
- 1Use
cy.get('*').click()on every element - 2Press Tab (natively or via a plugin) and check focus
- 3Keyboard navigation can't be tested in Cypress
Show the answer
Correct answer: Press Tab (natively or via a plugin) and check focus
Explanation
Asserting cy.focused() after each key checks focus order and visible focus.