Test Overview
This test opens a sample web page, navigates via link, types into an input field, clicks a button, and verifies the input value persists. It demonstrates how Cypress interacts with page elements and checks expected output.
This test opens a sample web page, navigates via link, types into an input field, clicks a button, and verifies the input value persists. It demonstrates how Cypress interacts with page elements and checks expected output.
describe('Input and button interaction', () => { it('should type email and verify value persists after button click', () => { cy.visit('https://example.cypress.io') cy.get('a[href="/commands/actions"]').click() cy.get('.action-email').type('test@example.com') cy.get('.action-btn').click() cy.get('.action-email').should('have.value', 'test@example.com') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, Cypress ready | - | PASS |
| 2 | Browser opens and navigates to https://example.cypress.io | Example Cypress page loaded | Page URL is correct | PASS |
| 3 | Finds link with href '/commands/actions' and clicks it | Navigated to Actions commands page | Page content updated to Actions commands | PASS |
| 4 | Finds input with class '.action-email' and types 'test@example.com' | Input field contains typed email | Input value is 'test@example.com' | PASS |
| 5 | Finds button with class '.action-btn' and clicks it | Button clicked, any event triggered | - | PASS |
| 6 | Asserts input '.action-email' still has value 'test@example.com' | Input value verified | Input value equals 'test@example.com' | PASS |