(#5) Export window API and added E2E test

This commit is contained in:
Simon Hofmann
2020-08-11 17:59:57 +02:00
parent f8be1a5d71
commit fb028a8bd1
2 changed files with 24 additions and 1 deletions
+19 -1
View File
@@ -1,4 +1,5 @@
import {
activeWindow,
assert,
Button,
centerOf,
@@ -10,7 +11,7 @@ import {
right,
screen,
sleep,
straightTo
straightTo,
} from "./index";
const openXfceMenu = async () => {
@@ -97,3 +98,20 @@ describe("E2E mouse button demo", () => {
}
});
});
describe("E2E window demo", () => {
it("should list gnome-calculator", async () => {
jest.setTimeout(30000);
screen.config.resourceDirectory = "./e2e/assets";
await assert.isVisible("mouse.png");
await assert.isVisible("desktop.png");
await openXfceMenu();
await run("uxterm");
await sleep(1500);
const foregroundWindow = await activeWindow();
const windowTitle = await foregroundWindow.title;
await close();
expect(windowTitle).toBe("uxterm")
});
});
+5
View File
@@ -7,6 +7,7 @@ import { Mouse } from "./lib/mouse.class";
import { createMovementApi } from "./lib/movement.function";
import { Screen } from "./lib/screen.class";
import { LineHelper } from "./lib/util/linehelper.class";
import { createWindowApi } from "./lib/window.function";
export { jestMatchers } from "./lib/expect/jest.matcher.function";
export { sleep } from "./lib/sleep.function";
@@ -19,6 +20,7 @@ export { OptionalSearchParameters } from "./lib/optionalsearchparameters.class";
export { linear } from "./lib/movementtype.function";
export { Point } from "./lib/point.class";
export { Region } from "./lib/region.class";
export { Window } from "./lib/window.class";
const screenActions = new VisionAdapter();
const nativeActions = new NativeAdapter();
@@ -31,6 +33,7 @@ const screen = new Screen(screenActions);
const assert = new Assert(screen);
const {straightTo, up, down, left, right} = createMovementApi(nativeActions, lineHelper);
const {windows, activeWindow } = createWindowApi(nativeActions);
export {
clipboard,
@@ -43,4 +46,6 @@ export {
down,
left,
right,
windows,
activeWindow,
};