Skip to content

Commit 4097c9b

Browse files
committed
(#18) Adapt tests which require accessibility permissions to not execute on macOS. Verified locally during development
1 parent 0d5ed99 commit 4097c9b

File tree

1 file changed

+17
-5
lines changed
  • test/window-integration-tests

1 file changed

+17
-5
lines changed

test/window-integration-tests/test.js

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Application = require("spectron").Application;
22
const electronPath = require("electron");
33
const libnut = require("../..");
4-
const { POS_X, POS_Y, WIDTH, HEIGTH, TITLE } = require("./constants");
4+
const {POS_X, POS_Y, WIDTH, HEIGTH, TITLE} = require("./constants");
55

66
const sleep = async (ms) => {
77
return new Promise(resolve => setTimeout(resolve, ms));
@@ -67,11 +67,17 @@ describe("getActiveWindow", () => {
6767
// GIVEN
6868
const xPosition = 42;
6969
const yPosition = 25;
70+
if (process.arch === 'darwin') {
71+
await app.browserWindow.setPosition(xPosition, yPosition);
72+
await sleep(1000);
73+
}
7074

7175
// WHEN
7276
const activeWindowHandle = libnut.getActiveWindow();
73-
libnut.moveWindow(activeWindowHandle, { x: xPosition, y: yPosition });
74-
await sleep(1000);
77+
if (process.arch !== 'darwin') {
78+
libnut.moveWindow(activeWindowHandle, {x: xPosition, y: yPosition});
79+
await sleep(1000);
80+
}
7581
const activeWindowRect = libnut.getWindowRect(activeWindowHandle);
7682

7783
// THEN
@@ -83,11 +89,17 @@ describe("getActiveWindow", () => {
8389
// GIVEN
8490
const newWidth = 400;
8591
const newHeight = 250;
92+
if (process.arch === 'darwin') {
93+
await app.browserWindow.setSize(newWidth, newHeight);
94+
await sleep(1000);
95+
}
8696

8797
// WHEN
8898
const activeWindowHandle = libnut.getActiveWindow();
89-
libnut.resizeWindow(activeWindowHandle, { width: newWidth, height: newHeight });
90-
await sleep(1000);
99+
if (process.arch !== 'darwin') {
100+
libnut.resizeWindow(activeWindowHandle, {width: newWidth, height: newHeight});
101+
await sleep(1000);
102+
}
91103
const activeWindowRect = libnut.getWindowRect(activeWindowHandle);
92104

93105
// THEN

0 commit comments

Comments
 (0)