-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Version
1.57.0
Steps to reproduce
- Clone my repo at https://github.com/dsine-de/playwright-page-route-multiple-fetch
- npm i
- npm run server (this keeps an simple express server in the background, listening on http://localhost:8000/ simply serving the contents in the
public/directory and serving a get route/testwhich sends a status code204) - npm run test (while the server is running)
- The first test stalls after 3 seconds / 3 successful requests.
The seconds test succeeds after 10 successful requests.
Expected behavior
When the server task is running and you open http://localhost:8000/ in the browser (e.g. Chrome), the client JavaScript will start to make 10 successive requests, one every second (through setTimeout()). The response status codes (204) are added to the page.
When you click somewhere on the page while these requests are running (to make the browser handle the beforeunload event) and then try to reload or close the tab, the dialog preventing it is shown. If you now dismiss this dialog, the pending requests will be resumed until 10 of them have been executed.
So browsers seem to halt the execution of the pending requests, but resume it after the dialog is dismissed.
Actual behavior
In the Playwright test, as soon as the beforeunload dialog is shown and there is a page.route() handler active, all requests repeated by timers or recursive functions will stall. They show as pending in the Dev Tools network tab.
When there is no page.route() set up, the requests are resumed after the dialog is dismissed correctly.
Additional context
No response
Environment
System:
OS: Windows 11 10.0.26200
CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700KF
Memory: 19.10 GB / 31.87 GB
Binaries:
Node: 25.2.1 - C:\Program Files\nodejs\node.EXE
npm: 11.6.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
VSCode: 1.108.0 - C:\Users\denni\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
Bash: 5.2.21 - C:\Windows\system32\bash.EXE
npmPackages:
@playwright/test: ^1.57.0 => 1.57.0