Wait coordinates test execution with an asynchronous application. Instead of checking immediately after an action, it pauses until a condition becomes true or a timeout expires. This prevents tests from failing simply because a notification, search result, API response, or backend update has not appeared yet. section 10.2.15 section 12.5.3
Choose a condition that represents the state the test actually needs:
- Wait for an element to become visible, present, enabled, or clickable. section 10.2.15 section 12.5.3
- Wait for an element or spinner to disappear before inspecting the resulting page. section 11.3.6 section 12.5.3
- Wait for specified text, a page title, a collection size, or an arbitrary function to complete. section 10.2.15 section 12.5.3
- Set a maximum timeout and, for fluent waits, control polling frequency and ignored exceptions. section 10.2.15 section 11.3.6
Waiting for flight-search results
A search displays a spinner while results load. A Page Object can click Search and wait for the spinner to become invisible, leaving the step definition focused on the business action rather than browser timing details. In Screenplay, the equivalent is to wait until the flight container is visible or the spinner is not visible. section 11.3.6 section 12.5.3
tracy.attemptsTo(
Wait.until(() -> fileIsProcessed()). #1
.forNoMoreThan(Duration.of(3, SECONDS)) #2
);
Shows a Serenity BDD Wait interaction that waits for an arbitrary function, such as file processing, for no more than a specified duration. section 12.5.3

