0
0
Cypresstesting~10 mins

Cypress architecture (runs in browser) - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test opens a simple web page, clicks a button, and verifies that the button click changes the text on the page. It demonstrates how Cypress runs tests inside the browser and interacts with page elements.

Test Code - Cypress
Cypress
describe('Button click changes text', () => {
  it('should change text when button is clicked', () => {
    cy.visit('https://example.cypress.io/commands/actions')
    cy.get('.action-btn').first().click()
    cy.get('.action-btn').first().should('have.text', 'Clicked!')
  })
})
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test startsCypress test runner initializes-PASS
2Browser opens and navigates to 'https://example.cypress.io/commands/actions'Browser shows the Cypress example actions page-PASS
3Finds the first button with class '.action-btn'Button element is located in the DOM-PASS
4Clicks the found buttonButton is clicked, triggering any click handlers-PASS
5Checks that the button text changed to 'Clicked!'Button text is updated in the DOMVerify button text equals 'Clicked!'PASS
Failure Scenario
Failing Condition: Button with class '.action-btn' is not found or text does not change after click
Execution Trace Quiz - 3 Questions
Test your understanding
Where does Cypress run the test code?
AOn a separate server outside the browser
BInside the browser alongside the application
COnly in the command line interface
DIn a mobile device emulator
Key Result
Cypress runs tests directly inside the browser, allowing it to interact with page elements in real time and verify UI changes immediately.