From 730a6a92a6937e09cc93f7edab48329efcde18bd Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Fri, 3 May 2024 22:09:11 +0000 Subject: [PATCH] Make console logs more accessible during Playwright e2e test runs (#3066) --- apps/zui/src/electron/run-main/before-boot.ts | 4 ++++ packages/zui-player/helpers/test-app.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/apps/zui/src/electron/run-main/before-boot.ts b/apps/zui/src/electron/run-main/before-boot.ts index 76b19b644e..f2c0cae153 100644 --- a/apps/zui/src/electron/run-main/before-boot.ts +++ b/apps/zui/src/electron/run-main/before-boot.ts @@ -5,12 +5,16 @@ import {windowsPre25Exists} from "../windows-pre-25" import {MainArgs} from "./args" import {setLogLevel} from "../set-log-level" import {runMigrations} from "./run-migrations" +import log from "electron-log" app.disableHardwareAcceleration() export async function beforeBoot( args: Partial ): Promise { + // Ensure all console logs go through electron-log + console.log = log.log + // Disable security warnings // process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true" // Setup app paths, this must be first diff --git a/packages/zui-player/helpers/test-app.ts b/packages/zui-player/helpers/test-app.ts index bcc2f6c51b..d98b6c5596 100644 --- a/packages/zui-player/helpers/test-app.ts +++ b/packages/zui-player/helpers/test-app.ts @@ -45,6 +45,11 @@ export default class TestApp { if (bin) launchOpts.executablePath = bin; this.zui = await electron.launch(launchOpts); + // Pipe the stdout from the electron process into the test runner process + if (process.env['VERBOSE']) { + this.zui.process().stdout.pipe(process.stdout); + } + await waitForTrue(() => this.zui.windows().length === 2); await waitForTrue(async () => !!(await this.getWindowByTitle('Zui'))); await waitForTrue(