mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
* Fix initial build breaks from 1.67 merge (#2514) * Update yarn lock files * Update build scripts * Fix tsconfig * Build breaks * WIP * Update yarn lock files * Misc breaks * Updates to package.json * Breaks * Update yarn * Fix breaks * Breaks * Build breaks * Breaks * Breaks * Breaks * Breaks * Breaks * Missing file * Breaks * Breaks * Breaks * Breaks * Breaks * Fix several runtime breaks (#2515) * Missing files * Runtime breaks * Fix proxy ordering issue * Remove commented code * Fix breaks with opening query editor * Fix post merge break * Updates related to setup build and other breaks (#2516) * Fix bundle build issues * Update distro * Fix distro merge and update build JS files * Disable pipeline steps * Remove stats call * Update license name * Make new RPM dependencies a warning * Fix extension manager version checks * Update JS file * Fix a few runtime breaks * Fixes * Fix runtime issues * Fix build breaks * Update notebook tests (part 1) * Fix broken tests * Linting errors * Fix hygiene * Disable lint rules * Bump distro * Turn off smoke tests * Disable integration tests * Remove failing "activate" test * Remove failed test assertion * Disable other broken test * Disable query history tests * Disable extension unit tests * Disable failing tasks
77 lines
3.7 KiB
TypeScript
77 lines
3.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as playwright from '@playwright/test';
|
|
import type { LaunchOptions } from './code';
|
|
import { PlaywrightDriver } from './playwrightDriver';
|
|
import { IElectronConfiguration, resolveElectronConfiguration } from './electron';
|
|
import { measureAndLog } from './logger';
|
|
import { ChildProcess } from 'child_process';
|
|
|
|
export async function launch(options: LaunchOptions): Promise<{ electronProcess: ChildProcess; driver: PlaywrightDriver }> {
|
|
|
|
// Resolve electron config and update
|
|
const { electronPath, args, env } = await resolveElectronConfiguration(options);
|
|
args.push('--enable-smoke-test-driver');
|
|
|
|
// Launch electron via playwright
|
|
const { electron, context, page } = await launchElectron({ electronPath, args, env }, options);
|
|
const electronProcess = electron.process();
|
|
|
|
return {
|
|
electronProcess,
|
|
driver: new PlaywrightDriver(electron, context, page, undefined /* no server process */, options)
|
|
};
|
|
}
|
|
|
|
async function launchElectron(configuration: IElectronConfiguration, options: LaunchOptions) {
|
|
const { logger, tracing } = options;
|
|
|
|
const electron = await measureAndLog(playwright._electron.launch({
|
|
executablePath: configuration.electronPath,
|
|
args: configuration.args,
|
|
env: configuration.env as { [key: string]: string }
|
|
}), 'playwright-electron#launch', logger);
|
|
|
|
const window = await measureAndLog(electron.firstWindow(), 'playwright-electron#firstWindow', logger);
|
|
|
|
const context = window.context();
|
|
|
|
if (tracing) {
|
|
try {
|
|
await measureAndLog(context.tracing.start({ screenshots: true, /* remaining options are off for perf reasons */ }), 'context.tracing.start()', logger);
|
|
} catch (error) {
|
|
logger.log(`Playwright (Electron): Failed to start playwright tracing (${error})`); // do not fail the build when this fails
|
|
}
|
|
}
|
|
|
|
if (options.verbose) {
|
|
electron.on('window', () => logger.log(`Playwright (Electron): electron.on('window')`));
|
|
electron.on('close', () => logger.log(`Playwright (Electron): electron.on('close')`));
|
|
|
|
context.on('page', () => logger.log(`Playwright (Electron): context.on('page')`));
|
|
context.on('requestfailed', e => logger.log(`Playwright (Electron): context.on('requestfailed') [${e.failure()?.errorText} for ${e.url()}]`));
|
|
|
|
window.on('dialog', () => logger.log(`Playwright (Electron): window.on('dialog')`));
|
|
window.on('domcontentloaded', () => logger.log(`Playwright (Electron): window.on('domcontentloaded')`));
|
|
window.on('load', () => logger.log(`Playwright (Electron): window.on('load')`));
|
|
window.on('popup', () => logger.log(`Playwright (Electron): window.on('popup')`));
|
|
window.on('framenavigated', () => logger.log(`Playwright (Electron): window.on('framenavigated')`));
|
|
window.on('requestfailed', e => logger.log(`Playwright (Electron): window.on('requestfailed') [${e.failure()?.errorText} for ${e.url()}]`));
|
|
}
|
|
|
|
window.on('console', e => logger.log(`Playwright (Electron): window.on('console') [${e.text()}]`));
|
|
window.on('pageerror', async (error) => logger.log(`Playwright (Electron) ERROR: page error: ${error}`));
|
|
window.on('crash', () => logger.log('Playwright (Electron) ERROR: page crash'));
|
|
window.on('close', () => logger.log('Playwright (Electron): page close'));
|
|
window.on('response', async (response) => {
|
|
if (response.status() >= 400) {
|
|
logger.log(`Playwright (Electron) ERROR: HTTP status ${response.status()} for ${response.url()}`);
|
|
}
|
|
});
|
|
|
|
return { electron, context, page: window };
|
|
}
|