Skip to content

Android E2E fails on main: element screenshot is 262 px, test expects 263 px #297

Closed

Description

@V3RON

Describe the bug

On main, the playground's E2E Android suite fails one test in apps/playground/src/__tests__/normal/ui/screenshot.harness.tsx:

● Screenshot › should screenshot specific element only

  expected { width: 262, height: 262 } to deeply equal { width: 263, height: 263 }

Every pull request run of the E2E workflow has failed E2E Android with this since Oct 22, including PRs that have since merged (for example fix/cli-metro-port-option, fix/bundle-one-react-native, ci/native-fingerprint-cache, #249 and #257). main looks green only because its push runs build the app caches and skip the E2E Android job, so this test never runs there.

Likely cause

Two changes merged on Oct 22 disagree on how a fractional element size becomes pixels:

The CI emulator uses the pixel_6 profile (420 dpi, PixelRatio 2.625), so 100 dp is 262.5 px and the test expects 263. The element is centred inside a 200 dp box in a 411.43 dp wide window, so its left edge is at 155.71 dp (408.75 px, rounded to 409) and its right edge at 255.71 dp (671.25 px, rounded to 671). The capture is 262 px wide, which is correct for edge rounding.

The last passing E2E Android run (fix/null-screenshot-matcher, Oct 21) predates both changes.

Suggested fix

Change the test, not the capture: #289's edge rounding is the behaviour we want. The assertion could compute the expected size from the element's rounded edges, or accept either neighbour of 100 * PixelRatio.get() when that value is fractional.

Steps to reproduce

  1. Run the playground's Android harness suite on the pixel_6 emulator profile (as the E2E workflow does), or trigger the E2E workflow on any pull request.
  2. should screenshot specific element only fails with the error above.

React Native Harness version: main at 4a8132c

Activity

  1. added
    bug
    on Oct 27, 2026
  2. added a commit that references this issue on Oct 29, 2026
    26b67ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions