artes 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -58,7 +58,7 @@ function generateReport() {
58
58
 
59
59
  require("deasync").loopWhile(() => !done);
60
60
 
61
- console.log(`🗜️ Zipped in ${moduleConfig.projectPath}/report.zip!`);
61
+ console.log(`🗜️ Zipped in ${path.join( path.dirname(moduleConfig.reportPath), "report.zip" )}!`);
62
62
  if (error) throw error;
63
63
  }
64
64
  } catch (err) {
@@ -78,7 +78,7 @@ BeforeAll(async () => {
78
78
  pomCollector();
79
79
  });
80
80
 
81
- Before(async function () {
81
+ Before(async function ({pickle}) {
82
82
  context.vars = {};
83
83
 
84
84
  const envFilePath = path.join(
@@ -110,6 +110,7 @@ Before(async function () {
110
110
 
111
111
  if (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
112
112
  await browserContext.tracing.start({
113
+ title: pickle.name,
113
114
  sources: true,
114
115
  screenshots: true,
115
116
  snapshots: true,
@@ -15,41 +15,81 @@ Then("User expects {string} should be attached", async function (selector) {
15
15
  await assert.shouldBeAttached(selector);
16
16
  });
17
17
 
18
+ Then("User expects {int} th of {string} should be attached", async function (order, elements) {
19
+ const nthElement = await frame.nth(elements, order);
20
+ await assert.shouldBeAttached(nthElement);
21
+ });
22
+
18
23
  // Check if a selector should be checked
19
24
  Then("User expects {string} should be checked", async function (selector) {
20
25
  await assert.shouldBeChecked(selector);
21
26
  });
22
27
 
28
+ Then("User expects {int} th of {string} should be checked", async function (order, elements) {
29
+ const nthElement = await frame.nth(elements, order);
30
+ await assert.shouldBeChecked(nthElement);
31
+ });
32
+
23
33
  // Check if a selector should be disabled
24
34
  Then("User expects {string} should be disabled", async function (selector) {
25
35
  await assert.shouldBeDisabled(selector);
26
36
  });
27
37
 
38
+ Then("User expects {int} th of {string} should be disabled", async function (order, elements) {
39
+ const nthElement = await frame.nth(elements, order);
40
+ await assert.shouldBeDisabled(nthElement);
41
+ });
42
+
28
43
  // Check if a selector should be editable
29
44
  Then("User expects {string} should be editable", async function (selector) {
30
45
  await assert.shouldBeEditable(selector);
31
46
  });
32
47
 
48
+ Then("User expects {int} th of {string} should be editable", async function (order, elements) {
49
+ const nthElement = await frame.nth(elements, order);
50
+ await assert.shouldBeEditable(nthElement);
51
+ });
52
+
33
53
  // Check if a selector should be empty
34
54
  Then("User expects {string} should be empty", async function (selector) {
35
55
  await assert.shouldBeEmpty(selector);
36
56
  });
37
57
 
58
+ Then("User expects {int} th of {string} should be empty", async function (order, elements) {
59
+ const nthElement = await frame.nth(elements, order);
60
+ await assert.shouldBeEmpty(nthElement);
61
+ });
62
+
38
63
  // Check if a selector should be enabled
39
64
  Then("User expects {string} should be enabled", async function (selector) {
40
65
  await assert.shouldBeEnabled(selector);
41
66
  });
42
67
 
68
+ Then("User expects {int} th of {string} should be enabled", async function (order, elements) {
69
+ const nthElement = await frame.nth(elements, order);
70
+ await assert.shouldBeEnabled(nthElement);
71
+ });
72
+
43
73
  // Check if a selector should be focused
44
74
  Then("User expects {string} should be focused", async function (selector) {
45
75
  await assert.shouldBeFocused(selector);
46
76
  });
47
77
 
78
+ Then("User expects {int} th of {string} should be focused", async function (order, elements) {
79
+ const nthElement = await frame.nth(elements, order);
80
+ await assert.shouldBeFocused(nthElement);
81
+ });
82
+
48
83
  // Check if a selector should be hidden
49
84
  Then("User expects {string} should be hidden", async function (selector) {
50
85
  await assert.shouldBeHidden(selector);
51
86
  });
52
87
 
88
+ Then("User expects {int} th of {string} should be hidden", async function (order, elements) {
89
+ const nthElement = await frame.nth(elements, order);
90
+ await assert.shouldBeHidden(nthElement);
91
+ });
92
+
53
93
  // Check if a selector should be in the viewport
54
94
  Then(
55
95
  "User expects {string} should be on the screen",
@@ -58,11 +98,29 @@ Then(
58
98
  },
59
99
  );
60
100
 
101
+ Then(
102
+ "User expects {int} th of {string} should be on the screen",
103
+ async function (order, elements) {
104
+ const nthElement = await frame.nth(elements, order);
105
+ await assert.shouldBeInViewport(nthElement);
106
+ },
107
+ );
108
+
109
+ Then("User expects {int} th of {string} should be screen", async function (order, elements) {
110
+ const nthElement = await frame.nth(elements, order);
111
+ await assert.shouldBeInViewport(nthElement);
112
+ });
113
+
61
114
  // Check if a selector should be visible
62
115
  Then("User expects {string} should be visible", async function (selector) {
63
116
  await assert.shouldBeVisible(selector);
64
117
  });
65
118
 
119
+ Then("User expects {int} th of {string} should be visible", async function (order, elements) {
120
+ const nthElement = await frame.nth(elements, order);
121
+ await assert.shouldBeVisible(nthElement);
122
+ });
123
+
66
124
  // Check if a selector should contain specific text
67
125
  Then(
68
126
  "User expects {string} should have {string} text",
@@ -71,6 +129,11 @@ Then(
71
129
  },
72
130
  );
73
131
 
132
+ Then("User expects {int} th of {string} should have {string} text", async function (order, elements, text) {
133
+ const nthElement = await frame.nth(elements, order);
134
+ await assert.shouldContainText(nthElement, text);
135
+ });
136
+
74
137
  Then(
75
138
  "User expects default value of {string} should have {string} text",
76
139
  async (selector, text) => {
@@ -79,6 +142,11 @@ Then(
79
142
  },
80
143
  );
81
144
 
145
+ Then("User expects default value of {int} th of {string} should have {string} text", async function (order, elements, text) {
146
+ const nthElement = await frame.nth(elements, order);
147
+ await assert.toContain(nthElement, text);
148
+ });
149
+
82
150
  Then(
83
151
  "User expects multiple {string} should have {string} text",
84
152
  async (elements, expectedText) => {
@@ -94,6 +162,11 @@ Then(
94
162
  },
95
163
  );
96
164
 
165
+ Then("User expects {int} th of {string} should have {string} description", async function (order, elements, text) {
166
+ const nthElement = await frame.nth(elements, order);
167
+ await assert.shouldHaveAccessibleDescription(nthElement, text);
168
+ });
169
+
97
170
  // Check if a selector should have an accessible name
98
171
  Then(
99
172
  "User expects {string} should have {string} name",
@@ -102,6 +175,11 @@ Then(
102
175
  },
103
176
  );
104
177
 
178
+ Then("User expects {int} th of {string} should have {string} name", async function (order, elements, text) {
179
+ const nthElement = await frame.nth(elements, order);
180
+ await assert.shouldHaveAccessibleName(nthElement, text);
181
+ });
182
+
105
183
  // Check if a selector should have a specific attribute with a given value
106
184
  Then(
107
185
  "User expects {string} should have {string} attribute with {string} value",
@@ -110,6 +188,11 @@ Then(
110
188
  },
111
189
  );
112
190
 
191
+ Then("User expects {int} th of {string} should have {string} attribute with {string} value", async function (order, elements, attribute, value) {
192
+ const nthElement = await frame.nth(elements, order);
193
+ await assert.shouldHaveAttribute(nthElement, attribute, value);
194
+ });
195
+
113
196
  // Check if a selector should have a specific class
114
197
  Then(
115
198
  "User expects {string} should have {string} class",
@@ -118,6 +201,11 @@ Then(
118
201
  },
119
202
  );
120
203
 
204
+ Then("User expects {int} th of {string} should have {string} class", async function (order, elements, className) {
205
+ const nthElement = await frame.nth(elements, order);
206
+ await assert.shouldHaveClass(nthElement, className);
207
+ });
208
+
121
209
  // Check if a selector should have a specific count
122
210
  Then(
123
211
  "User expects count of {string} should be {int}",
@@ -134,6 +222,11 @@ Then(
134
222
  },
135
223
  );
136
224
 
225
+ Then("User expects {int} th of {string} should have {string} CSS property with {string} value", async function (order, elements, property, value) {
226
+ const nthElement = await frame.nth(elements, order);
227
+ await assert.shouldHaveCSS(nthElement, property, value);
228
+ });
229
+
137
230
  // Check if a selector should have a specific id
138
231
  Then(
139
232
  "User expects {string} should have {string} id",
@@ -142,6 +235,11 @@ Then(
142
235
  },
143
236
  );
144
237
 
238
+ Then("User expects {int} th of {string} should have {string} id", async function (order, elements, id) {
239
+ const nthElement = await frame.nth(elements, order);
240
+ await assert.shouldHaveId(nthElement, id);
241
+ });
242
+
145
243
  // Check if a selector should have a specific JavaScript property with a given value
146
244
  Then(
147
245
  "User expects {string} should have {string} JavaScript property with {string} value",
@@ -150,6 +248,11 @@ Then(
150
248
  },
151
249
  );
152
250
 
251
+ Then("User expects {int} th of {string} should have {string} JavaScript property with {string} value", async function (order, elements, property, value) {
252
+ const nthElement = await frame.nth(elements, order);
253
+ await assert.shouldHaveJSProperty(nthElement, property, value);
254
+ });
255
+
153
256
  // Check if a selector should have a specific role
154
257
  Then(
155
258
  "User expects {string} should have {string} role",
@@ -158,6 +261,11 @@ Then(
158
261
  },
159
262
  );
160
263
 
264
+ Then("User expects {int} th of {string} should have {string} role", async function (order, elements, role) {
265
+ const nthElement = await frame.nth(elements, order);
266
+ await assert.shouldHaveId(nthElement, role);
267
+ });
268
+
161
269
  // Check if a selector should have a screenshot
162
270
  Then(
163
271
  "User expects {string} should have a screenshot",
@@ -174,6 +282,11 @@ Then(
174
282
  },
175
283
  );
176
284
 
285
+ Then("User expects {int} th of {string} should match {string} text", async function (order, elements, text) {
286
+ const nthElement = await frame.nth(elements, order);
287
+ await assert.shouldHaveText(nthElement, text);
288
+ });
289
+
177
290
  // Check if a selector should have a specific value
178
291
  Then(
179
292
  "User expects {string} should have {string} value",
@@ -182,6 +295,11 @@ Then(
182
295
  },
183
296
  );
184
297
 
298
+ Then("User expects {int} th of {string} should have {string} value", async function (order, elements, value) {
299
+ const nthElement = await frame.nth(elements, order);
300
+ await assert.shouldHaveValue(nthElement, value);
301
+ });
302
+
185
303
  // Check if a selector should have specific values
186
304
  Then(
187
305
  "User expects {string} should have {string} values",
@@ -209,64 +327,115 @@ Then("User expects to be in {string} page", async function (url) {
209
327
  await assert.shouldPageHaveURL(URL);
210
328
  });
211
329
 
212
- // Check if the response should be OK
213
- Then("The response should be OK", async function (response) {
214
- await assert.shouldResponseBeOK(response);
215
- });
216
-
217
330
  // Check if a selector should not be attached
218
331
  Then("User expects {string} should not be attached", async function (selector) {
219
332
  await assert.shouldNotBeAttached(selector);
220
333
  });
221
334
 
335
+ Then("User expects {int} th of {string} should be not be attached", async function (order, elements) {
336
+ const nthElement = await frame.nth(elements, order);
337
+ await assert.shouldNotBeAttached(nthElement);
338
+ });
339
+
222
340
  // Check if a selector should not be checked
223
341
  Then("User expects {string} should not be checked", async function (selector) {
224
342
  await assert.shouldNotBeChecked(selector);
225
343
  });
226
344
 
345
+ Then("User expects {int} th of {string} should be not be checked", async function (order, elements) {
346
+ const nthElement = await frame.nth(elements, order);
347
+ await assert.shouldNotBeChecked(nthElement);
348
+ });
349
+
227
350
  // Check if a selector should not be disabled
228
351
  Then("User expects {string} should not be disabled", async function (selector) {
229
352
  await assert.shouldNotBeDisabled(selector);
230
353
  });
231
354
 
355
+ Then("User expects {int} th of {string} should be not be disabled", async function (order, elements) {
356
+ const nthElement = await frame.nth(elements, order);
357
+ await assert.shouldNotBeDisabled(nthElement);
358
+ });
359
+
232
360
  // Check if a selector should not be editable
233
361
  Then("User expects {string} should not be editable", async function (selector) {
234
362
  await assert.shouldNotBeEditable(selector);
235
363
  });
236
364
 
365
+ Then("User expects {int} th of {string} should be not be editable", async function (order, elements) {
366
+ const nthElement = await frame.nth(elements, order);
367
+ await assert.shouldNotBeEditable(nthElement);
368
+ });
369
+
237
370
  // Check if a selector should not be empty
238
371
  Then("User expects {string} should not be empty", async function (selector) {
239
372
  await assert.shouldNotBeEmpty(selector);
240
373
  });
241
374
 
375
+ Then("User expects {int} th of {string} should be not be empty", async function (order, elements) {
376
+ const nthElement = await frame.nth(elements, order);
377
+ await assert.shouldNotBeEmpty(nthElement);
378
+ });
379
+
242
380
  // Check if a selector should not be enabled
243
381
  Then("User expects {string} should not be enabled", async function (selector) {
244
382
  await assert.shouldNotBeEnabled(selector);
245
383
  });
246
384
 
385
+ Then("User expects {int} th of {string} should be not be enabled", async function (order, elements) {
386
+ const nthElement = await frame.nth(elements, order);
387
+ await assert.shouldNotBeEnabled(nthElement);
388
+ });
389
+
247
390
  // Check if a selector should not be focused
248
391
  Then("User expects {string} should not be focused", async function (selector) {
249
392
  await assert.shouldNotBeFocused(selector);
250
393
  });
251
394
 
395
+ Then("User expects {int} th of {string} should be not be focused", async function (order, elements) {
396
+ const nthElement = await frame.nth(elements, order);
397
+ await assert.shouldNotBeFocused(nthElement);
398
+ });
399
+
252
400
  // Check if a selector should not be hidden
253
401
  Then("User expects {string} should not be hidden", async function (selector) {
254
402
  await assert.shouldNotBeHidden(selector);
255
403
  });
256
404
 
405
+ Then("User expects {int} th of {string} should be not be hidden", async function (order, elements) {
406
+ const nthElement = await frame.nth(elements, order);
407
+ await assert.shouldNotBeHidden(nthElement);
408
+ });
409
+
257
410
  // Check if a selector should not be in the viewport
258
411
  Then(
259
- "User expects {string} should not be on screen",
412
+ "User expects {string} should not be on the screen",
260
413
  async function (selector) {
261
414
  await assert.shouldNotBeInViewport(selector);
262
415
  },
263
416
  );
264
417
 
418
+ Then(
419
+ "User expects {int} th of {string} should not be on the screen",
420
+ async function (order, elements) {
421
+ const nthElement = await frame.nth(elements, order);
422
+ await assert.shouldNotBeInViewport(nthElement);
423
+ },
424
+ );
425
+
265
426
  // Check if a selector should not be visible
266
427
  Then("User expects {string} should not be visible", async function (selector) {
267
428
  await assert.shouldNotBeVisible(selector);
268
429
  });
269
430
 
431
+ Then(
432
+ "User expects {int} th of {string} should not be visible",
433
+ async function (order, elements) {
434
+ const nthElement = await frame.nth(elements, order);
435
+ await assert.shouldNotBeVisible(nthElement);
436
+ },
437
+ );
438
+
270
439
  // Check if a selector should not contain specific text
271
440
  Then(
272
441
  "User expects {string} should not have {string} text",
@@ -275,6 +444,11 @@ Then(
275
444
  },
276
445
  );
277
446
 
447
+ Then("User expects {int} th of {string} should not have {string} text", async function (order, elements, text) {
448
+ const nthElement = await frame.nth(elements, order);
449
+ await assert.shouldNotContainText(nthElement, text);
450
+ });
451
+
278
452
  // Check if a selector should not have an accessible description
279
453
  Then(
280
454
  "User expects {string} should not have {string} description",
@@ -283,6 +457,11 @@ Then(
283
457
  },
284
458
  );
285
459
 
460
+ Then("User expects {int} th of {string} should not have {string} description", async function (order, elements, text) {
461
+ const nthElement = await frame.nth(elements, order);
462
+ await assert.shouldNotHaveAccessibleDescription(nthElement, text);
463
+ });
464
+
286
465
  // Check if a selector should not have an accessible name
287
466
  Then(
288
467
  "User expects {string} should not have {string} name",
@@ -291,6 +470,11 @@ Then(
291
470
  },
292
471
  );
293
472
 
473
+ Then("User expects {int} th of {string} should not have {string} name", async function (order, elements, text) {
474
+ const nthElement = await frame.nth(elements, order);
475
+ await assert.shouldNotHaveAccessibleName(nthElement, text);
476
+ });
477
+
294
478
  // Check if a selector should not have a specific attribute with a given value
295
479
  Then(
296
480
  "User expects {string} should not have {string} attribute with {string} value",
@@ -299,6 +483,11 @@ Then(
299
483
  },
300
484
  );
301
485
 
486
+ Then("User expects {int} th of {string} should have {string} attribute with {string} value", async function (order, elements, attribute, value) {
487
+ const nthElement = await frame.nth(elements, order);
488
+ await assert.shouldNotHaveAttribute(nthElement, attribute, value);
489
+ });
490
+
302
491
  // Check if a selector should not have a specific class
303
492
  Then(
304
493
  "User expects {string} should not have {string} class",
@@ -307,6 +496,11 @@ Then(
307
496
  },
308
497
  );
309
498
 
499
+ Then("User expects {int} th of {string} should not have {string} class", async function (order, elements, text) {
500
+ const nthElement = await frame.nth(elements, order);
501
+ await assert.shouldNotHaveClass(nthElement, text);
502
+ });
503
+
310
504
  // Check if a selector should not have a specific count
311
505
  Then(
312
506
  "User expects count of {string} should not be {int}",
@@ -323,6 +517,11 @@ Then(
323
517
  },
324
518
  );
325
519
 
520
+ Then("User expects {int} th of {string} should not have {string} CSS property with {string} value", async function (order, elements, property, value) {
521
+ const nthElement = await frame.nth(elements, order);
522
+ await assert.shouldNotHaveCSS(nthElement, property, value);
523
+ });
524
+
326
525
  // Check if a selector should not have a specific ID
327
526
  Then(
328
527
  "User expects {string} should not have {string} id",
@@ -331,6 +530,11 @@ Then(
331
530
  },
332
531
  );
333
532
 
533
+ Then("User expects {int} th of {string} should not have {string} id", async function (order, elements, text) {
534
+ const nthElement = await frame.nth(elements, order);
535
+ await assert.shouldNotHaveId(nthElement, text);
536
+ });
537
+
334
538
  // Check if a selector should not have a specific JavaScript property with a given value
335
539
  Then(
336
540
  "User expects {string} should not have {string} JavaScript property with {string} value",
@@ -339,6 +543,11 @@ Then(
339
543
  },
340
544
  );
341
545
 
546
+ Then("User expects {int} th of {string} should not have {string} JavaScript property with {string} value", async function (order, elements, property, value) {
547
+ const nthElement = await frame.nth(elements, order);
548
+ await assert.shouldNotHaveJSProperty(nthElement, property, value);
549
+ });
550
+
342
551
  // Check if a selector should not have a specific role
343
552
  Then(
344
553
  "User expects {string} should not have {string} role",
@@ -347,6 +556,11 @@ Then(
347
556
  },
348
557
  );
349
558
 
559
+ Then("User expects {int} th of {string} should not have {string} role", async function (order, elements, text) {
560
+ const nthElement = await frame.nth(elements, order);
561
+ await assert.shouldNotHaveRole(nthElement, text);
562
+ });
563
+
350
564
  // Check if a selector should not have specific text
351
565
  Then(
352
566
  "User expects {string} should not match {string} text",
@@ -355,6 +569,11 @@ Then(
355
569
  },
356
570
  );
357
571
 
572
+ Then("User expects {int} th of {string} should not have {string} text", async function (order, elements, text) {
573
+ const nthElement = await frame.nth(elements, order);
574
+ await assert.shouldNotHaveText(nthElement, text);
575
+ });
576
+
358
577
  // Check if a selector should not have a specific value
359
578
  Then(
360
579
  "User expects {string} should not have {string} value",
@@ -363,6 +582,11 @@ Then(
363
582
  },
364
583
  );
365
584
 
585
+ Then("User expects {int} th of {string} should not have {string} value", async function (order, elements, text) {
586
+ const nthElement = await frame.nth(elements, order);
587
+ await assert.shouldNotHaveValue(nthElement, text);
588
+ });
589
+
366
590
  // Check if a selector should not have specific values
367
591
  Then(
368
592
  "User expects {string} should not have {string} values",
@@ -3,6 +3,7 @@ const {
3
3
  element,
4
4
  selector,
5
5
  context,
6
+ resolveVariable
6
7
  } = require("../helper/imports/commons");
7
8
  const { mouse, frame, page } = require("../helper/stepFunctions/exporter");
8
9
 
@@ -39,6 +40,8 @@ When("User clicks {string} with force", async function (selector) {
39
40
  When(
40
41
  "User clicks {string} at {int}, {int} position",
41
42
  async function (selector, x, y) {
43
+ x = await resolveVariable(x)
44
+ y = await resolveVariable(y)
42
45
  await mouse.click(selector, { position: { x: x, y: y } });
43
46
  },
44
47
  );
@@ -47,12 +50,16 @@ When(
47
50
  When(
48
51
  "User clicks {string} at {int}, {int} position with force",
49
52
  async function (selector, x, y) {
53
+ x = await resolveVariable(x)
54
+ y = await resolveVariable(y)
50
55
  await mouse.click(selector, { force: true, position: { x: x, y: y } });
51
56
  },
52
57
  );
53
58
 
54
59
  // User clicks at specific coordinates
55
60
  When("User clicks at {int}, {int} coordinates", async function (x, y) {
61
+ x = await resolveVariable(x)
62
+ y = await resolveVariable(y)
56
63
  await context.page.click({ position: { x: x, y: y } });
57
64
  });
58
65
 
@@ -60,6 +67,8 @@ When("User clicks at {int}, {int} coordinates", async function (x, y) {
60
67
  When(
61
68
  "User clicks at {int}, {int} coordinates with click count {int} and delay {int}",
62
69
  async function (x, y, clickCount, delay) {
70
+ x = await resolveVariable(x)
71
+ y = await resolveVariable(y)
63
72
  await context.page.click({
64
73
  position: { x: x, y: y },
65
74
  clickCount: clickCount,
@@ -72,6 +81,8 @@ When(
72
81
  When(
73
82
  "User clicks at {int}, {int} coordinates with force",
74
83
  async function (x, y) {
84
+ x = await resolveVariable(x)
85
+ y = await resolveVariable(y)
75
86
  context.page.click({ position: { x: x, y: y }, force: true });
76
87
  },
77
88
  );
@@ -139,6 +150,8 @@ When("User double clicks {string} with force", async function (selector) {
139
150
  When(
140
151
  "User double clicks {string} at {int}, {int} position",
141
152
  async function (selector, x, y) {
153
+ x = await resolveVariable(x)
154
+ y = await resolveVariable(y)
142
155
  await mouse.doubleClick(selector, { position: { x: x, y: y } });
143
156
  },
144
157
  );
@@ -147,6 +160,8 @@ When(
147
160
  When(
148
161
  "User double clicks {string} at {int}, {int} position with force",
149
162
  async function (selector, x, y) {
163
+ x = await resolveVariable(x)
164
+ y = await resolveVariable(y)
150
165
  await mouse.doubleClick(selector, {
151
166
  position: { x: x, y: y },
152
167
  force: true,
@@ -156,6 +171,8 @@ When(
156
171
 
157
172
  // User double clicks at specific coordinates
158
173
  When("User double clicks at {int}, {int} coordinates", async function (x, y) {
174
+ x = await resolveVariable(x)
175
+ y = await resolveVariable(y)
159
176
  await context.page.doubleClick({ position: { x: x, y: y } });
160
177
  });
161
178
 
@@ -163,6 +180,8 @@ When("User double clicks at {int}, {int} coordinates", async function (x, y) {
163
180
  When(
164
181
  "User double clicks at {int}, {int} coordinates with click count {int} and delay {int}",
165
182
  async function (x, y, clickCount, delay) {
183
+ x = await resolveVariable(x)
184
+ y = await resolveVariable(y)
166
185
  await context.page.doubleClick({
167
186
  position: { x: x, y: y },
168
187
  clickCount: clickCount,
@@ -175,12 +194,16 @@ When(
175
194
  When(
176
195
  "User double clicks at {int}, {int} coordinates with force",
177
196
  async function (x, y) {
197
+ x = await resolveVariable(x)
198
+ y = await resolveVariable(y)
178
199
  await context.page.doubleClick({ position: { x: x, y: y }, force: true });
179
200
  },
180
201
  );
181
202
 
182
203
  // User moves the mouse to specific coordinates
183
204
  When("User moves to {int}, {int} coordinates", async function (x, y) {
205
+ x = await resolveVariable(x)
206
+ y = await resolveVariable(y)
184
207
  await context.page.move({ position: { x: x, y: y } });
185
208
  });
186
209
 
@@ -188,6 +211,8 @@ When("User moves to {int}, {int} coordinates", async function (x, y) {
188
211
  When(
189
212
  "User scrolls the mouse wheel at {int}, {int} coordinates",
190
213
  async function (x, y) {
214
+ x = await resolveVariable(x)
215
+ y = await resolveVariable(y)
191
216
  await context.page.wheel({ position: { x: x, y: y } });
192
217
  },
193
218
  );
@@ -206,6 +231,8 @@ When("User hovers over {string} with force", async function (selector) {
206
231
  When(
207
232
  "User hovers over {string} at {int}, {int} position",
208
233
  async function (selector, x, y) {
234
+ x = await resolveVariable(x)
235
+ y = await resolveVariable(y)
209
236
  await mouse.hover(selector, { position: { x: x, y: y } });
210
237
  },
211
238
  );
@@ -214,6 +241,8 @@ When(
214
241
  When(
215
242
  "User hovers over {string} at {int}, {int} position with force",
216
243
  async function (selector, x, y) {
244
+ x = await resolveVariable(x)
245
+ y = await resolveVariable(y)
217
246
  await mouse.hover(selector, { position: { x: x, y: y }, force: true });
218
247
  },
219
248
  );
@@ -232,6 +261,8 @@ When("User focuses on {string} with force", async function (selector) {
232
261
  When(
233
262
  "User focuses on {string} at {int}, {int} position",
234
263
  async function (selector, x, y) {
264
+ x = await resolveVariable(x)
265
+ y = await resolveVariable(y)
235
266
  await mouse.focus(selector, { position: { x: x, y: y } });
236
267
  },
237
268
  );
@@ -240,6 +271,8 @@ When(
240
271
  When(
241
272
  "User focuses on {string} at {int}, {int} position with force",
242
273
  async function (selector, x, y) {
274
+ x = await resolveVariable(x)
275
+ y = await resolveVariable(y)
243
276
  await mouse.focus(selector, { position: { x: x, y: y }, force: true });
244
277
  },
245
278
  );
@@ -256,6 +289,8 @@ When(
256
289
  When(
257
290
  "User drags {string} to {int}, {int} position",
258
291
  async function (sourceSelector, x, y) {
292
+ x = await resolveVariable(x)
293
+ y = await resolveVariable(y)
259
294
  await mouse.dragAndDrop(sourceSelector, { position: { x: x, y: y } });
260
295
  },
261
296
  );