chore: pass cli config overrides straight to test server (#32818)
This commit is contained in:
parent
61801aa1ee
commit
597642d269
|
|
@ -40,13 +40,9 @@ export type TraceViewerRedirectOptions = {
|
||||||
grep?: string;
|
grep?: string;
|
||||||
grepInvert?: string;
|
grepInvert?: string;
|
||||||
project?: string[];
|
project?: string[];
|
||||||
workers?: number | string;
|
|
||||||
headed?: boolean;
|
|
||||||
timeout?: number;
|
|
||||||
reporter?: string[];
|
reporter?: string[];
|
||||||
webApp?: string;
|
webApp?: string;
|
||||||
isServer?: boolean;
|
isServer?: boolean;
|
||||||
updateSnapshots?: 'all' | 'none' | 'missing';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TraceViewerAppOptions = {
|
export type TraceViewerAppOptions = {
|
||||||
|
|
@ -126,14 +122,6 @@ export async function installRootRedirect(server: HttpServer, traceUrls: string[
|
||||||
params.append('grepInvert', options.grepInvert);
|
params.append('grepInvert', options.grepInvert);
|
||||||
for (const project of options.project || [])
|
for (const project of options.project || [])
|
||||||
params.append('project', 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 || [])
|
for (const reporter of options.reporter || [])
|
||||||
params.append('reporter', reporter);
|
params.append('reporter', reporter);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ export interface TestServerInterface {
|
||||||
testIds?: string[];
|
testIds?: string[];
|
||||||
headed?: boolean;
|
headed?: boolean;
|
||||||
workers?: number | string;
|
workers?: number | string;
|
||||||
timeout?: number,
|
|
||||||
updateSnapshots?: 'all' | 'none' | 'missing';
|
updateSnapshots?: 'all' | 'none' | 'missing';
|
||||||
reporters?: string[],
|
reporters?: string[],
|
||||||
trace?: 'on' | 'off';
|
trace?: 'on' | 'off';
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,7 @@ async function runTests(args: string[], opts: { [key: string]: any }) {
|
||||||
grep: opts.grep as string | undefined,
|
grep: opts.grep as string | undefined,
|
||||||
grepInvert: opts.grepInvert as string | undefined,
|
grepInvert: opts.grepInvert as string | undefined,
|
||||||
project: opts.project || undefined,
|
project: opts.project || undefined,
|
||||||
headed: opts.headed,
|
|
||||||
reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : undefined,
|
reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : undefined,
|
||||||
workers: cliOverrides.workers,
|
|
||||||
timeout: cliOverrides.timeout,
|
|
||||||
updateSnapshots: cliOverrides.updateSnapshots,
|
|
||||||
});
|
});
|
||||||
await stopProfiling('runner');
|
await stopProfiling('runner');
|
||||||
if (status === 'restarted')
|
if (status === 'restarted')
|
||||||
|
|
|
||||||
|
|
@ -300,17 +300,17 @@ export class TestServerDispatcher implements TestServerInterface {
|
||||||
repeatEach: 1,
|
repeatEach: 1,
|
||||||
retries: 0,
|
retries: 0,
|
||||||
preserveOutputDir: true,
|
preserveOutputDir: true,
|
||||||
timeout: params.timeout,
|
|
||||||
reporter: params.reporters ? params.reporters.map(r => [r]) : undefined,
|
reporter: params.reporters ? params.reporters.map(r => [r]) : undefined,
|
||||||
use: {
|
use: {
|
||||||
|
...(this._configCLIOverrides.use || {}),
|
||||||
trace: params.trace === 'on' ? { mode: 'on', sources: false, _live: true } : (params.trace === 'off' ? 'off' : undefined),
|
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),
|
video: params.video === 'on' ? 'on' : (params.video === 'off' ? 'off' : undefined),
|
||||||
headless: params.headed ? false : undefined,
|
headless: params.headed ? false : undefined,
|
||||||
_optionContextReuseMode: params.reuseContext ? 'when-possible' : undefined,
|
_optionContextReuseMode: params.reuseContext ? 'when-possible' : undefined,
|
||||||
_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : undefined,
|
_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : undefined,
|
||||||
},
|
},
|
||||||
updateSnapshots: params.updateSnapshots,
|
...(params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {}),
|
||||||
workers: params.workers,
|
...(params.workers ? { workers: params.workers } : {}),
|
||||||
};
|
};
|
||||||
if (params.trace === 'on')
|
if (params.trace === 'on')
|
||||||
process.env.PW_LIVE_TRACE_STACKS = '1';
|
process.env.PW_LIVE_TRACE_STACKS = '1';
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ const queryParams = {
|
||||||
grepInvert: searchParams.get('grepInvert') || undefined,
|
grepInvert: searchParams.get('grepInvert') || undefined,
|
||||||
projects: searchParams.getAll('project'),
|
projects: searchParams.getAll('project'),
|
||||||
workers: searchParams.get('workers') || undefined,
|
workers: searchParams.get('workers') || undefined,
|
||||||
timeout: searchParams.has('timeout') ? +searchParams.get('timeout')! : undefined,
|
|
||||||
headed: searchParams.has('headed'),
|
headed: searchParams.has('headed'),
|
||||||
updateSnapshots: (searchParams.get('updateSnapshots') as 'all' | 'none' | 'missing' | undefined) || undefined,
|
updateSnapshots: (searchParams.get('updateSnapshots') as 'all' | 'none' | 'missing' | undefined) || undefined,
|
||||||
reporters: searchParams.has('reporter') ? searchParams.getAll('reporter') : 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 onRevealSource = React.useCallback(() => setRevealSource(true), [setRevealSource]);
|
||||||
|
|
||||||
const showTestingOptions = false;
|
const showTestingOptions = false;
|
||||||
const [singleWorker, setSingleWorker] = React.useState(queryParams.workers === '1');
|
const [singleWorker, setSingleWorker] = React.useState(false);
|
||||||
const [showBrowser, setShowBrowser] = React.useState(queryParams.headed);
|
const [showBrowser, setShowBrowser] = React.useState(false);
|
||||||
const [updateSnapshots, setUpdateSnapshots] = React.useState(queryParams.updateSnapshots === 'all');
|
const [updateSnapshots, setUpdateSnapshots] = React.useState(false);
|
||||||
const [darkMode, setDarkMode] = useDarkModeSetting();
|
const [darkMode, setDarkMode] = useDarkModeSetting();
|
||||||
const [showScreenshot, setShowScreenshot] = useSetting('screenshot-instead-of-snapshot', false);
|
const [showScreenshot, setShowScreenshot] = useSetting('screenshot-instead-of-snapshot', false);
|
||||||
|
|
||||||
|
|
@ -288,12 +287,9 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
grepInvert: queryParams.grepInvert,
|
grepInvert: queryParams.grepInvert,
|
||||||
testIds: [...testIds],
|
testIds: [...testIds],
|
||||||
projects: [...projectFilters].filter(([_, v]) => v).map(([p]) => p),
|
projects: [...projectFilters].filter(([_, v]) => v).map(([p]) => p),
|
||||||
// When started with `--workers=1`, the setting allows to undo that.
|
...(singleWorker ? { workers: '1' } : {}),
|
||||||
// Otherwise, fallback to the cli `--workers=X` argument.
|
...(showBrowser ? { headed: true } : {}),
|
||||||
workers: singleWorker ? '1' : (queryParams.workers === '1' ? undefined : queryParams.workers),
|
...(updateSnapshots ? { updateSnapshots: 'all' } : {}),
|
||||||
timeout: queryParams.timeout,
|
|
||||||
headed: showBrowser,
|
|
||||||
updateSnapshots: updateSnapshots ? 'all' : queryParams.updateSnapshots,
|
|
||||||
reporters: queryParams.reporters,
|
reporters: queryParams.reporters,
|
||||||
trace: 'on',
|
trace: 'on',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue