Skip to content

Commit a123a85

Browse files
committed
(#40) Adjustments for possible slowdown on test runners
1 parent 9d000e9 commit a123a85

File tree

1 file changed

+9
-2
lines changed
  • test/window-integration-tests

1 file changed

+9
-2
lines changed

Diff for: test/window-integration-tests/test.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ const electronPath = require("electron");
33
const libnut = require("../..");
44
const { POS_X, POS_Y, WIDTH, HEIGTH, TITLE } = require("./constants");
55

6+
const sleep = async (ms) => {
7+
return new Promise(resolve => setTimeout(resolve, ms));
8+
};
9+
610
let app;
711
const APP_TIMEOUT = 10000;
12+
jest.setTimeout(3 * APP_TIMEOUT)
813

9-
beforeAll(async () => {
14+
beforeEach(async () => {
1015
app = new Application({
1116
path: electronPath,
1217
args: ['main.js'],
@@ -63,6 +68,7 @@ describe("getActiveWindow", () => {
6368
const xPosition = 42;
6469
const yPosition = 23;
6570
await app.browserWindow.setPosition(xPosition, yPosition);
71+
await sleep(1000);
6672

6773
// WHEN
6874
const activeWindowHandle = libnut.getActiveWindow();
@@ -78,6 +84,7 @@ describe("getActiveWindow", () => {
7884
const newWidth = 400;
7985
const newHeight = 250;
8086
await app.browserWindow.setSize(newWidth, newHeight);
87+
await sleep(1000);
8188

8289
// WHEN
8390
const activeWindowHandle = libnut.getActiveWindow();
@@ -89,7 +96,7 @@ describe("getActiveWindow", () => {
8996
});
9097
});
9198

92-
afterAll(async () => {
99+
afterEach(async () => {
93100
if (app && app.isRunning()) {
94101
await app.stop();
95102
}

0 commit comments

Comments
 (0)