Issue 1:
This works on 1.25 for webkit but fails for versions after it.

I have already asked about this before, but answer was vague and no further response was given.

What I am asking here is a bit of clarification, and to know if this can be fixed or not, so my team can move forward (either exclude tests on webkit or try some other package like puppeteer or cypress) since we are already 3 versions behind on playwright.

I have created this page.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="/main.js" ></script>
</head>
<body>
<img src="https://via.placeholder.com/150" alt="" />
</body>
</html>

I served it using vscode live server

and I have this test

test.only("google interceptor", async ({ page }) => {
await page.route(/google/, () => {
throw new Error("should never come here!");
});
await page.goto("http://127.0.0.1:5500/index.html");
console.log(await page.evaluate(() => {
return performance.getEntriesByType("resource");
}));
});

which I run using @playwright/test package.

Basically what happens is that it yields duplicate entries for image in performance.getEntries().

case 1: no route handler for /google/ and main.js on page -> no duplicate entries in resource timings for image

case 2: route handler for /google/ registered, no main.js in html -> no duplicate entries in resource timings

case 3: no route handler for /google/ registered, no main.js in html -> no duplicate entries in resource timings

case 4: route handler for /google./ registered, main.js in html -> duplicate entries in resource timings for image

there is not a single resource on the page that loads something from google, and main.js is completely empty (or it doesn't even exist, doesn't matter) so there is nothing that would trigger duplicate load.

From the test case above there is not even anything intercepted, because only route handler registered for google throws an error so it never comes to that line at all.

I have tests where I need to have the route handlers, and I have scripts on the page, I can't change that, and those work well on firefox and chrome and worked well on previous playwright versions(1.25 ) webkit.

I got a response that it is a preload request, I tried adding preload="none" to image tags and it still doesn't help.

I am just trying to understand how to fix this, because it is breaking lots of our tests now.

Basically what I don't understand here is what is the right behavior?

Is webkit wrong to not report duplicate entries in case there is no route handler registered?

Or is playwright wrong to exhibit such behavior of webkit when there is route handler registered and an empty script on the page?

It looks inconsistent

Does anyone have an idea on how to avoid these duplicate resource entries?

Can we update playwright but somehow still run older webkit which does not show this behavior?

Issue 2:
System info

Playwright Version: [v1.34]

Operating System: [Windows 10]

Browser: [All]

Source code

Link to the GitHub repository with the repro

Repro: https://github.com/alexandersorokin/playwright-bug-jsx

Or you can use default Playwright config with:

"type": "module" in package.json.

Importing React component from jsx-file.

Using the component name in test.

Steps

npm ci

npm run test

Expected

Test pass

Actual

c:\playwright-bug-jsx>npm run test > playwright-bug-jsx@1.0.0 test
> playwright test --config ./playwright.config.ts

SyntaxError: Named export 'Fragment' not found. The requested module '@playwright/test/jsx-runtime' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using: import pkg from '@playwright/test/jsx-runtime';
const { Fragment: _Fragment } = pkg;
Error: No tests found

I suspect this changes to cause this behavior.

Analysis:

The test passes in Playwright@1.33.0. So breaking changes was introduced in Playwright@1.34.0.

The test passes if "type" to "commonjs" is set in package.json. So only ES modules are affected.