0
0
Cypresstesting~10 mins

Percy integration basics in Cypress - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test opens a webpage and takes a visual snapshot using Percy to verify the page looks correct. It checks that Percy captures the snapshot without errors.

Test Code - Cypress
Cypress
import '@percy/cypress';

describe('Percy integration basics', () => {
  it('should capture a visual snapshot of the homepage', () => {
    cy.visit('https://example.cypress.io');
    cy.percySnapshot('Homepage Snapshot');
  });
});
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test startsTest runner initialized, Cypress environment ready-PASS
2Browser opensBrowser window launched by Cypress-PASS
3Navigates to 'https://example.cypress.io'Page loads showing Cypress example homepagePage URL is 'https://example.cypress.io/'PASS
4Calls cy.percySnapshot('Homepage Snapshot')Percy captures a visual snapshot of the current pageSnapshot named 'Homepage Snapshot' is sent to Percy servicePASS
5Test endsTest completes with no errors-PASS
Failure Scenario
Failing Condition: Percy snapshot command fails due to missing Percy plugin or network issue
Execution Trace Quiz - 3 Questions
Test your understanding
What does cy.percySnapshot('Homepage Snapshot') do in this test?
AClicks a button named 'Homepage Snapshot'
BNavigates to a page called 'Homepage Snapshot'
CTakes a visual snapshot of the current page for Percy to compare
DChecks if the page title is 'Homepage Snapshot'
Key Result
Always verify that the Percy plugin is properly installed and configured before using cy.percySnapshot to avoid runtime errors.