Test Overview
This test checks that clicking a button on a webpage triggers the expected change, simulating how a real user interacts with the page.
This test checks that clicking a button on a webpage triggers the expected change, simulating how a real user interacts with the page.
describe('User interaction simulation test', () => { it('should update text after button click', () => { cy.visit('https://example.cypress.io') cy.get('#query-btn').click() cy.get('#query-btn').should('have.text', 'Button clicked') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, no browser opened yet | - | PASS |
| 2 | Browser opens and navigates to 'https://example.cypress.io' | Page loaded with initial content and button labeled 'Button' | - | PASS |
| 3 | Finds button element with id 'query-btn' | Button element is visible and enabled | - | PASS |
| 4 | Clicks the button element | Button click event triggers text change | - | PASS |
| 5 | Checks that button text changed to 'Button clicked' | Button text updated on page | Verify button text is exactly 'Button clicked' | PASS |