externalWait
Index
Constructors
Properties
Methods
Constructors
externalconstructor
Returns Wait
Properties
staticexternalreadonlyminimumTimeout
Minimum timeout that can be used with Wait.until,
defaults to 250 milliseconds,
staticexternalreadonlydefaultPollingInterval
The amount of time Wait.until should wait between condition checks,
defaults to 500ms.
Use WaitUntil.pollingEvery to override it for a given interaction.
staticexternalreadonlyminimumPollingInterval
Minimum polling interval of 50ms between condition checks, used with Wait.until.
Methods
staticexternalfor
Instantiates a version of this
Interactionconfigured to wait for a set duration.Parameters
externalduration: Answerable<Duration>
A set duration the
Actorshould wait for before proceeding.
Returns Interaction
staticexternalupTo
Instantiates a version of this
Interactionconfigured to wait until the answer to the questionactualmeets theexpectation, or thetimeoutexpires.Parameters
externaltimeout: Duration
Custom timeout to override
SerenityConfig.interactionTimeout
Returns { until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>) => WaitUntil<Actual> }
externaluntil: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>) => WaitUntil<Actual>
Type parameters
- Actual
Parameters
externalactual: Answerable<Actual>
externalexpectation: Expectation<Actual>
Returns WaitUntil<Actual>
staticexternaluntil
Instantiates a version of this
Interactionconfigured to poll everyWait.defaultPollingIntervalfor the result of the provided question (actual) until it meets theexpectation, or the timeout expires.Type parameters
- Actual
Parameters
externalactual: Answerable<Actual>
An
Answerablethat theActorwill keep answering until the answer meets theExpectationprovided, or the timeout expires.externalexpectation: Expectation<Actual>
An
Expectationto be met before proceeding
Returns WaitUntil<Actual>
Waitis a synchronisation statement that instructs the actor to wait before proceeding with their next activity, either for a set duration, or until a given expectation is met.You can configure the timeout of the interaction to
Wait.until:SerenityConfig.interactionTimeoutWait.upToSerenity/JS implements
Waitfrom scratch, so that the behaviour is consistent no matter the integration tool you use (Playwright, WebdriverIO, Selenium, etc.) or the type of testing you do (Web, REST API, component testing, etc.)Wait with Web-based tests
Example widget
Lean Page Object describing the widget
Waiting for a set duration
Please note that while the above implementation works, this approach is inefficient because at best the actor might wait too long and at worst the test might become "flaky" if any external interference (like network glitches, animations taking a bit too long etc.) makes the actor wait not long enough.
Waiting until a condition is met
Wait.untilmakes theActorkeep asking theQuestion, in this caseText.of(App.status), until the answer meets the expectation, or a timeout expires (default: 5s).Please note that both Ensure and Wait can be used with the same expectations, like
equalsorincludes.Changing the default timeout
Learn more
SerenityConfig.interactionTimeoutDurationExpectation