-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Description
Version
1.53.2
Steps to reproduce
To Reproduce:
- Create a new project with
npm init playwright@latest new-project - Create a test with the following properties:
- Mocks an API with
page.routeto firstfetch, thenfufillthe route with the response - Page calls that API on load or on some action
- call
page.unrouteAllwith behaavior'wait' - Example:
- Mocks an API with
import { test } from '@playwright/test';
test('route bug example', async ({ page }) => {
await page.route('https://jsonplaceholder.typicode.com/todos/1', async (route) => {
const response = await route.fetch();
await route.fulfill({ response });
})
await page.goto('https://jsonplaceholder.typicode.com/');
await page.getByRole('button', { name: 'Run Script' }).click();
await page.unrouteAll({ behavior: 'wait' });
});- Run tests
playwright test - Some browsers have an error:
Error: route.fulfill: Route is already handled!(chromium, webkit)
Expected behavior
I expect that await page.unrouteAll({ behavior: 'wait' }) would wait for the mocked route to finish before unmocking.
Actual behavior
Route appears to be unmocked while still in progress resulting in an error.
Additional context
This error only started happening in 1.53. If @playwright/test is downgraded to 1.52.0, the error does not occur.
Environment
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Memory: 8.62 GB / 31.73 GB
Binaries:
Node: 22.16.0 - C:\Program Files\nodejs\node.EXE
npm: 11.4.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
VSCode: 1.98.2 - C:\Users\rylanb\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
Bash: 5.2.37 - C:\Program Files\Git\usr\bin\bash.EXE
npmPackages:
@playwright/test: ^1.53.2 => 1.53.2Metadata
Metadata
Assignees
Labels
No labels