When I wait max of {number} seconds

This step waits up to a maximum number of seconds for the page to settle, returning as soon as the page becomes idle. It behaves identically to the compact wait N seconds step but uses the phrase "max of" to make the intent explicit: the number is a ceiling, not a fixed pause. The page will be allowed to return sooner if it settles before the budget is exhausted.

The "max of" phrasing is useful in scenarios where you want to communicate to the reader that the test is not sleeping for a fixed duration - it is polling until the application is ready, up to the stated limit. This is especially clear in code reviews or feature file audits. The number may be followed by second, seconds, or s. Both I and we pronouns are accepted, and the pronoun may be omitted when chaining with And.

Accepted phrasings

When I wait max of 1 second
When I wait max of 5 seconds
When we wait max of 3s
And wait max of 2s
And wait max of 2 seconds
When we wait max of 1 second
When we wait max of 5 seconds
When we wait max of 4s

Examples

When I wait max of 1 second
When I wait max of 5 seconds
When we wait max of 3s
And wait max of 2s

In a real scenario

Scenario: User submits a search and sees results
  Given I am on "/search"
    And I wait max of 6 seconds
  When I fill in "annual report" for "Search"
    And I press "Search"
    And I wait max of 5 seconds
  Then I should see "annual report"
    And I should see "Results"

Related steps

Back to Wait Steps