Skip to content

Commit

Permalink
(nut-tree#271) Fixed timeout configs in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
s1hofmann committed Sep 5, 2021
1 parent fb8bca7 commit 7c8c3f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions index.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
straightTo,
} from "./index";

jest.setTimeout(60000);

const openXfceMenu = async () => {
await mouse.move(straightTo(centerOf(screen.find("menu.png"))));
await mouse.leftClick();
Expand Down Expand Up @@ -47,12 +49,10 @@ describe("E2E tests", () => {
});

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

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

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

const expected = new Region(38, 585, 70, 86);
Expand Down
2 changes: 1 addition & 1 deletion lib/keyboard.class.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { jestMatchers, Key, keyboard, screen } from "../index";

jest.setTimeout(30000);
expect.extend(jestMatchers);

const run = async (cmd: string) => {
Expand All @@ -19,7 +20,6 @@ const close = async () => {
describe("Keyboard e2e class", () => {
it("should open gnome calculator via keyboard.", async () => {
// GIVEN
jest.setTimeout(30000);
screen.config.resourceDirectory = "./e2e/assets";
screen.config.confidence = 0.97;
await run("gnome-calculator");
Expand Down
4 changes: 2 additions & 2 deletions lib/screen.class.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {Screen} from "./screen.class";
import {sleep} from "./sleep.function";
import AbortController from "node-abort-controller";

jest.setTimeout(10000);

describe("Screen.", () => {
it("should capture the screen", () => {
// GIVEN
Expand Down Expand Up @@ -91,7 +93,6 @@ describe("Screen.", () => {

it("should reject after timeout", async () => {
// GIVEN
jest.setTimeout(10000);
const timeout = 5000;
const visionAdapter = new VisionAdapter();
const SUT = new Screen(visionAdapter);
Expand All @@ -113,7 +114,6 @@ describe("Screen.", () => {

it("should abort via signal", (done) => {
// GIVEN
jest.setTimeout(10000);
const timeout = 5000;
const abortAfterMs = 1000;
const controller = new AbortController();
Expand Down

0 comments on commit 7c8c3f5

Please sign in to comment.