Recall & Review
beginner
What does it mean when an element is 'hidden' in web testing?
A hidden element is present in the page's HTML but not visible to the user, often due to CSS styles like
display: none or visibility: hidden.Click to reveal answer
intermediate
How can Cypress interact with hidden elements?
By default, Cypress commands like
click() only work on visible elements. To interact with hidden elements, you can use options like { force: true } to force the action.Click to reveal answer
intermediate
Why should you be careful when forcing actions on hidden elements?
Forcing actions on hidden elements can cause tests to pass even if the user cannot interact with those elements, which may hide real usability problems.
Click to reveal answer
beginner
Which Cypress command checks if an element is visible or hidden?
You can use
.should('be.visible') to check visibility or .should('not.be.visible') to check if an element is hidden.Click to reveal answer
beginner
What is a common real-life example of a hidden element in web apps?
A dropdown menu that only appears when you hover or click a button is hidden by default and becomes visible on user interaction.
Click to reveal answer
In Cypress, how do you click a hidden button?
✗ Incorrect
By default, Cypress only clicks visible elements. Using
{ force: true } forces the click even if the element is hidden.Which CSS property commonly hides elements from view but keeps them in the DOM?
✗ Incorrect
visibility: hidden hides the element but it still takes up space in the layout.What does
cy.get('selector').should('not.be.visible') check?✗ Incorrect
This assertion checks that the element exists but is not visible to the user.
Why might forcing clicks on hidden elements be risky in tests?
✗ Incorrect
Forcing clicks on hidden elements can make tests pass even if users cannot interact with those elements, hiding usability issues.
Which Cypress command helps you check if an element is visible before interacting?
✗ Incorrect
Using
should('be.visible') asserts that the element is visible before performing actions.Explain how Cypress handles hidden elements and how you can interact with them safely.
Think about visibility checks and forced actions.
You got /4 concepts.
Describe a real-life example of a hidden element on a website and how you would test it with Cypress.
Consider common UI patterns that hide elements.
You got /4 concepts.