Skip to content

Commit

Permalink
Remove window-element query from core
Browse files Browse the repository at this point in the history
  • Loading branch information
s1hofmann committed Apr 3, 2024
1 parent 957cde8 commit 17b5c16
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions core/nut.js/lib/window.class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
WindowProviderInterface
} from "@nut-tree/provider-interfaces";
import { mockPartial } from "sneer";
import { Region, RGBA, WindowElement, WindowElementDescription } from "@nut-tree/shared";
import { pixelWithColor, windowElementDescribedBy } from "../index";
import { Region, RGBA, WindowElement, WindowElementDescription, WindowElementQuery } from "@nut-tree/shared";
import { pixelWithColor } from "../index";
import { NoopLogProvider } from "./provider/log/noop-log-provider.class";

jest.setTimeout(50000);
Expand Down Expand Up @@ -103,12 +103,20 @@ describe("Window class", () => {
});
const mockWindowHandle = 123;
const description: WindowElementDescription = {
type: "test"
type: "test",
id: "foo"
};
const query: WindowElementQuery = {
id: "test",
type: "window-element",
by: {
description
}
};
const SUT = new Window(providerRegistryMock, mockWindowHandle);

// WHEN
await SUT.find(windowElementDescribedBy(description));
await SUT.find(query);

// THEN
expect(elementInspectorMock).toHaveBeenCalledTimes(1);
Expand All @@ -131,12 +139,20 @@ describe("Window class", () => {
});
const mockWindowHandle = 123;
const description: WindowElementDescription = {
type: "test"
type: "test",
id: "foo"
};
const query: WindowElementQuery = {
id: "test",
type: "window-element",
by: {
description
}
};
const SUT = new Window(providerRegistryMock, mockWindowHandle);

// WHEN
await SUT.findAll(windowElementDescribedBy(description));
await SUT.findAll(query);

// THEN
expect(elementInspectorMock).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -240,9 +256,16 @@ describe("Window class", () => {
});
const mockWindowHandle = 123;
const description: WindowElementDescription = {
type: "test"
type: "test",
id: "foo"
};
const query: WindowElementQuery = {
id: "test",
type: "window-element",
by: {
description
}
};
const query = windowElementDescribedBy(description);
const SUT = new Window(providerRegistryMock, mockWindowHandle);
SUT.on(query, hookMock);
SUT.on(query, secondHookMock);
Expand Down Expand Up @@ -281,9 +304,16 @@ describe("Window class", () => {
});
const mockWindowHandle = 123;
const description: WindowElementDescription = {
type: "test"
type: "test",
id: "foo"
};
const query: WindowElementQuery = {
id: "test",
type: "window-element",
by: {
description
}
};
const query = windowElementDescribedBy(description);
const SUT = new Window(providerRegistryMock, mockWindowHandle);
SUT.on(query, hookMock);
SUT.on(query, secondHookMock);
Expand Down

0 comments on commit 17b5c16

Please sign in to comment.