Test Overview
This test opens a simple web page, clicks a button, and verifies that the button click changes the text on the page. It demonstrates how Cypress runs tests inside the browser and interacts with page elements.
This test opens a simple web page, clicks a button, and verifies that the button click changes the text on the page. It demonstrates how Cypress runs tests inside the browser and interacts with page elements.
describe('Button click changes text', () => { it('should change text when button is clicked', () => { 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 | Cypress test runner initializes | - | PASS |
| 2 | Browser opens and navigates to 'https://example.cypress.io/commands/actions' | Browser shows the Cypress example actions page | - | PASS |
| 3 | Finds the first button with class '.action-btn' | Button element is located in the DOM | - | PASS |
| 4 | Clicks the found button | Button is clicked, triggering any click handlers | - | PASS |
| 5 | Checks that the button text changed to 'Clicked!' | Button text is updated in the DOM | Verify button text equals 'Clicked!' | PASS |