test: make sure test window is on top for focus tests (#45552)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
fc697735c4
commit
452d891be5
2 changed files with 10 additions and 3 deletions
|
@ -98,14 +98,13 @@ describe('window.postMessage', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tests disabled due to regression in Chromium upgrade
|
describe('focus handling', () => {
|
||||||
// https://github.com/electron/electron/issues/45322
|
|
||||||
ifdescribe(!(process.platform === 'win32' && process.arch === 'ia32'))('focus handling', () => {
|
|
||||||
let webviewContents: WebContents;
|
let webviewContents: WebContents;
|
||||||
let w: BrowserWindow;
|
let w: BrowserWindow;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
w = new BrowserWindow({
|
w = new BrowserWindow({
|
||||||
|
alwaysOnTop: true,
|
||||||
show: true,
|
show: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
|
|
@ -122,6 +122,14 @@ export class ScreenCapture {
|
||||||
return this._expectImpl(findPoint(this.display.size), hexColor, true);
|
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> {
|
private async captureFrame (): Promise<NativeImage> {
|
||||||
const sources = await desktopCapturer.getSources({
|
const sources = await desktopCapturer.getSources({
|
||||||
types: ['screen'],
|
types: ['screen'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue