Skip to content

waitForVisualStability

waitForVisualStability(page, timeoutMs?): Promise<void>

Defined in: fixture.ts:195

Wait for the page to be visually stable enough to screenshot.

Playwright already handles the heavy lifting — actionability waits gate every click/fill, web-first assertions auto-retry, and CSS animations/transitions are disabled globally by the injected overlay stylesheet. The only things left that can still cause a “wobbly” screenshot are:

  1. Web fonts not yet loaded (text reflows mid-shot).
  2. The browser not having flushed the latest layout to a frame.

So: wait (briefly) for document.fonts.ready, then two rAFs to ensure the compositor has painted. Everything else (networkidle, MutationObserver idle loops, image-load polling) was redundant and slow.

Page

number = 500

Promise<void>