Wait
wait pauses the test until a condition is true. Prefer waiting on a condition over waiting for a fixed duration; fixed waits are the single biggest cause of flaky tests.
Wait for an element
yaml
- wait:
element: the dashboard heading
state: visible
timeout: 10sWait for a fixed duration (discouraged)
yaml
- wait:
duration: 2sAvoid fixed durations
If you find yourself reaching for a fixed wait, there is almost always an element or URL change you could wait on instead. Use the condition, not the clock.
States
yaml
state: visible # appears in the layout
state: hidden # removed or display:none
state: attached # in the DOM
state: detached # removed from the DOM
state: enabled # not disabled
state: stable # stopped animating