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
Interaction
configured to wait for a set duration.Parameters
externalduration: Answerable<Duration>
A set duration the
Actor
should wait for before proceeding.
Returns Interaction
staticexternalupTo
Instantiates a version of this
Interaction
configured to wait until the answer to the questionactual
meets theexpectation
, or thetimeout
expires.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
Interaction
configured to poll everyWait.defaultPollingInterval
for the result of the provided question (actual
) until it meets theexpectation
, or the timeout expires.Type parameters
- Actual
Parameters
externalactual: Answerable<Actual>
An
Answerable
that theActor
will keep answering until the answer meets theExpectation
provided, or the timeout expires.externalexpectation: Expectation<Actual>
An
Expectation
to be met before proceeding
Returns WaitUntil<Actual>
Wait
is 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.interactionTimeout
Wait.upTo
Serenity/JS implements
Wait
from 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.until
makes theActor
keep 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
equals
orincludes
.Changing the default timeout
Learn more
SerenityConfig.interactionTimeout
Duration
Expectation