expect
- Type:
ExpectConfig - Default:
{ poll: { interval: 50, timeout: 1000 } }(timeout: 5000in Browser Mode)
Configure the defaults used by expect.poll() and the default timeout for Browser Mode expect.element(). Browser Mode uses a 5000ms default poll timeout, while Node Mode uses 1000ms. An implicit default is limited by the remaining current test phase; options passed directly to expect.poll() take precedence and are not capped by this calculation. expect.poll() remains test-only: it can use the active timeout of per-test hooks and fixtures, but it is not available in beforeAll or afterAll.
expect.poll
Global configuration for polling assertions.
expect.poll.interval
- Type:
number - Default:
50
The interval between expect.poll() retry attempts, in milliseconds. This option does not control the retry interval of Browser Mode expect.element() assertions; the browser provider controls those retries. @rstest/playwright locator/page assertions also retain their fixed 50ms retry interval.
expect.poll.timeout
- Type:
number - Default:
1000(5000in Browser Mode)
The maximum total polling time before the assertion fails, in milliseconds. When omitted at the call site, the configured value is also capped by the remaining current test phase.
This timeout applies to these APIs:
An explicit per-call timeout takes precedence over this configuration. For expect.poll() and Browser Mode expect.element(), without one, Rstest uses the smaller of the configured timeout and the remaining active test or hook time, when that context is available. For example, a configured 5000ms timeout with only 2000ms remaining does not grant the assertion another five seconds. An explicit timeout bypasses this calculation, but it does not extend the outer testTimeout or hook timeout.
In Browser Mode concurrent tests, use the test-scoped expect fixture to account for that test's remaining time. Shared file-level expect and hooks in describe.concurrent use the configured polling timeout instead. See Browser Mode assertion timeouts.
When using definePlaywrightConfig, the helper defaults expect.poll.timeout to 5000ms. An explicit expect.poll.timeout overrides that value for both polling and Playwright locator/page assertions. Without the helper, Node Mode defaults to 1000ms.