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] No Diff file if image size is different

See original GitHub issue

Context:

  • Playwright Version: v1.27.0
  • Operating System: Linux
  • Node.js version: 16.17.1
  • Browser: Chromium

Code Snippet My basic test.

const {chromium, webkit, firefox} = require('playwright');
// my config is in a different file, but this line is relevant. 
const config = { use: { viewPort: { width: 1280, height: 4462 }};

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  const page = await context.newPage();
  
  await expect(page).toHaveScreenshot({
     maxDiffPixelRatio: 0.03,
     fullPage: true,
     animations: "disabled",
  });
})();

Describe the bug

Occasionally my tests seem to fail where the height of the page is incorrect, however, playwright does not generate a diff file, i think because the compared and expected images are the wrong height. I get the following output

    Error: Screenshot comparison failed:

      Expected an image 1280px by 6061px, received 1280px by 6068px. 

    Call log:
      - expect.toHaveScreenshot with timeout 5000ms
      -   verifying given screenshot expectation
      - taking page screenshot
      -   disabled all CSS animations
      - Expected an image 1280px by 6061px, received 1280px by 6068px. 
      - waiting 100ms before taking screenshot
      - taking page screenshot
      -   disabled all CSS animations
      - captured a stable screenshot
      - Expected an image 1280px by 6061px, received 1280px by 6068px.

But no diff file.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
atlowlcommented, Oct 16, 2022

@jfgreffier, yep - i do actually like that. I see your point about being intentional not to provide a diff file when they are different sizes. I used a fixed view port to try and get around that issue. Guess i can close this as being worked on?

1reaction
jameskipcommented, Oct 13, 2022

I think the exclusion of a diff file is intentional. I’m not aware of a scenario where if the dimensions of the window are incorrect a diff would be useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git diff of image does not properly show resolution and size
Issue Type: Bug Edit an image. In the source control tab, see that the image has changed. Click the image to view the...
Read more >
What does "size" refer to in git diff output? - Stack Overflow
It is a text file so I expect to see meaningful output if the contents changed. What reassurance do I have that the...
Read more >
Container-diff Tutorial: Change Management for Containers
Filesystem: shows all the files in the image and their size. Layer history: prints the commands that generated each of the layers in...
Read more >
Linux diff – How to Compare Two Files and Apply Changes ...
diff is case sensitive by default. -w to ignore whitespaces in a file. By default whitespaces are considered a difference. patch Command Syntax....
Read more >
Limits for viewing content and diffs | Bitbucket Cloud
The maximum number of files in a single diff is limited to 200. ... If you need to keep large files in Bitbucket,...
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