-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: correct helper pixel detection #32928
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
base: develop
Are you sure you want to change the base?
fix: correct helper pixel detection #32928
Conversation
|
|
@weillercarvalho Very interesting find. I will run the tests to see if they pass. |
|
@weillercarvalho There is a failure here you can see in CircleCI: |
|
@weillercarvalho It might be helpful to know that our |
|
@jennifer-shehane Thank you for the clarification. I will look into the error, try to correct it, and commit later. |
|
@jennifer-shehane I fixed the failing spec by making fake Jimp image behave the way the real library does: it now defines a Also all unit tests passed as well, so now I hope that everything its okay.
|


Additional details
hasHelperPixels()so it samples the real right/bottom helper pixels (the previous off-by-one coordinates caused Jimp tofall back to
(0,0), allowingcy.screenshotto accept captures before the runner UI was fully hidden or visible).packages/server/test/unit/screenshots_spec.jsto expect the corrected coordinates and adds a regression test that failsif
getPixelColorreads outside[0, width-1] × [0, height-1], preventing the bug from regressing.Steps to test
yarn workspace @packages/server test test/unit/screenshots_spec.js.on macOS/Linux with Chrome/Edge installed the spec completes.)
How has the user experience changed?
Before:
cy.screenshot({ capture: 'app' | 'fullPage' })could finish while the runner UI was still visible because the helper-pixel detector always read
(0,0).After: the detector clamps the coordinates, so screenshots aren’t accepted until the helper pixels truly disappear/appear.
PR Tasks
cypress-documentation](https://github.com/cypress-io/cypress-documentation)?
type definitions](https://github.com/cypress-io/cypress/blob/develop/cli/types/cypress.d.ts)?
Note
Clamp helper pixel sampling to image bounds in screenshot detection, update unit tests accordingly, and note the bugfix in the changelog.
hasHelperPixels()inpackages/server/lib/screenshots.tsto clamp sampled coordinates within[0..width-1] × [0..height-1], preventing out-of-bounds reads.packages/server/test/unit/screenshots_spec.jsto stubgetPixelColoron the image instance, use last-index coords, and add a regression test asserting no OOB pixel reads.browserApi.getBrowsersand adjusting timeouts.Written by Cursor Bugbot for commit f2912bd. This will update automatically on new commits. Configure here.