Test Overview
This test opens a simple webpage, clicks a button, and verifies that the button text changes as expected. The assertion checks that the expected behavior occurs after the click.
This test opens a simple webpage, clicks a button, and verifies that the button text changes as expected. The assertion checks that the expected behavior occurs after the click.
describe('Button click changes text', () => { it('should change button text after click', () => { cy.visit('https://example.cypress.io/commands/actions') cy.get('.action-btn').first().click() cy.get('.action-btn').first().should('have.text', '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/commands/actions | Page loads with a list of action buttons visible | - | PASS |
| 3 | Find the first button with class 'action-btn' | Button element found with text 'Click me' | - | PASS |
| 4 | Click the found button | Button clicked, page reacts by changing button text | - | PASS |
| 5 | Assert the button text is now 'Clicked!' | Button text updated to 'Clicked!' | Verify button text equals 'Clicked!' | PASS |