7
7
WindowProviderInterface
8
8
} from "@nut-tree/provider-interfaces" ;
9
9
import { mockPartial } from "sneer" ;
10
- import { Region , RGBA , WindowElement , WindowElementDescription } from "@nut-tree/shared" ;
11
- import { pixelWithColor , windowElementDescribedBy } from "../index" ;
10
+ import { Region , RGBA , WindowElement , WindowElementDescription , WindowElementQuery } from "@nut-tree/shared" ;
11
+ import { pixelWithColor } from "../index" ;
12
12
import { NoopLogProvider } from "./provider/log/noop-log-provider.class" ;
13
13
14
14
jest . setTimeout ( 50000 ) ;
@@ -103,12 +103,20 @@ describe("Window class", () => {
103
103
} ) ;
104
104
const mockWindowHandle = 123 ;
105
105
const description : WindowElementDescription = {
106
- type : "test"
106
+ type : "test" ,
107
+ id : "foo"
108
+ } ;
109
+ const query : WindowElementQuery = {
110
+ id : "test" ,
111
+ type : "window-element" ,
112
+ by : {
113
+ description
114
+ }
107
115
} ;
108
116
const SUT = new Window ( providerRegistryMock , mockWindowHandle ) ;
109
117
110
118
// WHEN
111
- await SUT . find ( windowElementDescribedBy ( description ) ) ;
119
+ await SUT . find ( query ) ;
112
120
113
121
// THEN
114
122
expect ( elementInspectorMock ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -131,12 +139,20 @@ describe("Window class", () => {
131
139
} ) ;
132
140
const mockWindowHandle = 123 ;
133
141
const description : WindowElementDescription = {
134
- type : "test"
142
+ type : "test" ,
143
+ id : "foo"
144
+ } ;
145
+ const query : WindowElementQuery = {
146
+ id : "test" ,
147
+ type : "window-element" ,
148
+ by : {
149
+ description
150
+ }
135
151
} ;
136
152
const SUT = new Window ( providerRegistryMock , mockWindowHandle ) ;
137
153
138
154
// WHEN
139
- await SUT . findAll ( windowElementDescribedBy ( description ) ) ;
155
+ await SUT . findAll ( query ) ;
140
156
141
157
// THEN
142
158
expect ( elementInspectorMock ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -240,9 +256,16 @@ describe("Window class", () => {
240
256
} ) ;
241
257
const mockWindowHandle = 123 ;
242
258
const description : WindowElementDescription = {
243
- type : "test"
259
+ type : "test" ,
260
+ id : "foo"
261
+ } ;
262
+ const query : WindowElementQuery = {
263
+ id : "test" ,
264
+ type : "window-element" ,
265
+ by : {
266
+ description
267
+ }
244
268
} ;
245
- const query = windowElementDescribedBy ( description ) ;
246
269
const SUT = new Window ( providerRegistryMock , mockWindowHandle ) ;
247
270
SUT . on ( query , hookMock ) ;
248
271
SUT . on ( query , secondHookMock ) ;
@@ -281,9 +304,16 @@ describe("Window class", () => {
281
304
} ) ;
282
305
const mockWindowHandle = 123 ;
283
306
const description : WindowElementDescription = {
284
- type : "test"
307
+ type : "test" ,
308
+ id : "foo"
309
+ } ;
310
+ const query : WindowElementQuery = {
311
+ id : "test" ,
312
+ type : "window-element" ,
313
+ by : {
314
+ description
315
+ }
285
316
} ;
286
- const query = windowElementDescribedBy ( description ) ;
287
317
const SUT = new Window ( providerRegistryMock , mockWindowHandle ) ;
288
318
SUT . on ( query , hookMock ) ;
289
319
SUT . on ( query , secondHookMock ) ;
0 commit comments