Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: toHaveScreenshot sometimes not showing actual/diff on error for webkit #34565

Open
dimkin-eu opened this issue Jan 31, 2025 · 7 comments

Comments

@dimkin-eu
Copy link

Version

1.50.0

Steps to reproduce

I understand this is a very vague description, but I can't find any consistent pattern.
It happens for 1-2 tests out of 2K+, but this fail the whole job :(
The only idea that comes to my mind - the page wasn't stable to assert a screenshot, but animations are disabled by our code - anyway some actual screenshot must be there

    await expect(page).toHaveScreenshot(`${filename}.png`, {
        scale: "css",
        caret: "hide",
        animations: "allow",
        maxDiffPixels,
    })

Expected behavior

on error 3 images produced

Actual behavior

only expected image in stacktrace/report

    Error: Timed out 15000ms waiting for expect(page).toHaveScreenshot(expected)
      Timeout 15000ms exceeded.
    Expected: /builds/frontend/foobar.png
    Call log:
      - expect.toHaveScreenshot(foobar.png) with timeout 15000ms
        - verifying given screenshot expectation
      - taking page screenshot
      - waiting for fonts to load...
      - fonts loaded
      - Timeout 15000ms exceeded.
     

Additional context

No response

Environment

FROM mcr.microsoft.com/playwright:v1.50.0-jammy
pnpm 9.15.2
@dimkin-eu dimkin-eu changed the title [Bug]: toHaveScreenshot sometimes not showing actial/diff on error for webkit [Bug]: toHaveScreenshot sometimes not showing actual/diff on error for webkit Jan 31, 2025
@agg23
Copy link
Contributor

agg23 commented Jan 31, 2025

Please provide a complete and minimal repro of this issue. Otherwise we cannot diagnose it.

@dgozman
Copy link
Contributor

dgozman commented Feb 3, 2025

@dimkin-eu If there is no actual screenshot, that means screenshot action did timeout without being able to take a single screenshot. If your environment is slow, perhaps increasing a timeout would help. Otherwise, that could be a bug where screenshot just hangs, but we would need a repro to be able to fix it.

@dimkin-eu
Copy link
Author

@dgozman env is ok, trace is recording ( and saved ), parallelly tests were running, test before and after is passing for same device.
I understand, that repro is needed, but I have no idea about causes :( Will try to dive more.

Same happens in 1.50.1 :(

@dimkin-eu
Copy link
Author

JFYI added some debug logs

pw:api => expect.toHaveScreenshot(AR-163_Story.png) started +17ms
pw:api expect.toHaveScreenshot(AR-163_Story.png) with timeout 15000ms +15ms
pw:api   verifying given screenshot expectation +1ms
pw:api taking page screenshot +0ms
pw:api waiting for fonts to load... +13ms
pw:api fonts loaded +70ms
pw:api failed to take screenshot -  +17s
pw:api <= expect.toHaveScreenshot(AR-163_Story.png) succeeded +2ms

what I can see from the trace - page in the timeline is alive, but in step's snapshot is blanc
Also ( from recent-ish changes ) page contain canvases

@dgozman
Copy link
Contributor

dgozman commented Feb 5, 2025

Re: canvas - the recent changes were about canvas in tracing. If you disable tracing, does the problem still persist? If so, perhaps running with DEBUG=pw:protocol could tell me something, but hopes are low.

@dimkin-eu
Copy link
Author

Yes, turning off trace doesn't fail tests anymore. Previously it was retain-on-failure

DEBUG=pw:protocol adds so many logs, so CI sends the rest to /dev/null

Job's log exceeded limit of 10240000 bytes.
Job execution will continue but no more output will be collected.

@dimkin-eu
Copy link
Author

Maybe this could give a hint

Not exactly my bug, but some common things - canvas shown in timeline, but not shown in snapshot

Image

    projects: [
        {
            name: "iPhone 11",
            use: {
                ...devices["iPhone 11"],
            },
        }
    ],
import {expect, test} from '@playwright/test'

test.describe("describe", () => {
    test("short storybook spec", async ({page}) => {
        await page.goto("https://zimjs.com/parallax.html")
        await expect(page).toHaveScreenshot(`foobar.png`, {
            scale: "css",
            caret: "hide",
            animations: "allow",
        })
    })
})

trace.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants