[BUG] No Diff file if image size is different
See original GitHub issueContext:
- 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:
- Created a year ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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?
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.