Test Overview
This test opens a webpage with a dropdown menu, selects an option using cy.select(), and verifies the correct option is selected.
This test opens a webpage with a dropdown menu, selects an option using cy.select(), and verifies the correct option is selected.
describe('Dropdown selection test', () => { it('selects an option from the dropdown and verifies it', () => { cy.visit('https://example.com/dropdown') cy.get('#fruits').select('Banana') cy.get('#fruits').should('have.value', 'Banana') }) })
| 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.com/dropdown' | Browser shows the dropdown page with id 'fruits' | - | PASS |
| 3 | Finds dropdown element with id '#fruits' | Dropdown element is visible and enabled | - | PASS |
| 4 | Selects option 'Banana' from the dropdown using cy.select('Banana') | Dropdown option 'Banana' is selected | - | PASS |
| 5 | Asserts dropdown value is 'Banana' using should('have.value', 'Banana') | Dropdown value is 'Banana' | Verify dropdown value equals 'Banana' | PASS |