-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Version
1.50.0
Steps to reproduce
After bumping playwright to 1.50.0, I noticed certain tests failing on Firefox. Digging into stuff, it seems that fetch requests being made with keepalive: true
are no longer handled by e.g. page.on('route')
.
Example:
fetch('https://test-sentry-url.com/', {
"method": "POST",
keepalive: true,
});
And my test:
page.route('https://test-sentry-url.com/', route => {
console.log('Handler met');
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ id: 'test-id' }),
});
});
Since 1.50.0, the route handler is never triggered (and because of this tests fail). If I remove keepalive: true
, it works.
After some debugging, it seems that Firefox actually implemented support for this flag in v133, which has just been bumped to in playwright 1.50.0 (134, specifically). And looking at a regular app in firefox, I can see there that such keepalive requests do not show up in the network tab 🤔 They do seem to be sent though.
Expected behavior
page.route()
should continue to handle all requests, even if they have keepalive: true
Actual behavior
page.route()
does not match keepalive: true
requests.
Additional context
Noticed this here: getsentry/sentry-javascript#15164
Environment
System:
OS: macOS 14.4.1
Memory: 1.29 GB / 32.00 GB
Binaries:
Node: 18.20.5 - ~/.volta/tools/image/node/18.20.5/bin/node
Yarn: 1.22.22 - ~/.volta/tools/image/yarn/1.22.22/bin/yarn
npm: 10.8.2 - ~/.volta/tools/image/node/18.20.5/bin/npm
Languages:
Bash: 5.2.26 - /opt/homebrew/bin/bash