Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: pass cli config overrides straight to test server (#32818)
Yury Semikhatsky597642d26929
diff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.tsindex 6d45e7c6f5..a49148e061 100644--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts@@ -40,13 +40,9 @@ export type TraceViewerRedirectOptions = {grep?: string;grepInvert?: string;project?: string[];- workers?: number | string;- headed?: boolean;- timeout?: number;reporter?: string[];webApp?: string;isServer?: boolean;- updateSnapshots?: 'all' | 'none' | 'missing';};export type TraceViewerAppOptions = {@@ -126,14 +122,6 @@ export async function installRootRedirect(server: HttpServer, traceUrls: string[params.append('grepInvert', options.grepInvert);for (const project of options.project || [])params.append('project', project);- if (options.workers)- params.append('workers', String(options.workers));- if (options.timeout)- params.append('timeout', String(options.timeout));- if (options.headed)- params.append('headed', '');- if (options.updateSnapshots)- params.append('updateSnapshots', options.updateSnapshots);for (const reporter of options.reporter || [])params.append('reporter', reporter);diff --git a/packages/playwright/src/isomorphic/testServerInterface.ts b/packages/playwright/src/isomorphic/testServerInterface.tsindex ce1c1888d5..257d04c681 100644--- a/packages/playwright/src/isomorphic/testServerInterface.ts+++ b/packages/playwright/src/isomorphic/testServerInterface.ts@@ -94,7 +94,6 @@ export interface TestServerInterface {testIds?: string[];headed?: boolean;workers?: number | string;- timeout?: number,updateSnapshots?: 'all' | 'none' | 'missing';reporters?: string[],trace?: 'on' | 'off';diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.tsindex 136606b26c..b4a12c0ea7 100644--- a/packages/playwright/src/program.ts+++ b/packages/playwright/src/program.ts@@ -168,11 +168,7 @@ async function runTests(args: string[], opts: { [key: string]: any }) {grep: opts.grep as string | undefined,grepInvert: opts.grepInvert as string | undefined,project: opts.project || undefined,- headed: opts.headed,reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : undefined,- workers: cliOverrides.workers,- timeout: cliOverrides.timeout,- updateSnapshots: cliOverrides.updateSnapshots,});await stopProfiling('runner');if (status === 'restarted')diff --git a/packages/playwright/src/runner/testServer.ts b/packages/playwright/src/runner/testServer.tsindex ee3cefaac4..50a8de366e 100644--- a/packages/playwright/src/runner/testServer.ts+++ b/packages/playwright/src/runner/testServer.ts@@ -300,17 +300,17 @@ export class TestServerDispatcher implements TestServerInterface {repeatEach: 1,retries: 0,preserveOutputDir: true,- timeout: params.timeout,reporter: params.reporters ? params.reporters.map(r => [r]) : undefined,use: {+ ...(this._configCLIOverrides.use || {}),trace: params.trace === 'on' ? { mode: 'on', sources: false, _live: true } : (params.trace === 'off' ? 'off' : undefined),video: params.video === 'on' ? 'on' : (params.video === 'off' ? 'off' : undefined),headless: params.headed ? false : undefined,_optionContextReuseMode: params.reuseContext ? 'when-possible' : undefined,_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : undefined,},- updateSnapshots: params.updateSnapshots,- workers: params.workers,+ ...(params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {}),+ ...(params.workers ? { workers: params.workers } : {}),};if (params.trace === 'on')process.env.PW_LIVE_TRACE_STACKS = '1';diff --git a/packages/trace-viewer/src/ui/uiModeView.tsx b/packages/trace-viewer/src/ui/uiModeView.tsxindex 5c6ab7969b..95c10c3382 100644--- a/packages/trace-viewer/src/ui/uiModeView.tsx+++ b/packages/trace-viewer/src/ui/uiModeView.tsx@@ -56,7 +56,6 @@ const queryParams = {grepInvert: searchParams.get('grepInvert') || undefined,projects: searchParams.getAll('project'),workers: searchParams.get('workers') || undefined,- timeout: searchParams.has('timeout') ? +searchParams.get('timeout')! : undefined,headed: searchParams.has('headed'),updateSnapshots: (searchParams.get('updateSnapshots') as 'all' | 'none' | 'missing' | undefined) || undefined,reporters: searchParams.has('reporter') ? searchParams.getAll('reporter') : undefined,@@ -101,9 +100,9 @@ export const UIModeView: React.FC<{}> = ({const onRevealSource = React.useCallback(() => setRevealSource(true), [setRevealSource]);const showTestingOptions = false;- const [singleWorker, setSingleWorker] = React.useState(queryParams.workers === '1');- const [showBrowser, setShowBrowser] = React.useState(queryParams.headed);- const [updateSnapshots, setUpdateSnapshots] = React.useState(queryParams.updateSnapshots === 'all');+ const [singleWorker, setSingleWorker] = React.useState(false);+ const [showBrowser, setShowBrowser] = React.useState(false);+ const [updateSnapshots, setUpdateSnapshots] = React.useState(false);const [darkMode, setDarkMode] = useDarkModeSetting();const [showScreenshot, setShowScreenshot] = useSetting('screenshot-instead-of-snapshot', false);@@ -288,12 +287,9 @@ export const UIModeView: React.FC<{}> = ({grepInvert: queryParams.grepInvert,testIds: [...testIds],projects: [...projectFilters].filter(([_, v]) => v).map(([p]) => p),- // When started with `--workers=1`, the setting allows to undo that.- // Otherwise, fallback to the cli `--workers=X` argument.- workers: singleWorker ? '1' : (queryParams.workers === '1' ? undefined : queryParams.workers),- timeout: queryParams.timeout,- headed: showBrowser,- updateSnapshots: updateSnapshots ? 'all' : queryParams.updateSnapshots,+ ...(singleWorker ? { workers: '1' } : {}),+ ...(showBrowser ? { headed: true } : {}),+ ...(updateSnapshots ? { updateSnapshots: 'all' } : {}),reporters: queryParams.reporters,trace: 'on',});