Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] page.route doesn't work with chromium when fetch happens from within a sub worker #27376

Closed
azaleas opened this issue Sep 30, 2023 · 2 comments

Comments

@azaleas
Copy link

azaleas commented Sep 30, 2023

System info

  • Playwright Version: 1.38.1
  • Operating System: macOS 13.5
  • Browser: Chromium

Source code

Link to the GitHub repository with the repro

https://github.com/azaleas/playwright-route-bug

Steps

  • run tests with chromium (pnpm run test --project=chromium or npm run test --project=chromium)

Expected

For tests to pass. I have a worker that creates another worker (subworker). The subworker makes a GET request to an API. The request is mocked via page.route to feed a different output. The tests are passing fine in webkit and firefox.

Actual

Tests are hanging on fetch step due to page.route until timeout is reached or tests are force closed/stopped.

@azaleas azaleas changed the title page.route doesn't work with chromium when fetch happens from within a sub worker [BUG] page.route doesn't work with chromium when fetch happens from within a sub worker Oct 2, 2023
@pavelfeldman
Copy link
Member

I can repro, there is no Network.requestWillBeSent for the nested worker fetch. There is also no networkId in the Fetch.requestPaused.

pw:protocol  RECV 
{
  "method": "Fetch.requestPaused",
  "params": {
    "requestId": "interception-job-9.0",
    "request": {
      "url": "https://jsonplaceholder.typicode.com/todos/1",
      "method": "GET",
      "headers": {
        "Accept": "*/*",
        "Referer": "http://localhost:5173/",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.62 Safari/537.36"
      },
      "initialPriority": "High",
      "referrerPolicy": "strict-origin-when-cross-origin"
    },
    "frameId": "A428F986F21038EBA77F2B5491D08AB8",
    "resourceType": "XHR"
  },
  "sessionId": "6062893F64A56FF0FA7083FA4815339D"
}

pw:protocol SEND 
{
  "id": 38,
  "method": "Fetch.failRequest",
  "params": {
    "requestId": "interception-job-9.0",
    "errorReason": "Aborted"
  },
  "sessionId": "6062893F64A56FF0FA7083FA4815339D"
} +0ms

Running as

DEBUG=pw:protocol* npm run test -- --project chromium

@pavelfeldman
Copy link
Member

This should now work. There still is a remaining issue with execution within the nested worker in WebKit, but we will wait for an explicit report on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants