Test Overview
This test demonstrates using dual commands in Cypress to find an input box, type text, and then verify the typed value.
This test demonstrates using dual commands in Cypress to find an input box, type text, and then verify the typed value.
describe('Dual commands test', () => { it('types text and verifies input value', () => { cy.visit('https://example.cypress.io/commands/actions') cy.get('.action-email') .type('test@example.com') .should('have.value', 'test@example.com') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, no browser opened yet | — | PASS |
| 2 | Browser opens | Browser window opened, ready to navigate | — | PASS |
| 3 | Navigates to 'https://example.cypress.io/commands/actions' | Page loaded with form containing input fields | Page URL is correct | PASS |
| 4 | Finds element with class '.action-email' | Input box for email is visible and enabled | Element exists and is visible | PASS |
| 5 | Types 'test@example.com' into the input box | Input box now contains text 'test@example.com' | Input value updated correctly | PASS |
| 6 | Checks that input box has value 'test@example.com' | Input box value is 'test@example.com' | Value matches expected text | PASS |
dual commands in Cypress tests?submitBtn using a dual command in Cypress?cy.get(selector).click() finds the element and clicks it in one chain.find which is not a root command.cy.get('.input-field').type('Hello').should('have.value', 'Hello')type() types text into the element and returns the element for further chaining.should('have.value', 'Hello') checks if the input's value is 'Hello', which is correct after typing.cy.get('.checkbox').check('#checkbox1')check() command acts on the element found by get() and does not take any selector argument.check('#checkbox1') incorrectly passes a selector, causing an error.firstName and 'Doe' into input with id lastName in Cypress?Pass the test and this pattern moves unknown