diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index 2358e5a35c..ff68a5bb98 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -78,9 +78,13 @@ function areColorsSimilar ( } function displayCenter (display: Electron.Display): Electron.Point { + // On macOS, we get system prompt to ask permission for screen capture + // taking up space in the center. As a workaround, choose + // area of the application window which is not covered by the prompt. + // TODO: Remove this when the prompt situation is resolved. return { - x: display.size.width / 2, - y: display.size.height / 2 + x: display.size.width / (process.platform === 'darwin' ? 4 : 2), + y: display.size.height / (process.platform === 'darwin' ? 4 : 2) }; } diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts index 23d07e3256..a7e2989cd0 100644 --- a/spec/webview-spec.ts +++ b/spec/webview-spec.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main'; +import { BrowserWindow, session, ipcMain, app, WebContents, screen } from 'electron/main'; import * as auth from 'basic-auth'; import { expect } from 'chai'; @@ -782,6 +782,7 @@ describe(' tag', function () { let w: BrowserWindow; before(async () => { + const display = screen.getPrimaryDisplay(); w = new BrowserWindow({ webPreferences: { webviewTag: true, @@ -789,6 +790,7 @@ describe(' tag', function () { contextIsolation: false } }); + w.setBounds(display.bounds); await w.loadURL(`file://${fixtures}/pages/flex-webview.html`); w.setBackgroundColor(WINDOW_BACKGROUND_COLOR); });