Skip to content

feat(wait): add attributeToBe, urlMatches, textMatches wait conditions - #21

Merged
shossain786 merged 1 commit into
masterfrom
feat/wait-engine-conditions
Jul 14, 2026
Merged

shossain786 merged 1 commit into
masterfrom
feat/wait-engine-conditions

Conversation

@shossain786

Copy link
Copy Markdown
Contributor

Closes #12

What

Adds three commonly-requested explicit-wait conditions behind the existing static WaitEngine API, consistent with the current waitFor* naming:

New method Wraps
waitForAttribute(By, attr, value) ExpectedConditions.attributeToBe (exact match)
waitForUrlMatches(String regex) ExpectedConditions.urlMatches
waitForTextMatches(By, String regex) ExpectedConditions.textMatches

Scope note

The issue also listed attributeContains, but that already exists as waitForAttributeContains — as does waitForUrlContains. So the candidate list is fully covered; those two are left unchanged and cross-referenced in the docs (substring vs exact / regex).

Safety

  • No breaking changes to the @SeleniumBootApi surface — this is purely additive (new public static methods on an existing API class).
  • New WaitEngineTest covers all three via a mocked WebDriver whose state satisfies each condition on the first poll — no real browser required.

Verification

  • mvn -Dtest=WaitEngineTest test → 3 passing
  • mvn test (full suite) → 473 passing, 0 failures (confirms the mockStatic setup doesn't leak into other tests)
  • npm run build (docs) → passes; guides/wait-engine.md updated with the new conditions

Follow-up (not in this PR)

While documenting, I noticed the wait-engine guide uses a getWait().waitForX() call style, but getWait() actually returns a raw Selenium WebDriverWait (the waitForX methods are static on WaitEngine). That's a pre-existing doc inconsistency across the guide — worth a separate cleanup pass rather than widening this PR.

🤖 Generated with Claude Code

Closes #12

Adds three commonly-requested explicit-wait conditions behind the existing
static WaitEngine API, consistent with the current waitFor* naming:

- waitForAttribute(By, attr, value)   -> ExpectedConditions.attributeToBe (exact)
- waitForUrlMatches(String regex)     -> ExpectedConditions.urlMatches
- waitForTextMatches(By, String regex)-> ExpectedConditions.textMatches

The other issue candidate, attributeContains, already exists
(waitForAttributeContains), as does waitForUrlContains — so those are
covered and left as-is.

Purely additive to the @SeleniumBootApi surface — no breaking changes.
New WaitEngineTest covers all three via a mocked WebDriver (no real
browser). Docs updated in guides/wait-engine.md. Full suite: 473 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shossain786
shossain786 merged commit 80d54c4 into master Jul 14, 2026
2 checks passed
@shossain786
shossain786 deleted the feat/wait-engine-conditions branch July 16, 2026 02:02
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.

Feature: add commonly-requested WaitEngine conditions

1 participant