TEST010warningPro

instant-visibility-before-assert

safeVisible() or isVisible() result used in expect() — instant checks don't wait for elements to render, causing flaky tests.

Applies to: JavaScript, TypeScript

Why this matters

safeVisible() and isVisible() do an instant check — if the page hasn't rendered yet, they return false and the test fails. This is the #1 cause of flaky e2e tests. Use waitFor() or expect(locator).toBeVisible() instead, which automatically retry until the element appears or the timeout expires.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, TEST010 includedstablestack explain TEST010

TEST010 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: TEST010