Skip to content

Commit fc82faf

Browse files
authored
Merge pull request #272 from nut-tree/maintenance/271/dependency_updates
Maintenance/271/dependency updates
2 parents e82a49e + 7c8c3f5 commit fc82faf

File tree

9 files changed

+2254
-3317
lines changed

9 files changed

+2254
-3317
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
run: |
4343
npm run coverage:merge
4444
npm run coverage:merge-report
45-
- name: Send results to SonarCloud
46-
uses: SonarSource/sonarcloud-github-action@v1.6
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45+
# - name: Send results to SonarCloud
46+
# uses: SonarSource/sonarcloud-github-action@v1.6
47+
# env:
48+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5050

5151
test:
5252
needs:

index.e2e.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
straightTo,
1313
} from "./index";
1414

15+
jest.setTimeout(60000);
16+
1517
const openXfceMenu = async () => {
1618
await mouse.move(straightTo(centerOf(screen.find("menu.png"))));
1719
await mouse.leftClick();
@@ -47,12 +49,10 @@ describe("E2E tests", () => {
4749
});
4850

4951
it("should throw on invalid images", async () => {
50-
jest.setTimeout(30000);
5152
await expect(screen.find("mouse.png")).rejects.toContain("Failed to load image");
5253
});
5354

5455
it("should perform some calculations", async () => {
55-
jest.setTimeout(30000);
5656
screen.config.resourceDirectory = "./e2e/assets";
5757
await assert.isVisible("mouse.png");
5858
await assert.isVisible("desktop.png");
@@ -67,7 +67,6 @@ describe("E2E tests", () => {
6767
});
6868

6969
it("drag & drop", async () => {
70-
jest.setTimeout(60000);
7170
screen.config.resourceDirectory = "./e2e/assets";
7271

7372
const expected = new Region(38, 585, 70, 86);

lib/keyboard.class.e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { jestMatchers, Key, keyboard, screen } from "../index";
22

3+
jest.setTimeout(30000);
34
expect.extend(jestMatchers);
45

56
const run = async (cmd: string) => {
@@ -19,7 +20,6 @@ const close = async () => {
1920
describe("Keyboard e2e class", () => {
2021
it("should open gnome calculator via keyboard.", async () => {
2122
// GIVEN
22-
jest.setTimeout(30000);
2323
screen.config.resourceDirectory = "./e2e/assets";
2424
screen.config.confidence = 0.97;
2525
await run("gnome-calculator");

lib/keyboard.class.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Key } from "./key.enum";
33
import { Keyboard } from "./keyboard.class";
44

55
jest.mock("./adapter/native.adapter.class");
6+
jest.setTimeout(10000);
67

78
beforeEach(() => {
89
jest.resetAllMocks();
@@ -38,7 +39,6 @@ describe("Keyboard", () => {
3839

3940
it("should pass multiple input strings down to the type call.", async () => {
4041
// GIVEN
41-
jest.setTimeout(10000);
4242
const adapterMock = new NativeAdapter();
4343
const SUT = new Keyboard(adapterMock);
4444
const payload = ["Test input!", "Array test2"];

lib/provider/native/clipboardy-clipboard-action.class.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ beforeEach(() => {
66

77
describe("clipboardy action", () => {
88
describe("copy", () => {
9-
it("should resolve", async done => {
9+
it("should resolve", async () => {
1010
// GIVEN
1111
const SUT = new ClipboardAction();
1212
const testText = "test";
@@ -15,11 +15,10 @@ describe("clipboardy action", () => {
1515

1616
// THEN
1717
await SUT.copy(testText);
18-
done();
1918
});
2019
});
2120
describe("hasText", () => {
22-
it("should return true when text has been copied", async done => {
21+
it("should return true when text has been copied", async () => {
2322
// GIVEN
2423
const SUT = new ClipboardAction();
2524
const testText = "test";
@@ -29,7 +28,6 @@ describe("clipboardy action", () => {
2928

3029
// THEN
3130
await expect(SUT.hasText()).resolves.toBeTruthy();
32-
done();
3331
});
3432
});
3533
});

lib/screen.class.e2e.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {Screen} from "./screen.class";
55
import {sleep} from "./sleep.function";
66
import AbortController from "node-abort-controller";
77

8+
jest.setTimeout(10000);
9+
810
describe("Screen.", () => {
911
it("should capture the screen", () => {
1012
// GIVEN
@@ -91,7 +93,6 @@ describe("Screen.", () => {
9193

9294
it("should reject after timeout", async () => {
9395
// GIVEN
94-
jest.setTimeout(10000);
9596
const timeout = 5000;
9697
const visionAdapter = new VisionAdapter();
9798
const SUT = new Screen(visionAdapter);
@@ -113,7 +114,6 @@ describe("Screen.", () => {
113114

114115
it("should abort via signal", (done) => {
115116
// GIVEN
116-
jest.setTimeout(10000);
117117
const timeout = 5000;
118118
const abortAfterMs = 1000;
119119
const controller = new AbortController();

lib/util/timeout.function.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {timeout} from "./timeout.function";
22
import AbortController from "node-abort-controller";
3+
import {sleep} from "../sleep.function";
34

45
describe("timeout", () => {
56
it("should timeout after maxDuration if action rejects", async () => {
@@ -138,7 +139,7 @@ describe("timeout", () => {
138139
expect(action).toBeCalledTimes(1);
139140
});
140141

141-
it("should fail after timeout if no result is returned from long running action", async (done) => {
142+
it("should fail after timeout if no result is returned from long running action", async () => {
142143
// GIVEN
143144
const updateInterval = 100;
144145
const maxDuration = 200;
@@ -156,10 +157,8 @@ describe("timeout", () => {
156157
// THEN
157158
await expect(SUT).rejects.toBe(`Action timed out after ${maxDuration} ms`);
158159
expect(action).toBeCalledTimes(1);
159-
setTimeout(() => {
160-
expect(action).toBeCalledTimes(1);
161-
done();
162-
}, 500);
160+
await sleep(500);
161+
expect(action).toBeCalledTimes(1);
163162
});
164163

165164
it("should be externally abortable", async () => {

0 commit comments

Comments
 (0)