From 14fe0932f050669fb96fd459562ab84674406532 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 10 Feb 2025 13:40:27 -0500 Subject: [PATCH] test: make sure test window is on top for focus tests (#45435) --- spec/chromium-spec.ts | 5 ++--- spec/lib/screen-helpers.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index dc54a816df0d..a925e5b05529 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -98,14 +98,13 @@ describe('window.postMessage', () => { }); }); -// Tests disabled due to regression in Chromium upgrade -// https://github.com/electron/electron/issues/45322 -ifdescribe(!(process.platform === 'win32' && process.arch === 'ia32'))('focus handling', () => { +describe('focus handling', () => { let webviewContents: WebContents; let w: BrowserWindow; beforeEach(async () => { w = new BrowserWindow({ + alwaysOnTop: true, show: true, webPreferences: { nodeIntegration: true, diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index 0fb3128611dd..2358e5a35cd5 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -122,6 +122,14 @@ export class ScreenCapture { return this._expectImpl(findPoint(this.display.size), hexColor, true); } + public async takeScreenshot (filePrefix: string) { + const frame = await this.captureFrame(); + return await createArtifactWithRandomId( + (id) => `${filePrefix}-${id}.png`, + frame.toPNG() + ); + } + private async captureFrame (): Promise { const sources = await desktopCapturer.getSources({ types: ['screen'],