0
0
Cypresstesting~10 mins

Full-page screenshots in Cypress - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test opens a webpage and takes a full-page screenshot to verify the entire page is captured correctly.

Test Code - Cypress
Cypress
describe('Full-page Screenshot Test', () => {
  it('should capture a full-page screenshot', () => {
    cy.visit('https://example.cypress.io')
    cy.screenshot({ capture: 'fullPage' })
  })
})
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test startsTest runner initialized, no browser opened yet-PASS
2Browser opensBrowser window opens ready for testing-PASS
3Navigates to 'https://example.cypress.io'Page loads fully with visible contentPage URL is correct and page is loadedPASS
4Takes a full-page screenshot using cy.screenshot({ capture: 'fullPage' })Screenshot captures entire scrollable page contentScreenshot file is created and savedPASS
5Test endsScreenshot saved, browser ready to close-PASS
Failure Scenario
Failing Condition: The page URL is incorrect or page fails to load fully before screenshot
Execution Trace Quiz - 3 Questions
Test your understanding
What does the 'capture: fullPage' option do in cy.screenshot()?
ACaptures only the visible viewport area
BCaptures the entire scrollable page in the screenshot
CCaptures only the header section of the page
DCaptures a screenshot after scrolling down once
Key Result
Always ensure the page is fully loaded before taking a full-page screenshot to capture all content correctly.