Skip to content

fix: hide the hideAfterFirstScroll elements before the full page scroll wait - #1315

Merged
plum117 merged 1 commit into
webdriverio:mainfrom
plum117:fix/hide-after-first-scroll-before-wait
Oct 10, 2026
Merged

plum117 merged 1 commit into
webdriverio:mainfrom
plum117:fix/hide-after-first-scroll-before-wait

Conversation

@plum117

@plum117 plum117 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

Found with the new iOS simulator CI job (#1310): the full page check "with ignore elements" failed with 0.413 % in the compare run. The test hides the sticky top bar after the first scroll (hideAfterFirstScroll: [$('nav.navbar')]). In the baseline the bar was hidden in the second part of the full page image; in the failing image it was still there (rows 2106–2346, exactly at the top of the second viewport screenshot).

Cause: in all 3 full page functions the order was: scroll → wait fullPageScrollTimeout → hide the elements → take the screenshot immediately. Nothing waited between hiding and the screenshot, so on a slow device the screenshot could come before the page was drawn again. The same 0.413 % failure happened on a local iOS 26.3 simulator earlier.

What

  • packages/image-comparison-core/src/methods/screenshots.ts: in getMobileFullPageNativeWebScreenshotsData, getAndroidChromeDriverFullPageScreenshotsData and getDesktopFullPageScreenshotsData, hide the hideAfterFirstScroll elements before the wait, so the page has the whole wait to be drawn again. The wait is still before the screenshot, so lazy loading keeps the same time.
  • Unit tests: each of the 3 existing hideAfterFirstScroll tests also checks the order (the hide call runs after the first wait and before the wait of the second scroll). These checks fail without the change.
  • Changeset: @wdio/image-comparison-core patch.

Test

  • pnpm exec vitest run packages/image-comparison-core: 791 passed. Lint and types pass.
  • The Android emulator job of this PR runs the mobile web suite (which uses hideAfterFirstScroll) on a real emulator.
  • After this PR, ci: run the iOS mobile web e2e tests on a simulator #1310 (iOS simulator CI) will be rebased to confirm the iOS result.

Known limit (not changed)

If hideAfterFirstScroll gets an unresolved element ($('…') without await), the browser script finds it by its selector at the moment of the call. An element that the page creates or replaces during the scroll wait (for example a header that a script adds on scroll) was found by the old order (after the wait) and is not found now. We have not seen this case; if it happens, the fix is to run the hide again after the wait as well.

🤖 Generated with Claude Code

…ll wait

The elements were hidden after the fullPageScrollTimeout wait, just
before the screenshot, so nothing waited for the page to be drawn again
without them. On a slow CI iOS simulator, the second part of a full page
image still showed the sticky header (0.413 % mismatch). Hide them before
the wait in the 3 full page functions (mobile native web, Android
ChromeDriver, desktop).

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: 8aa088b

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 10, 2026 00:00
@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Moves hideAfterFirstScroll before fullPageScrollTimeout in all three full-page screenshot functions, giving the page time to redraw before capture.

  • Full-page screenshots hide selected elements before the scroll wait.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix: hide the hideAfterFirstScroll eleme..." · Reviewed by Greptile

@plum117
plum117 merged commit ee3a8a9 into webdriverio:main Oct 10, 2026
11 checks passed
plum117 added a commit that referenced this pull request Oct 10, 2026
A check of the 30 changesets against the v11 guide found 4 user-visible
changes that the guide did not list: the Jasmine `expect.extend()` path
(#1332), the warning for Android browser sessions in BiDi (#1314),
`hideAfterFirstScroll` before the wait (#1315) and the clear error for a
mobile full page screenshot without a viewport (#1334). Also the reporter
no longer publishes the generated route types (#1304), and the report UI
uses React Router 8.

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.

1 participant