Test Overview
This test checks if a specific button exists on the page, is visible to the user, and has the correct text label. It verifies these common assertions using Cypress commands.
This test checks if a specific button exists on the page, is visible to the user, and has the correct text label. It verifies these common assertions using Cypress commands.
describe('Common assertions test', () => { it('checks button existence, visibility, and text', () => { cy.visit('https://example.cypress.io') cy.get('#query-btn') .should('exist') .and('be.visible') .and('have.text', 'Button') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, no browser opened yet | - | PASS |
| 2 | Browser opens | Browser window opens ready for navigation | - | PASS |
| 3 | Navigates to 'https://example.cypress.io' | Page loads with example Cypress site content | - | PASS |
| 4 | Finds element with selector '#query-btn' using cy.get | Button element with id 'query-btn' is present in DOM | Checks element exists in DOM | PASS |
| 5 | Checks element 'exist' assertion | Element is confirmed present | Element exists in the DOM | PASS |
| 6 | Checks element 'be.visible' assertion | Element is visible on the page | Element is visible to the user | PASS |
| 7 | Checks element 'have.text' assertion with text 'Button' | Element text content is 'Button' | Element text matches expected 'Button' | PASS |
| 8 | Test ends | All assertions passed, test completes successfully | - | PASS |