Перейти до вмісту

noPlaywrightWaitForTimeout

Цей контент ще не доступний вашою мовою.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noPlaywrightWaitForTimeout": "error"
}
}
}
}

Disallow using page.waitForTimeout().

Playwright provides methods like page.waitForLoadState(), page.waitForURL(), and page.waitForFunction() which are better alternatives to using hardcoded timeouts. These methods wait for specific conditions and are more reliable than arbitrary timeouts.

await page.waitForTimeout(5000);
code-block.js:1:7 lint/nursery/noPlaywrightWaitForTimeout ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of page.waitForTimeout().

> 1 │ await page.waitForTimeout(5000);
^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

Hardcoded timeouts are flaky and make tests slower. Use conditions that wait for specific events.

Prefer using built-in wait methods like page.waitForLoadState(), page.waitForURL(), or page.waitForFunction() instead.

Consider using web-first assertions like expect(locator).toBeVisible() which auto-wait for conditions.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

await page.waitForTimeout(1000);
code-block.js:1:7 lint/nursery/noPlaywrightWaitForTimeout ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of page.waitForTimeout().

> 1 │ await page.waitForTimeout(1000);
^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

Hardcoded timeouts are flaky and make tests slower. Use conditions that wait for specific events.

Prefer using built-in wait methods like page.waitForLoadState(), page.waitForURL(), or page.waitForFunction() instead.

Consider using web-first assertions like expect(locator).toBeVisible() which auto-wait for conditions.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

await page.waitForLoadState();
await page.waitForURL('/home');
await page.waitForFunction(() => window.innerWidth < 100);