question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] "expect(element).toHaveScreenshot" method doesn't auto-retry screenshot till the timeout, it fails after first try

See original GitHub issue

Context:

  • Playwright Version: 1.22.1
  • Operating System: Mac
  • Node.js version: 14.4
  • Browser: Chromium

Using the code from docs example which is below, expect timeout is set to 15 seconds but in fact I see that “expect(element).toHaveScreenshot” method fails after first try of comparison, it doesn’t re-try screenshot.

const locator = page.locator('button');
await expect(locator).toHaveScreenshot();

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
VsKatshumacommented, Jun 10, 2022

In our use case, we would very much like a matcher that retakes a screenshot until it matches the snapshot. I really hope that something like what @aslushnikov mentioned in https://github.com/microsoft/playwright/issues/14226#issuecomment-1131777539 is implemented in playwright. (polling a screenshot)

Would you be able to confirm if such functionality is underway, or was this just a comment with little weight behind it? If no such method will be available in the near future, we will know to explore an alternative solution.

0reactions
philibcommented, Jun 30, 2022

In our use case, we would very much like a matcher that retakes a screenshot until it matches the snapshot. I really hope that something like what @aslushnikov mentioned in #14226 (comment) is implemented in playwright. (polling a screenshot)

Would you be able to confirm if such functionality is underway, or was this just a comment with little weight behind it? If no such method will be available in the near future, we will know to explore an alternative solution.

We also stumbled across this problem and expected the feature to behave like @VsKathsuma described it. Would that be a bigger change?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make puppeteer wait for page to load - Urlbox
Waiting for too long after the page is loaded, means we are wasting unneccessary time and causing the screenshot request to take longer...
Read more >
screenshotWaitTimeout not accepted as a capability?
Exception: Message: u"An unknown server-side error occurred while processing the command. (Original error: Timed out waiting for screenshot file.
Read more >
Capturing the element issue - Help - UiPath Community Forum
Hi, I want to capture this wrong credential pop-up, But this is visible on the screen for 1-2 sec, when we capture it...
Read more >
Using the Screen Capture API - MDN Web Docs
In this article, we will examine how to use the Screen Capture API and its getDisplayMedia() method to capture part or all of...
Read more >
How to capture/take Selenium Screenshot as Full ... - Tools QA
Why is Screenshot required in Automation testing? How to take a Selenium screenshot Full page & of a particular element in Selenium ?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found