Skip to content

fix(driver): reject unavailable page source - #150

Open
BenSheridanEdwards wants to merge 1 commit into
mainfrom
fix/assertion-source-unavailable
Open

BenSheridanEdwards wants to merge 1 commit into
mainfrom
fix/assertion-source-unavailable

Conversation

@BenSheridanEdwards

@BenSheridanEdwards BenSheridanEdwards commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Fixes #149

Summary

  • Preserves browser.getPageSource() failures instead of converting them to empty XML.
  • Prevents unavailable page source from falsely satisfying negative locator assertions.
  • Adds iOS and Android regression coverage for persistent failure, polling recovery, positive/negative assertions, and legitimate absence.

Proof

  • npm run check — Biome checked 57 files; TypeScript passed.
  • npm test — 230 passed, 0 failed.
  • Generated project/device proof, or N/A: N/A — this changes non-rendered WebdriverIO error propagation. Device lanes were deliberately not used; observable matcher tests and a fresh packed-package consumer cover both platform branches without claiming device proof.

Better than exact main

Exact baseline: dfa57e72047c155a97e512121ed8608368108597.

With the new regression tests applied to that baseline:

✖ wdioDriver ios source failures cannot satisfy positive or negative assertions
✖ wdioDriver ios assertions recover before deciding presence or absence
✖ wdioDriver android source failures cannot satisfy positive or negative assertions
✖ wdioDriver android assertions recover before deciding presence or absence
ℹ tests 18
ℹ pass 14
ℹ fail 4

On this PR head:

✔ wdioDriver ios source failures cannot satisfy positive or negative assertions
✔ wdioDriver ios assertions recover before deciding presence or absence
✔ wdioDriver ios distinguishes legitimate absence from source unavailability
✔ wdioDriver android source failures cannot satisfy positive or negative assertions
✔ wdioDriver android assertions recover before deciding presence or absence
✔ wdioDriver android distinguishes legitimate absence from source unavailability
ℹ tests 18
ℹ pass 18
ℹ fail 0

Observable change: persistent source failure now rejects positive and negative assertions with the original source error; a transient failure is retried; a negative assertion passes only after a successful snapshot proves absence. A fresh consumer installed from npm pack recovered on the second source read and then proved legitimate absence for both iOS and Android.

Reviewer view

  • Smallest source-verified view for a non-trivial PR, or Not applicable with the reason for a trivial PR: review wdioDriver.source and the six platform-parameterized assertion cases; no locator, expect, config, or CLI implementation changed.
  • Source files, symbols, states, or commands that verify the view: src/driver.ts (Driver.source, wdioDriver); test/driver.test.ts; node --import tsx --test test/driver.test.ts; npm run check; npm test; npm run build.

Risk

  • Risk is limited to callers that depended on a failed WebdriverIO source read looking like an empty hierarchy; those calls now reject, which is the safety contract.
  • Existing waitUntil recovery remains unchanged and retries transient source errors. Successful empty/absent snapshots still satisfy negative assertions.
  • GitNexus detect-changes: 2 files, 3 symbols, 3 affected flows; medium risk (Locator → WdioDriver, Launch → WdioDriver, Navigate → WdioDriver).
  • Rollback: revert commit eef00117adac9c705e9ef8084e4e62b818709159.

Notes

  • Full device coverage not run: explicitly omitted to avoid competing for device lanes; no device result is claimed.
  • Duplicate sweep found no competing assertion-safety issue or PR. fix(locator): honor native visibility #126 concerns hidden/offscreen source attributes and tap visibility, not source-command failure.
  • Independent model review was attempted but unavailable in this environment (Claude CLI unauthenticated; delegated reviewer scope denied). The focused regression, full repository gates, baseline sabotage proof, and packed-consumer proof were run locally.

PR Proof Law

  • I followed .agents/DEFINITION_OF_DONE.md and .agents/skills/pr-inline-screenshot-proof/SKILL.md.
  • Screenshots are committed and embedded inline with ![alt](...png?raw=1), or the proof section says Not applicable with the technical reason.
  • The PR body has no bare screenshot links, local paths, relative paths, or proof placeholders.

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.

driver: source failures can falsely satisfy negative assertions

1 participant