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.
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.
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'); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, Cypress environment ready | — | PASS |
| 2 | Browser opens | Browser window launched by Cypress | — | PASS |
| 3 | Navigates to 'https://example.cypress.io' | Page loads showing Cypress example homepage | Page URL is 'https://example.cypress.io/' | PASS |
| 4 | Calls cy.percySnapshot('Homepage Snapshot') | Percy captures a visual snapshot of the current page | Snapshot named 'Homepage Snapshot' is sent to Percy service | PASS |
| 5 | Test ends | Test completes with no errors | — | PASS |
cy.percySnapshot('name') to capture snapshots.cy.percySnapshot('Homepage').describe('Visual test', () => {
it('checks homepage', () => {
cy.visit('/')
cy.percySnapshot('Homepage loaded')
cy.get('#login').click()
cy.percySnapshot('Login clicked')
})
})cy.percySnapshot() call captures one snapshot, so total is 2.it('checks page', () => {
cy.visit('/page')
cy.percySnapshot()
})cy.percySnapshot() command requires a name string argument to identify the snapshot.cy.percySnapshot() calls at correct steps.Pass the test and this pattern moves unknown