Issue 1:
System info

Playwright Version: [v1.33]

Operating System: [Windows 10, Ubuntu 18, Gentoo]

Browser: [Electron]

Other info:

Source code

Config file

// playwright.config.ts
import type {PlaywrightTestConfig} from "@playwright/test";
import {devices} from "@playwright/test";

const config: PlaywrightTestConfig = {
testDir: "./tests",
timeout: 2147483647,
expect: {
timeout: 1000 * 60,
},
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: "dot",
use: {
headless: false,
actionTimeout: 5000,
viewport: {width: 1920, height: 1080},
trace: "off",
video: {
mode: "on",
size: {width: 1920, height: 1080},
},
},
projects: [
{
name: "Electron",
use: {
...devices["Electron"],
},
},
],
};

Test file (self-contained)

test.describe(() => {

test.beforeAll(async () => {
fs.mkdirSync(testSettings.pathLog, {recursive: true});
fs.mkdirSync(testSettings.pathLog + `/error${getDate()}`, {recursive: true});
await BaseTest.startLog()
electronApp = await electron.launch({
args: testSettings.electronApp,
});

const window = await electronApp.firstWindow();

userIndex = 0;

const pids = await BaseTest.getPidScada(electronApp)

setInterval(async function () {
await BaseTest.writeLog(pids);
}, testSettings.intervalLog);
})

for (let step = 0; step < testSettings.passes; step++) {
test(`Step ${step}`, async () => {
const window = await electronApp.windows()[0];

if (step === 0 || testSettings.changeUser) {
await AuthenticationPageObject.AuthenticationInList(
window,
data.main.login[userIndex],
data.main.password
);
}

try {
await window.waitForSelector(data.frameXPath.left);
} catch (error) {
fs.appendFileSync(
`${testSettings.pathLog}error${getDate()}.log`,
`${getFullDate()} \n
${error}\n`
);
}

await TestFunction.TestAD(window, 239, 93);

await TestFunction.TestEvent(window);

await TestFunction.TestTREND(window);

await TestFunction.TestArchive(
electronApp,
OutputOption.outputHorizontalTable,
window
);

await TestFunction.TestDD(window, 230, 115);

await TestFunction.TestEvent(window);

await TestFunction.TestTREND(window);

await TestFunction.TestArchive(
electronApp,
OutputOption.outputVerticalTable,
window
);

await TestFunction.TestZDV(window, 230, 110);

await TestFunction.TestEvent(window);

await TestFunction.TestTREND(window);

await TestFunction.TestArchive(
electronApp,
OutputOption.outputTrends,
window
);

await TestFunction.TestREGI(window, 233, 111);

await TestFunction.TestEvent(window);

await TestFunction.TestTREND(window);

await TestFunction.TestALARM(window, 239, 93);

await TestFunction.TestEvent(window);

await TestFunction.TestTREND(window);

if (testSettings.changeUser) {
userIndex == 19 ? (userIndex = 0) : userIndex++;

await window.mouse.click(1557, 40);
}
});
}
});
});

Description of the problem

I'm testing an Electron application by simulating user interactions and observing how the tested application behaves. These tests can run continuously for weeks or even a month. However, I've encountered an issue where the process.js from the Playwright library starts consuming more and more memory. If it initially consumes 100MB at the start of testing, after a day or two, it can reach 2GB. Could this be a memory leak on your side, or am I doing something incorrectly?

A file with logs of RAM consumption

system.log

Memory consumption graph of one of the test runs

Issue 2:
System info

Playwright Version: [v1.32.1]

Operating System: [Windows 10]

Browser: [ Chromium]

Source code

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

Link to the GitHub repository with the repro

Config file

Test file (self-contained)

sync getText(): Promise<string> {
const context = await chromium.launchPersistentContext('C:\\temp\\playwright-cache', {headless: false, channel: 'chrome' });
const page = context.pages()[0];
await page.goto("url behind SSO");
//here user login to the SSO manually for the first time
const text= await page.locator('cssSelector').innerHTML({timeout: 60*1000});
await page.close();
return text
}

Steps

Playwright opens a browser with persistent context

Playwright navigates to a URL with behind SSO

User enters credentials and logins

Playwright grabs the text and we return it

Function is run for second time

Expected

SSO not to be shown as user has already logged in once.

Actual

SSO page is shown every time as session is not saved.

Workaround

If await page.close(); is removed, session is correctly saved at the end of the test run and SSO page is no longer shown. However, the browser that was used to get the text required for other tests (that run in an non-persistent browser) remains open through out the test suite running and that is not ideal.