Skip to content

fix: handle disappearing iframes during screenshot preparation - #1328

Draft
DenisLevkovets wants to merge 1 commit into
gemini-testing:masterfrom
DenisLevkovets:fix/disappearing-screenshot-iframes
Draft

fix: handle disappearing iframes during screenshot preparation#1328
DenisLevkovets wants to merge 1 commit into
gemini-testing:masterfrom
DenisLevkovets:fix/disappearing-screenshot-iframes

Conversation

@DenisLevkovets

Copy link
Copy Markdown

fix: handle disappearing iframes during screenshot preparation

Summary

Handle auxiliary iframes that disappear while assertView prepares or cleans up page animations.

runInEachDisplayedIframe currently calls session.$(iframe).isDisplayed() with a raw WebDriver element reference. Such an element has no selector. If it becomes stale during the visibility check, WDIO attempts to refetch it using an undefined selector, masking the original error with selector needs to be typeof string or function, but found: undefined. An iframe can also disappear between the visibility check and switchToFrame.

  • Execute WDIO's existing visibility script directly, preserving visibility semantics without selector-based refetch.
  • Check and enter each iframe sequentially.
  • Skip only stale element reference / no such frame errors during the visibility check or frame entry, with a warning and a reset to the top-level frame.
  • Preserve callback errors, including stale-element errors, and restore the top-level frame in finally.
  • Add 16 unit tests in the existing Mocha/Sinon suite. No dependency or lockfile changes.

Validation

  • npm run build: passed.
  • npm test: 3472 passing, 1 pending; type checking and lint passed.
  • Focused regression suite: 16 passing. With the original implementation restored: 15 failing, 1 passing.
  • Real desktop Chrome: 12 regression checks passed, including deterministic iframe removal after discovery and before frame entry, hidden iframes, and callback error propagation.
  • Real Android Chrome 101: the same 12 regression checks passed.
  • Built upstream Testplane, without module replacement: all 6 real assertView cases passed against existing screenshot references, with disableAnimation: true, retry: 0, and no reference updates.

The real-browser checks used an external temporary reproducer; they are not part of this PR's committed test suite. Full upstream e2e/browser-env suites and the original Storybook CI job were not run.

CLA

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=ru.

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