Test Overview
This test opens a web page with a text input field, types some text into it, then clears the input using cy.clear(). It verifies that the input field is empty after clearing.
This test opens a web page with a text input field, types some text into it, then clears the input using cy.clear(). It verifies that the input field is empty after clearing.
describe('Input field clear test', () => { it('should clear the input field after typing', () => { cy.visit('https://example.cypress.io/commands/actions') cy.get('.action-email') .type('hello@example.com') .should('have.value', 'hello@example.com') .clear() .should('have.value', '') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, no browser opened yet | - | PASS |
| 2 | Browser opens | Browser window opens, ready to load page | - | PASS |
| 3 | Navigates to 'https://example.cypress.io/commands/actions' | Page loads with various input fields visible | Page URL is correct | PASS |
| 4 | Finds input element with class '.action-email' | Input field for email is visible and enabled | Element found and visible | PASS |
| 5 | Types 'hello@example.com' into the input field | Input field value is now 'hello@example.com' | Input value equals 'hello@example.com' | PASS |
| 6 | Clears the input field using cy.clear() | Input field is empty | Input value equals '' (empty string) | PASS |
| 7 | Test ends | Browser remains open or closes depending on config | - | PASS |