Repository navigation
test(playground): expect element screenshots to cover the element's rounded edges - #298
Merged
Merged
Conversation
…ounded edges Fixes #297
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this?
The playground's E2E Android suite fails
should screenshot specific element onlyon every pull request since Oct 22: the element screenshot is 262×262 px, and the test expects 263×263. This fixes the test, which was wrong. The capture is correct.Fixes #297.
How does it work?
Android region captures round each edge of the region to a whole pixel (#289), so they cover exactly the pixels the element covers on screen. The assertion rounded the size instead: on the CI emulator (
PixelRatio2.625) a 100 dp element is 262.5 px, which rounds to 263, but its edges at 408.75 px and 671.25 px round to 409 and 671, so it covers 262 px.The test now measures the element with
measureInWindowand expects the size its rounded edges span. Where the pixel ratio makes element edges whole pixels, as on the iOS simulator and in Chromium, this is the same size as before.Why is this useful?
E2E Android goes green again on pull requests, so it can catch real regressions again, starting with #249 and #257, which are blocked on this failure today.