Test Overview
This test checks if a button with the ID submit-btn is visible and enabled on the page using Cypress expect() BDD assertions.
This test checks if a button with the ID submit-btn is visible and enabled on the page using Cypress expect() BDD assertions.
describe('Button visibility and state test', () => { it('should verify the submit button is visible and enabled', () => { cy.visit('https://example.com') cy.get('#submit-btn').then(($btn) => { expect($btn).to.be.visible expect($btn).to.be.enabled }) }) })
| 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' | Browser shows the homepage of example.com | - | PASS |
| 3 | Find element with selector '#submit-btn' using cy.get | Button with ID 'submit-btn' is present in the DOM | Element found successfully | PASS |
| 4 | Use expect() to check if the button is visible | Button is visible on the page | expect($btn).to.be.visible | PASS |
| 5 | Use expect() to check if the button is enabled | Button is enabled and clickable | expect($btn).to.be.enabled | PASS |
| 6 | Test ends successfully | All assertions passed, test complete | - | PASS |