-
Notifications
You must be signed in to change notification settings - Fork 607
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
Docker BackstopJS sometimes produces white or cut-off screenshots #1156
Comments
That doesn't sound good. This happened when you bumped your version? |
Does the smoke test run for you? https://github.com/garris/BackstopJS#smoke--feature-tests |
We didn't bump it but we had |
I wouldn't know how to run the smoke test in a local installation with a custom I also just cloned the BackstopJS repo and ran the smoke tests from there. There, it looked fine. |
Also of note: We're using a custom version: "2.1"
services:
testrunner:
image: backstopjs/backstopjs:4.5.0
volumes_from:
- container:${HOSTNAME}:rw
working_dir: ${WORKSPACE}
shm_size: 2048m
command: "test --config ./src/test/regression/.generated.backstop.json" We're running it with the following command: |
I had this error happen to me recently locally with an older BackstopJS docker image as well, so it might not be related to the image update. I was able to fix the error by restarting Docker. Could it be that the cleanup in Docker after the testing is somewhat lacking? |
Config:
I have run tests with and without docker with same results. I think that maybe it is related to the newest chrome |
Strange. I got a similar problem but with slightly different circumstances:
It concerns a class selector with 14 appearances on the test page (enables via selectorExpansion flag) I installed Puppeteer 3.0.1 --> still broken screenshots with BackstopJS 5.0.1 It somewhat smells like Puppeteer 2.0.0 introduced some problems for BackstopJS. |
@kaipahl This is great troubleshooting data -- thank you very much for these clear observations. Is this intermittent? Or consistent? Does it happen only with selectorExpansion -- or it doesn't matter? Does it happen with large screen captures or does size not seem to matter? |
@kaipahl and everyone else -- can you try adding this flag to your config? Please see the help doc here... https://github.com/garris/BackstopJS/blob/f360992b3d4ef4b7dac7928ae4f6fe1cbd5ec629/README.md#alternate-way-of-taking-a-full-page-screenshot Would very much like to see if this resolves the issue for anyone! |
I left the project this was happening in last week and don't have access to the code anymore, so I won't be able to test, unfortunately :( |
I encounter what looks like the same issue reliably on a project, usually on extremely large pages. I always assumed the problem is puppeteer/puppeteer#477 and/or https://bugs.chromium.org/p/chromium/issues/detail?id=760596.
I didn't try this but IIUC that setting only helps with full-page screenshots which would be insufficient for my use case. |
So I created a test for the live homepage of a client and ran the test through different backstop versions. The whole page is quite long: between 7171px (mobile viewport) and 5889px (large desktop). The largest 24bit-PNG screenshot is 7,5MB big (2560 × 5889px). The tests ran through five viewports: mobile (375), tablet (768) and three desktop sizes (1024, 1440 and 2560) By default I left the I included four scenarios:
So each run produced 120 screenshots I tested BackstopJS 4.3.2, 4.4.2, 4.5.1 and 5.0.1 All results, with only two exceptions, were reproducible. In nearly all cases
As expected, the four BackstopJS versions split into two groups with nearly identical results inside each group: 4.3.2 and 4.4.2 (Puppeteer 1.20/Chrome 78) on the one side and 4.5.1 and 5.0.1 (Puppeteer 2.0/Chrome 80) on the other side with the former group producing in my case much better results. 4.3.2/4.4.2 got only problems with three of the 120 screenshots What were the problems of 4.3.2/4.4.2?Three of five screenshots for the whole document via the outer wrapper class failed. Like in the campaign box screenshot example that opened the issue, all screenshots hat the correct height, but the "rendering" is cut-off in-midst of the screenshot.
What's strange: you could be thinking, that it's some sort of memory problem of Puppeteer/Chrome. But why then, is the rendering part of the larger 2560 viewport bigger that of mobile or Desktop-1440?
What were the problems of 4.5.1/5.0.1?The numbers were pretty bad (115/120 failed). The only screenshots that worked, were the screenshots made via the
Funny enough: setting Reducing To be honest: i fail to see any pattern here. Addentum: running BackstopJS on the Mac via NodeJS/NPM script, no Docker involved. |
@kaipahl thanks for this. What is your node version? And what is the hardware profile? The thing that is not adding up for me is that no one is complaining about this at work -- however page lengths are not very long there and we only test one viewport. |
…eenshots Fix for non-docker version
I had the same issue, I was taking screenhots of multiple individual elements on a page, I didn't have issues with whole document screenshots. This is the solution which helped, Made a change and pull request OS: Windows 10 |
5.0.1 version, this issue happens with docker and non-docker versions and puppeteerOffscreenCaptureFix doesn't solve it. Running smoke-test this issue happens in 1, 2 or 3 tests, just like on my website it's inconsistent between runs. Issue exists in docker and non-docker smoke-tests. On my website:
|
We are having the same issue also with cut off and white screenshots using individual selectors Issue occurred from 4.5.0 onwards to 5.0.1 Running on Docker and Non-Docker Versions on Mac OS Node Version 10.15.0 |
…eenshots Added "useBoundingBoxViewportForSelectors" config option Lint fix
) * #1156 Docker BackstopJS sometimes produces white or cut-off screenshots Fix for non-docker version * Restored original line breaks in runPuppet.js * Reverted to puppeteer 2.0.0 * #1156 Docker BackstopJS sometimes produces white or cut-off screenshots Added "useBoundingBoxViewportForSelectors" config option Lint fix * Fixed "useBoundingBoxViewportForSelectors" config option
Hi there. Same here. Updating to higher than 4.4.x makes a big part of our tests fail due to cropped images. |
Hi, it didn't help me, i also have the same problem |
Is there a surefire workaround for this? Is it to go back to a specific version of BackstopJS? Docker or no-Docker? I have tried rolling back to Docker 4.4.0 version and am still seeing certain images cut off. |
I'm not sure, but for me it seems to be related to webfonts and how they are loaded. |
Also running into this using 5.3.2. |
Somehow this seems to be gone with 5.3.4... Can anybody else confirm? |
https://bugs.chromium.org/p/chromium/issues/detail?id=760596 is not fixed so the problem likely persists. However, I also don't have the problem anymore after upgrading to a new machine recently (which would fit with the idea that this problem is due to a race condition in chromium). |
Interestingly it is said there that it may be "something that might already be addressed"... Maybe we are lucky..?! |
Nope, that wasn't a help. Errors came back. But I found out that in fact we had two issues. And I found the solution! See #1344 |
Update: This now occurred with both 4.4.2 Docker image and 4.5.0 Docker image as indicated in my comment below
Our builds currently break with the newest Docker BackstopJS image, 4.5.0. It breaks with both npm version
4.4.2
and4.5.0
.Out of our ~1100 tests, 395 fail. Judging from how the tests fail, it seems like BackstopJS doesn't wait long enough until the content is rendered. Most screenshots are completely white and a few show content which is not completely rendered. Most of the tests that are failing are simple HTML/CSS pages. They load some JavaScript but it does not change the appearance. We also have parts of our pages built with React. With the React components, the "white screenshot" issue happens with a much smaller percentage but it is still there.
The original of the screenshot I'm showing here can be seen here: https://www.static-immobilienscout24.de/fro/core/4.2.3/documentation/html/campaign-box.html#usage
If need be, I could also provide a zip file with the HTML pages and our
backstop.json
.The text was updated successfully, but these errors were encountered: