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

This commit is contained in:
Yury Semikhatsky 2024-10-01 11:15:27 -07:00 committed by GitHub
parent 78054a7652
commit 228eb141db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View file

@ -44,3 +44,5 @@ jobs:
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --project=${{ matrix.channel }}* run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --project=${{ matrix.channel }}*
env: env:
PWTEST_USE_BIDI_EXPECTATIONS: '1' 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}'

View file

@ -21,18 +21,22 @@ import { type Config, type PlaywrightTestOptions, type PlaywrightWorkerOptions,
import * as path from 'path'; import * as path from 'path';
import type { TestModeWorkerOptions } from '../config/testModeFixtures'; import type { TestModeWorkerOptions } from '../config/testModeFixtures';
const getExecutablePath = () => {
return process.env.BIDIPATH;
};
const headed = process.argv.includes('--headed'); const headed = process.argv.includes('--headed');
const trace = !!process.env.PWTEST_TRACE; 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 outputDir = path.join(__dirname, '..', '..', 'test-results');
const testDir = path.join(__dirname, '..'); const testDir = path.join(__dirname, '..');
const reporters = () => { const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [ const result: ReporterDescription[] = process.env.CI ? [
['dot'], hasDebugOutput ? ['list'] : ['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }], ['json', { outputFile: path.join(outputDir, 'report.json') }],
['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }], ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
] : [ ] : [
@ -59,7 +63,7 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeW
projects: [], projects: [],
}; };
const executablePath = getExecutablePath(); const executablePath = process.env.BIDIPATH;
if (executablePath && !process.env.TEST_WORKER_INDEX) if (executablePath && !process.env.TEST_WORKER_INDEX)
console.error(`Using executable at ${executablePath}`); console.error(`Using executable at ${executablePath}`);
const testIgnore: RegExp[] = []; const testIgnore: RegExp[] = [];
@ -83,6 +87,7 @@ for (const [key, channels] of Object.entries(browserToChannels)) {
video: 'off', video: 'off',
launchOptions: { launchOptions: {
executablePath, executablePath,
firefoxUserPrefs: firefoxUserPrefs(),
}, },
trace: trace ? 'on' : undefined, trace: trace ? 'on' : undefined,
}, },