0
0
Cypresstesting~10 mins

Cypress vs Selenium vs Playwright comparison - Test Execution Compared

Choose your learning style9 modes available
Test Overview

This test opens a sample web page, navigates via link, types into an input field, clicks a button, and verifies the input value persists. It demonstrates how Cypress interacts with page elements and checks expected output.

Test Code - Cypress
Cypress
describe('Input and button interaction', () => {
  it('should type email and verify value persists after button click', () => {
    cy.visit('https://example.cypress.io')
    cy.get('a[href="/commands/actions"]').click()
    cy.get('.action-email').type('test@example.com')
    cy.get('.action-btn').click()
    cy.get('.action-email').should('have.value', 'test@example.com')
  })
})
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test startsTest runner initialized, Cypress ready-PASS
2Browser opens and navigates to https://example.cypress.ioExample Cypress page loadedPage URL is correctPASS
3Finds link with href '/commands/actions' and clicks itNavigated to Actions commands pagePage content updated to Actions commandsPASS
4Finds input with class '.action-email' and types 'test@example.com'Input field contains typed emailInput value is 'test@example.com'PASS
5Finds button with class '.action-btn' and clicks itButton clicked, any event triggered-PASS
6Asserts input '.action-email' still has value 'test@example.com'Input value verifiedInput value equals 'test@example.com'PASS
Failure Scenario
Failing Condition: Element not found or value does not match expected
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify after clicking the button?
AThe page URL changes to a new domain
BThe input field value remains 'test@example.com'
CA new button appears on the page
DThe browser reloads the page
Key Result
Use clear and stable selectors for elements and verify expected values after user actions to ensure reliable tests.