Added Playwright-codegen setup

This commit is contained in:
ramki-bruno 2025-04-01 17:39:28 +05:30 committed by Anoop M D
parent cd3c66cb14
commit 4c1d3b4f3a
2 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,7 @@
"build:electron:deb": "./scripts/build-electron.sh deb",
"build:electron:rpm": "./scripts/build-electron.sh rpm",
"build:electron:snap": "./scripts/build-electron.sh snap",
"test:codegen": "npm run dev:web & node ./scripts/playwright-codegen.js",
"test:e2e": "npx playwright test",
"test:report": "npx playwright show-report",
"test:prettier:web": "npm run test:prettier --workspace=packages/bruno-app",

View File

@ -0,0 +1,17 @@
const path = require('path');
const timer = require('node:timers/promises');
const { _electron: electron } = require('playwright');
const electronAppPath = path.join(__dirname, '../packages/bruno-electron');
(async () => {
const browser = await electron.launch({ args: [electronAppPath] });
const context = await browser.context();
await context.route('**/*', (route) => route.continue());
while (true) {
if(browser.windows().length) break;
await timer.setTimeout(200);
}
await browser.windows()[0].pause();
})();