test: make sure test window is on top for focus tests (#45435)

This commit is contained in:
John Kleinschmidt 2025-02-10 13:40:27 -05:00 committed by GitHub
parent 3ba85878a5
commit 14fe0932f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -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,

View file

@ -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<NativeImage> {
const sources = await desktopCapturer.getSources({
types: ['screen'],