Skip to content

driver: source failures can falsely satisfy negative assertions #149

Closed

Description

@BenSheridanEdwards

Problem

wdioDriver().source() catches browser.getPageSource() failures and returns "". The locator/expect layer cannot distinguish an unavailable source from a successful empty/absent snapshot, so a negative assertion can pass immediately while the Appium/WebdriverIO source command is failing.

On exact main dfa57e72047c155a97e512121ed8608368108597, the observable regression probe produced this for both platforms:

[nativeproof] getPageSource failed: Error: ios source unavailable
ios unavailable + negative: RESOLVED (unsafe false pass)
ios recovery + present + negative: attempts=1 RESOLVED (unsafe false pass)
ios recovery + legitimately absent + negative: attempts=1 RESOLVED
[nativeproof] getPageSource failed: Error: android source unavailable
android unavailable + negative: RESOLVED (unsafe false pass)
android recovery + present + negative: attempts=1 RESOLVED (unsafe false pass)
android recovery + legitimately absent + negative: attempts=1 RESOLVED
AssertionError: source failures must not become successful absence assertions

The probe exited 1. This is observable matcher behaviour, not only a direct unit assertion on Driver.source().

Expected behavior

  • A failed page-source read is not treated as proof that an element is absent.
  • Polling can recover from a transient source failure, using the existing waitUntil producer-error recovery.
  • A negative assertion only passes after at least one successful source snapshot establishes legitimate absence.
  • Positive assertions retain normal polling and failure semantics.
  • Persistent source unavailability preserves the underlying error.
  • Behaviour is equivalent on iOS and Android.

Scope / compatibility

Keep the fix in the WebdriverIO driver source seam; do not change config/CLI or selector semantics. Validate positive and negative visibility assertions across unavailable, recovered-present, and recovered-absent source states on both platforms.

Duplicate sweep

Searched all issues and PRs for getPageSource source unavailable assertion, negative assertion empty XML, and page source failure; no matching open or closed assertion-safety issue/PR was found. PR #126 fixed explicit iOS visible="false" / Android displayed="false" handling and tap visibility; it does not address failed page-source reads being converted to empty XML.

Activity

  1. BenSheridanEdwards commented on Sep 15, 2026

    @BenSheridanEdwards
    OwnerAuthor

    Fix proposed in #150: preserve page-source errors so unavailable source cannot count as absence, with exact-main fail/fixed-pass coverage for positive and negative assertions on both platform branches.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions