Skip to content

fix: measure the iOS viewport again when a Safari tip takes the native tap - #1307

Merged
plum117 merged 1 commit into
webdriverio:mainfrom
plum117:fix/ios-viewport-safari-tip
Oct 9, 2026
Merged

plum117 merged 1 commit into
webdriverio:mainfrom
plum117:fix/ios-viewport-safari-tip

Conversation

@plum117

@plum117 plum117 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

On the first Safari start of a new iOS simulator (the normal case in CI), every full page screenshot of the session fails:

Negative scroll position detected (scrollY: -12) during full page screenshot at iteration 1.

The error log shows that the cause is earlier: the measured viewport is empty.

viewport: { y: 437, x: 201, width: 0, height: 0 },
bottomBar: { y: 437, x: 0, width: 402, height: 437 },

Root cause. getMobileViewPortPosition() loads a test page with an overlay and makes a native tap in the center of the screen; the overlay stores where the tap landed. On the first Safari start, iOS 26 shows a tip ("View Bookmarks, Share Menu, and Open Tabs"). The tap only closes that tip and never reaches the overlay, so the overlay reports 0x0. Debug screenshots of the measurement: the tip is on the screen before the tap, and gone after it. On Android the function already checks for 0x0 and measures again (for Chrome's Start Surface). On iOS it made 1 attempt with no check, and a unit test even expected the 0x0 result.

The device rectangles are measured once per session, so all full page checks of that session fail. The next sessions work, because the tip does not come back.

What

  • packages/image-comparison-core/src/helpers/utils.ts: the 0x0 check now applies to iOS too, with up to 3 attempts (MAX_IOS_VIEWPORT_MEASUREMENT_ATTEMPTS). On iOS nothing is needed between attempts: the first tap already closed the tip. The Android flow (Back button between attempts) does not change. The warning and the final error now name the cause for each platform.
  • Unit tests: the test that expected the 0x0 result on iOS is replaced by 2 tests: a second attempt that succeeds, and all 3 attempts failing (initial device rectangles + error log). Both fail on the old code.
  • Changeset: @wdio/image-comparison-core patch.

Test

  • pnpm exec vitest run packages/image-comparison-core: 791 passed.
  • Local iOS 26.3 simulators (Xcode 27, iPhone 16 Pro, Safari), pnpm test.local.sims.web on the first boot of a new simulator:
    • without the fix, 3 new simulators: both full page tests failing, "Negative scroll position" every time;
    • with the fix, a 4th new simulator: 2 passing. The log shows Viewport measurement attempt 1/3: overlay did not receive the native click. Safari may be showing a tip, which the tap closed, then the second attempt measures the right viewport.
  • Cloud run on this PR's commit (scheduled-tests with refs/pull/1307/head, run 37958519730): all 5 jobs pass; the 6 iOS web sessions on LambdaTest pass (6 or 7 tests each), so the iOS flow without a tip does not change.

Notes (not changed here)

  • appium:orientation: LANDSCAPE has no effect on iOS 26.3 simulators: the test.local.sims.web sessions stay in portrait.
  • The first boot of a new iOS 26 simulator also shows a "Ready for Apple Intelligence" notification, which can be in the screenshots. A CI job with new simulators needs a warm-up before it saves baselines.

🤖 Generated with Claude Code

…e tap

On the first Safari start of a new iOS 26 simulator, a Safari tip takes
the native tap of the viewport measurement, so the overlay reports 0x0.
The empty viewport made full page screenshots fail with a negative scroll
position. Check the overlay data on iOS too and measure again (3 attempts).
Replace the unit test that expected the 0x0 result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 581e878

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@wdio/image-comparison-core Patch
@wdio/visual-service Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@plum117
plum117 marked this pull request as ready for review October 9, 2026 15:04
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR retries iOS viewport measurements when a native tap misses the page overlay.

  • iOS viewport checks try again when Safari takes the first tap.

No actionable issues were found. Review covered the code and test setup; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load test page and overlay] --> B[Tap screen center]
  B --> C{Overlay received tap?}
  C -->|Yes| D[Restore original URL and return measured rectangles]
  C -->|No| E{Attempts remain?}
  E -->|Yes on iOS| A
  E -->|Yes on Android| F[Press Back]
  F --> A
  E -->|No| G[Log failure and restore original URL]
  G --> H[Return initial rectangles]
Loading

Reviews (1) · Last reviewed commit: "fix: measure the iOS viewport again when..." · Reviewed by Greptile

@plum117
plum117 merged commit 536ad6e into webdriverio:main Oct 9, 2026
10 checks passed
plum117 added a commit that referenced this pull request Oct 9, 2026
#1307 is a fix that users can notice, but it did not update the guide.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants