Test Overview
This test checks clicking a hidden button using Cypress's force: true option. It verifies that the click works even if the button is not visible.
This test checks clicking a hidden button using Cypress's force: true option. It verifies that the click works even if the button is not visible.
describe('Force click on hidden element', () => { it('Clicks hidden button using force option', () => { cy.visit('https://example.cypress.io/commands/actions') // The button is hidden by default cy.get('#hidden-button').click({ force: true }) // Verify the click triggered a visible change cy.get('#hidden-button-clicked').should('be.visible') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, browser ready | - | PASS |
| 2 | Browser opens and navigates to https://example.cypress.io/commands/actions | Page loaded with elements including a hidden button with id 'hidden-button' | - | PASS |
| 3 | Find element with id 'hidden-button' | Hidden button element located in DOM but not visible | Element exists in DOM | PASS |
| 4 | Click the hidden button using { force: true } option | Button is clicked despite being hidden | Click event triggered on hidden button | PASS |
| 5 | Check that element with id 'hidden-button-clicked' is visible | Element '#hidden-button-clicked' is visible on page indicating click success | Element '#hidden-button-clicked' is visible | PASS |