[Question] how to diagnose seemingly failing electron launches
See original GitHub issue/cc @pavelfeldman
I enabled playwright based Electron smoke tests for VSCode today but had to quickly disable that again and make it not fail the build because esp. on Windows I see cases of a VSCode launch not finishing.
To clarify: we start VSCode for almost every test on a fresh user data dir, so VSCode will start 10-20 times per run.
The glue-code is quite straightforward:
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(`Failed to start playwright tracing: ${error}`); // do not fail the build when this fails
}
}
window.on('pageerror', async (error) => logger.log(`Playwright ERROR: page error: ${error}`));
window.on('crash', () => logger.log('Playwright ERROR: page crash'));
window.on('close', () => logger.log('Playwright: page close'));
window.on('response', async (response) => {
if (response.status() >= 400) {
logger.log(`Playwright ERROR: HTTP status ${response.status()} for ${response.url()}`);
}
});
One of the very first things we do before running the tests is to check for .monaco-workbench
DOM element. This is our signal that we need before we consider the window as healthy.
A lot of cases on Windows timeout on this check and we use the method:
await code.driver.page.locator('.monaco-workbench').waitFor({ timeout: 40000 })
And then we sometimes get (Windows):
1) VSCode Smoke Tests (Electron)
Multiroot
"before all" hook for "shows results from all folders":
locator.waitFor: Timeout 40000ms exceeded.
=========================== logs ===========================
waiting for selector ".monaco-workbench" to be visible
============================================================
at Application.checkWindowReady (D:\a\_work\1\s\test\automation\src\application.ts:149:56)
at Application._start (D:\a\_work\1\s\test\automation\src\application.ts:98:4)
at Application.start (D:\a\_work\1\s\test\automation\src\application.ts:75:3)
at Context.<anonymous> (src\utils.ts:92:3)
This is mainly an ask what to do next. Enable tracing? Enable more logging? Launching Electron is done by playwright now so we do not really know what happens to the process when this occurs.
Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
We don’t backport fixes like this, we keep users waiting instead. But v1.21 will cut this week.
This turned out to be an issue with Electron where a IPC message on startup was not received / delivered.