Skip to content

noPlaywrightNetworkidle (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"suspicious": {
"noPlaywrightNetworkidle": "error"
}
}
}
}

Disallow usage of the networkidle option.

Using networkidle is discouraged in favor of using web-first assertions. The networkidle event is unreliable and can lead to flaky tests.

await page.waitForLoadState('networkidle');
code-block.js:1:7 lint/suspicious/noPlaywrightNetworkidle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ Unexpected use of networkidle option.

> 1 │ await page.waitForLoadState('networkidle');
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ The networkidle event is unreliable and can lead to flaky tests.

ℹ Use web-first assertions or wait for specific elements instead.

await page.goto('https://example.com', { waitUntil: 'networkidle' });
code-block.js:1:7 lint/suspicious/noPlaywrightNetworkidle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ Unexpected use of networkidle option.

> 1 │ await page.goto('https://example.com', { waitUntil: 'networkidle' });
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ The networkidle event is unreliable and can lead to flaky tests.

ℹ Use web-first assertions or wait for specific elements instead.

await page.waitForLoadState('load');
await page.goto('https://example.com');
await page.locator('.content').waitFor();