Issue 1:
I am working on a script against an app which performs backend queries via graphql. Request path is the same, only body in POST requests are different. When I manually visit one section of the site which displays various data I can clearly see multiple graphql queries with different content. However when I run it in a playwright script only first one issued and responded, rest of them do not fire up. This issue happens in puppeteer as well, but not selenium which handles it correctly.

For example when I visit page manually 3 requests are issued (also via selenium):

graphql1

graphql2

graphql3

In case of Playwright and Puppeteer only first one is issued, graphql2 and graphql3 are not visible in devtools (it's also noticeable on page which lacks data)

Question is - is there a special way to handle such scenarios in Playwright? Is there some magic in the background that blocks requests considered duplicates and can be turned off?

Issue 2:
System info

Playwright Version: [v1.32]

Operating System: [macOS 13.2.1]

Browser: [Chromium]

node: v18.12.1

Source code

I provided exact source code that allows reproducing the issue locally.

Link to the GitHub repository with the repro

https://github.com/skvale/playwright-repro

or

Config file

// playwright.config.ts
/** @type {import('@playwright/test').Config} */
const config = {
updateSnapshots: 'missing',
timeout: 20000,
webServer: {
command: 'pnpm build && pnpm serve',
url: 'http://localhost:3003/',
reuseExistingServer: false,
timeout: 20000,
},
workers: 8,
retries: process.env.CI ? 5 : 0,
projects: [
{
name: 'test',
use: {
javaScriptEnabled: true,
},
},
],
use: {
baseURL: 'http://localhost:3003/',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
launchOptions: {
ignoreDefaultArgs: ['--hide-scrollbars'],
},
},
};
export default config;

Test file (self-contained)

import {expect, test} from '@playwright/test';

test.describe.parallel('Site', () => {
test('shows home content', async ({page}) => {
await page.goto('/');
await expect(page.getByText('@2023 All rights reserved')).toBeVisible();
});
});

Steps

pnpm install

pnpm test

Expected

playwright test test.playwright.test.ts --ui loads Playwright in UI mode

Actual

> playwright test test.playwright.test.ts "--ui"

/Users/me/project/node_modules/.pnpm/@playwright+test@1.32.0/node_modules/@playwright/test/lib/runner/uiMode.js:159
this._page.mainFrame().evaluateExpression(dispatchFuncSource, true, message).catch(e => this._originalStderr(String(e)));
^

TypeError: Cannot read properties of undefined (reading 'mainFrame')
at UIMode._dispatchEvent (/Users/me/project/node_modules/.pnpm/@playwright+test@1.32.0/node_modules/@playwright/test/lib/runner/uiMode.js:159:16)
at Timeout._onTimeout (/Users/me/project/node_modules/.pnpm/@playwright+test@1.32.0/node_modules/@playwright/test/lib/runner/uiMode.js:69:14)
at listOnTimeout (node:internal/timers:564:17)
at processTimers (node:internal/timers:507:7)

Additional info:

Link to the line that was failing

playwright/packages/playwright-test/src/runner/uiMode.ts

Line 152
in
d10fac4

this._page.mainFrame().evaluateExpression(dispatchFuncSource, true, message).catch(e => this._originalStderr(String(e)));

Wrapping it in an if (this._page) seems to work

Message looks like this { message: { method: 'listChanged' } }, perhaps the output from the build command is triggering events before the page is initialized