mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Support launching web smoketests in headless mode
This commit is contained in:
parent
b7bc156319
commit
7721d6e373
|
@ -125,7 +125,8 @@ export class Application {
|
|||
log: this.options.log,
|
||||
extraArgs,
|
||||
remote: this.options.remote,
|
||||
web: this.options.web
|
||||
web: this.options.web,
|
||||
headless: this.options.headless
|
||||
});
|
||||
|
||||
this._workbench = new Workbench(this._code, this.userDataPath);
|
||||
|
|
|
@ -52,7 +52,8 @@ const opts = minimist(args, {
|
|||
boolean: [
|
||||
'verbose',
|
||||
'remote',
|
||||
'web'
|
||||
'web',
|
||||
'headless'
|
||||
],
|
||||
default: {
|
||||
verbose: false
|
||||
|
@ -214,7 +215,8 @@ function createOptions(): ApplicationOptions {
|
|||
log,
|
||||
screenshotsPath,
|
||||
remote: opts.remote,
|
||||
web: opts.web
|
||||
web: opts.web,
|
||||
headless: opts.headless
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ export interface SpawnOptions {
|
|||
remote?: boolean;
|
||||
/** Run in the web */
|
||||
web?: boolean;
|
||||
/** Run in headless mode (only applies when web is true) */
|
||||
headless?: boolean;
|
||||
}
|
||||
|
||||
async function createDriverHandle(): Promise<string> {
|
||||
|
@ -172,7 +174,7 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
|
|||
|
||||
if (options.web) {
|
||||
launch(args);
|
||||
connectDriver = connectPuppeteerDriver;
|
||||
connectDriver = connectPuppeteerDriver.bind(connectPuppeteerDriver, !!options.headless);
|
||||
} else {
|
||||
const spawnOptions: cp.SpawnOptions = { env };
|
||||
child = cp.spawn(electronPath, args, spawnOptions);
|
||||
|
@ -180,7 +182,6 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
|
|||
child.once('exit', () => instances.delete(child!));
|
||||
connectDriver = connectElectronDriver;
|
||||
}
|
||||
|
||||
return connect(connectDriver, child, outPath, handle, options.logger);
|
||||
}
|
||||
|
||||
|
@ -379,4 +380,4 @@ export function findElements(element: IElement, fn: (element: IElement) => boole
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,12 +183,12 @@ export function launch(_args): void {
|
|||
// TODO: Move puppeteer launch here
|
||||
}
|
||||
|
||||
export function connect(outPath: string, handle: string): Promise<{ client: IDisposable, driver: IDriver }> {
|
||||
export function connect(headless: boolean, outPath: string, handle: string): Promise<{ client: IDisposable, driver: IDriver }> {
|
||||
return new Promise(async (c) => {
|
||||
const browser = await puppeteer.launch({
|
||||
// Run in Edge dev on macOS
|
||||
// executablePath: '/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev',
|
||||
headless: false,
|
||||
headless,
|
||||
slowMo: 80,
|
||||
args: [`--window-size=${width},${height}`]
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue