Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(bidi): enable logs in Firefox on CI (#32908)

Yury Semikhatsky228eb141dbb1
diff --git a/.github/workflows/tests_bidi.yml b/.github/workflows/tests_bidi.yml
index 34af9e7096..b07acbcf4b 100644
--- a/.github/workflows/tests_bidi.yml
+++ b/.github/workflows/tests_bidi.yml
@@ -44,3 +44,5 @@ jobs:
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --project=${{ matrix.channel }}*
env:
PWTEST_USE_BIDI_EXPECTATIONS: '1'
+ DEBUG: ${{ matrix.channel == 'bidi-firefox-nightly' && 'pw:browser' || null }}
+ PWTEST_FIREFOX_USER_PREFS: '{"remote.log.level": "Trace", "remote.log.truncate": false}'
diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.ts
index c333ff9d12..39df88f537 100644
--- a/tests/bidi/playwright.config.ts
+++ b/tests/bidi/playwright.config.ts
@@ -21,18 +21,22 @@ import { type Config, type PlaywrightTestOptions, type PlaywrightWorkerOptions,
import * as path from 'path';
import type { TestModeWorkerOptions } from '../config/testModeFixtures';
-const getExecutablePath = () => {
- return process.env.BIDIPATH;
-};
-
const headed = process.argv.includes('--headed');
const trace = !!process.env.PWTEST_TRACE;
+const hasDebugOutput = process.env.DEBUG?.includes('pw:');
+
+function firefoxUserPrefs() {
+ const prefsString = process.env.PWTEST_FIREFOX_USER_PREFS;
+ if (!prefsString)
+ return undefined;
+ return JSON.parse(prefsString);
+}
const outputDir = path.join(__dirname, '..', '..', 'test-results');
const testDir = path.join(__dirname, '..');
const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
- ['dot'],
+ hasDebugOutput ? ['list'] : ['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
] : [
@@ -59,7 +63,7 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeW
projects: [],
};
-const executablePath = getExecutablePath();
+const executablePath = process.env.BIDIPATH;
if (executablePath && !process.env.TEST_WORKER_INDEX)
console.error(`Using executable at ${executablePath}`);
const testIgnore: RegExp[] = [];
@@ -83,6 +87,7 @@ for (const [key, channels] of Object.entries(browserToChannels)) {
video: 'off',
launchOptions: {
executablePath,
+ firefoxUserPrefs: firefoxUserPrefs(),
},
trace: trace ? 'on' : undefined,
},