This step waits up to a specified number of seconds for the page to settle, then returns as soon as the page is idle. Settlement means the DOM is ready, no fetch or XHR requests are in flight, no setTimeout callbacks are pending, and no MutationObserver activity has occurred for at least 250 ms. If the page becomes idle before the budget is exhausted, the step returns immediately rather than waiting the full duration.
The number is a positive integer representing seconds. Both singular (second) and plural (seconds) forms are accepted. Use this step after triggering an action that causes the page to load content or re-render, where you need to give the application a bounded window to complete its work before asserting results.
Accepted phrasings
When I wait for 1 second
When I wait for 5 seconds
And I wait for 3 seconds
When we wait for 2 seconds
And we wait for 10 seconds
Examples
When I wait for 1 second
When I wait for 5 seconds
And I wait for 3 seconds
When we wait for 10 seconds
In a real scenario
Scenario: Visitor logs in with valid credentials
Given I am on "/user/login"
And I wait for 6 seconds
When I fill in "testuser" for "Username or email address"
And I fill in "S3cur3Pass!" for "Password"
And I press "Log in"
And I wait for 2 seconds
Then I should see "testuser"