src/content/docs/linter/rules/no-playwright-wait-for-navigation.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.4.2` - Diagnostic Category: [`lint/nursery/noPlaywrightWaitForNavigation`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - This rule belongs to the following domains: - [`playwright`](/linter/domains#playwright) - Sources: - Same as [`playwright/no-wait-for-navigation`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-wait-for-navigation.md){
"linter": {
"rules": {
"nursery": {
"noPlaywrightWaitForNavigation": "error"
}
}
}
}
Disallow using page.waitForNavigation().
Playwright's page.waitForNavigation() is deprecated and should be replaced with more reliable
alternatives like page.waitForURL() or page.waitForLoadState().
await page.waitForNavigation();
await page.click('button');
await page.waitForNavigation({ waitUntil: 'networkidle' });
await page.waitForURL('/home');
await page.waitForLoadState('networkidle');
await page.goto('/home');