Rayrun
← Back to Discord Forum

Screenshot test keeps failing

  • page._expectScreenshot with timeout 60000ms
    • verifying given screenshot expectation
    • taking page screenshot
    • disabled all CSS animations
    • Expected an image 1280px by 2347px, received 1280px by 3515px. 1568966 pixels (ratio 0.35 of all image pixels) are different.
    • waiting 100ms before taking screenshot
    • taking page screenshot
    • disabled all CSS animations
    • captured a stable screenshot
    • Expected an image 1280px by 2347px, received 1280px by 3515px. 1589065 pixels (ratio 0.36 of all image pixels) are different.

This thread is trying to answer question "Why does my screenshot test keep failing due to pixel differences between the expected and actual images?"

3 replies

@deprecated117

Hi, there can be slight differences between headless and headful. Also between platform and browser. Be sure to take the reference screenshots on the same platform, on the same browser, on the same headless/headful state, etc.

This page has a good explanation: https://playwright.dev/docs/test-snapshots

It also includes instructions how to generate the screenshots/snapshots for the (Docker) runs in CI.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].