Issue 1:
System info

Playwright Version: [v1.31.2]

Operating System: [Ubuntu 22, NixOS 22.11]

Browser: [All, Chromium, Firefox, WebKit]

Source code

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

or

Config file

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './tests',
timeout: 30 * 1000,
expect:
timeout: 5000
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
actionTimeout: 0,
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
});

Test file (self-contained)

basic test example provided by playwright (fresh project with fresh installation).

Steps

create a fresh new project.

{
"package.json":"👇",
"name": "pwtest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.31.2"
}
}

pnpm exec playwright codegen --browser ff

Expected

expecting the firefox browser to open.

Actual

[Describe actual behavior]

it opens chromium.

Issue 2:
System info

Playwright Version: v1.32.0

Confirmed the issue does not exist in v1.31.2

Confirmed the issue exists in v1.32.0 thru v1.32.3

Operating System: Windows 10, 22H2

Browser: Tested with Chromium and Firefox

Other info:

Node: v18.15.0

PowerShell: v7.3.3

Terminal: 1.16.10261.0

Source code

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

Config file

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
use: {
trace: 'on-first-retry',
},
});

Test file (self-contained)

// memory-leak-example.spec.ts
import { test, expect, Locator, TestInfo } from '@playwright/test';
test.afterAll(async ({ page }) => await page.pause());

test('Example test showing a probable memory leak after updating from Playwright v1.31.2 to v1.32.0', async ({ page }, testInfo: TestInfo) => {
const isPwDebug = !!process.env.PWDEBUG;
const pwVersion = testInfo.config.version;
const timerTotalTime = `\nTotal test time for PW v${pwVersion} (debug: ${isPwDebug})`;
console.log(`Playwright v${pwVersion}\ndebug: ${isPwDebug}\n`);
console.log('round #, link #, rssMB, heapTotalMB, heapUsedMB, externalKB, arrayBuffersKB');
const bytesToKB = (bytes: number): string => (bytes / 1024).toFixed(3);
const bytesToMB = (bytes: number): string => (bytes / 1024 / 1024).toFixed(3);

console.time(timerTotalTime);
const url = 'https://playwright.dev/docs/intro';
await page.goto(url, { waitUntil: 'networkidle' });

const links: Locator = page.getByRole('navigation', { name: 'Docs sidebar' })
.locator('li[class^="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2"]');
const linksCount = await links.count(); // 55 links

const maxRounds = 2;
for (let i = 1; (i <= maxRounds); i++) {
const maxLinksToClick = 99;
for (let j = 0; (j < linksCount && j <= maxLinksToClick); j++) {
const link = links.nth(j);
await link.click();
const linkText = await link.textContent() as string;
const heading: Locator = page.getByRole('heading', { name: linkText, exact: true });
await expect(heading).toHaveText(linkText);

const rssMB = bytesToMB(process.memoryUsage().rss);
const heapTotalMB = bytesToMB(process.memoryUsage().heapTotal);
const heapUsedMB = bytesToMB(process.memoryUsage().heapUsed);
const externalKB = bytesToKB(process.memoryUsage().external);
const arrayBuffersKB = bytesToKB(process.memoryUsage().arrayBuffers);
console.log(`${i}, ${j}, ${rssMB}, ${heapTotalMB}, ${heapUsedMB}, ${externalKB}, ${arrayBuffersKB}`);
}
}
console.timeEnd(timerTotalTime);
});

Steps

Run the sample test in PW v1.32.3 in debug mode using the following command:

npx playwright test memory-leak-example --debug

Expected

The sample test should take < 25 seconds to complete, as it does in PW v1.31.2

Actual

The sample test takes > 3m 30s to complete

In my private repo e2e tests, the test goes about 1/3 of the way, then the browser hangs and the test fails

I am unable to use PW v1.32.0+ for my e2e tests due to performance and/or hung browser while in debug mode