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;
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue