Verify that the login button is enabled after entering valid credentials
Preconditions (1)
✅ Expected Result: The login button should be enabled after entering valid email and password
describe('Login Button Enablement Test', () => { beforeEach(() => { cy.visit('/login'); }); it('should enable login button after valid credentials are entered', () => { cy.get('#email').type('user@example.com'); cy.get('#password').type('Password123'); cy.get('#login-btn').should('be.enabled'); }); });
The test starts by visiting the login page before each test to ensure a clean state.
We use cy.get() with id selectors to find the email and password input fields and type valid credentials.
Finally, we assert that the login button is enabled using should('be.enabled'). This verifies the expected behavior that the button becomes clickable only after valid inputs.
Cypress automatically waits for elements to appear and become actionable, so no manual waits are needed.
Now add data-driven testing with 3 different sets of valid credentials to verify the login button enables each time
submit is visible in Cypress?cy.get(selector).should('be.visible') checks visibility.cy.get('.message').should('contain.text', 'Success')cy.get('.title').should('have.text', Success)agree is checked after clicking it. Which assertion correctly verifies this expected behavior?should('be.checked') which verifies checkbox state.be.checked, which is correct. The other options incorrectly check value, visibility, or text content.Pass the test and this pattern moves unknown