Skip to content

fix(expect): honour the locator's own wait options#92

Merged
BenSheridanEdwards merged 1 commit into
mainfrom
fix/expect-honors-locator-waitoptions
Jul 3, 2026
Merged

fix(expect): honour the locator's own wait options#92
BenSheridanEdwards merged 1 commit into
mainfrom
fix/expect-honors-locator-waitoptions

Conversation

@BenSheridanEdwards

Copy link
Copy Markdown
Owner

Summary

  • A locator built with its own wait options — locator(driver, sel, { timeout: 60_000 }) — had them honoured by tap() / waitFor() / check() / setChecked() (which all merge this.options) but silently dropped by every expect(locator) matcher, which assembled its wait from the call-site options only and fell back to the 10s default. So the same locator waited 60s for an interaction but 10s for an assertion — a confusing, undocumented inconsistency. Locator.options was private, so expect could not reach it.
  • Fix: Locator exposes a public waitOptions getter, and expect's check() now merges { ...locator.waitOptions, ...callSiteOptions, sleep } — the call-site option still wins, exactly as interactions already resolve theirs.

Proof

  • npm run check
    • Passed on fix/expect-honors-locator-waitoptions: Checked 48 files in 22ms. No fixes applied.
  • npm test
    • Passed: 185/185 (new deterministic test: the locator's interval flows to driver.pause(), so the matcher's poll intervals equal the locator's 7ms — the old code used the 250ms default — and a call-site interval still overrides it).
  • Generated project/device proof, or N/A:
    • Not applicable. Pure options-plumbing fix in the assertion layer, covered by a fake-driver test that asserts which timeout/interval the matcher actually polls with. No device or generated-project surface.
    • Screenshots: Not applicable; no rendered UI — the observable behaviour is the poll cadence, asserted in the test.

Risk

  • Low. Only affects locators constructed with explicit wait options; for the default {} the merge is a no-op and behaviour is identical. Call-site options keep precedence.

Notes

  • Full device coverage not run: assertion-timing fix, fully deterministic in-memory.
  • Clears one of the adversarial-review sharp edges filed against NativeProof.

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.

A locator built with a custom timeout — locator(driver, sel, { timeout:
60_000 }) — had it respected by tap()/waitFor()/check() (which merge
this.options) but silently dropped by every expect(...) matcher, which
built its wait from the call-site options only and fell back to the 10s
default. Locator.options was private, so expect could not reach it.

Locator now exposes a public waitOptions getter, and expect's check()
merges { ...locator.waitOptions, ...callSiteOptions } — call-site still
wins, matching how interactions already resolve their options.
@BenSheridanEdwards BenSheridanEdwards merged commit e95de95 into main Jul 3, 2026
1 check passed
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