artes 1.0.86 → 1.0.88

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.
Files changed (38) hide show
  1. package/README.md +367 -366
  2. package/cucumber.config.js +136 -120
  3. package/docs/functionDefinitions.md +2401 -2401
  4. package/docs/stepDefinitions.md +352 -352
  5. package/executer.js +108 -106
  6. package/index.js +46 -46
  7. package/package.json +50 -50
  8. package/src/helper/contextManager/browserManager.js +71 -70
  9. package/src/helper/contextManager/requestManager.js +30 -30
  10. package/src/helper/executers/cleaner.js +19 -19
  11. package/src/helper/executers/exporter.js +15 -15
  12. package/src/helper/executers/helper.js +77 -74
  13. package/src/helper/executers/projectCreator.js +164 -163
  14. package/src/helper/executers/reportGenerator.js +25 -25
  15. package/src/helper/executers/testRunner.js +30 -30
  16. package/src/helper/executers/versionChecker.js +14 -13
  17. package/src/helper/imports/commons.js +52 -52
  18. package/src/helper/pomController/elementController.js +144 -144
  19. package/src/helper/pomController/pomCollector.js +20 -20
  20. package/src/helper/stepFunctions/APIActions.js +313 -313
  21. package/src/helper/stepFunctions/assertions.js +523 -523
  22. package/src/helper/stepFunctions/browserActions.js +21 -21
  23. package/src/helper/stepFunctions/elementInteractions.js +38 -38
  24. package/src/helper/stepFunctions/exporter.js +19 -19
  25. package/src/helper/stepFunctions/frameActions.js +50 -50
  26. package/src/helper/stepFunctions/keyboardActions.js +41 -41
  27. package/src/helper/stepFunctions/mouseActions.js +145 -145
  28. package/src/helper/stepFunctions/pageActions.js +27 -27
  29. package/src/hooks/context.js +15 -15
  30. package/src/hooks/hooks.js +157 -157
  31. package/src/stepDefinitions/API.steps.js +252 -252
  32. package/src/stepDefinitions/assertions.steps.js +826 -826
  33. package/src/stepDefinitions/browser.steps.js +7 -7
  34. package/src/stepDefinitions/frameActions.steps.js +76 -76
  35. package/src/stepDefinitions/keyboardActions.steps.js +95 -87
  36. package/src/stepDefinitions/mouseActions.steps.js +256 -256
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +31 -31
@@ -1,826 +1,826 @@
1
- const {
2
- Then,
3
- selector,
4
- expect,
5
- element,
6
- extractVarsFromResponse,
7
- context,
8
- } = require("../helper/imports/commons");
9
- const { assert, frame } = require("../helper/stepFunctions/exporter");
10
-
11
- // Check if a selector should be attached
12
- Then("User expects {string} should be attached", async function (selector) {
13
- await assert.shouldBeAttached(selector);
14
- });
15
-
16
- // Check if a selector should be checked
17
- Then("User expects {string} should be checked", async function (selector) {
18
- await assert.shouldBeChecked(selector);
19
- });
20
-
21
- // Check if a selector should be disabled
22
- Then("User expects {string} should be disabled", async function (selector) {
23
- await assert.shouldBeDisabled(selector);
24
- });
25
-
26
- // Check if a selector should be editable
27
- Then("User expects {string} should be editable", async function (selector) {
28
- await assert.shouldBeEditable(selector);
29
- });
30
-
31
- // Check if a selector should be empty
32
- Then("User expects {string} should be empty", async function (selector) {
33
- await assert.shouldBeEmpty(selector);
34
- });
35
-
36
- // Check if a selector should be enabled
37
- Then("User expects {string} should be enabled", async function (selector) {
38
- await assert.shouldBeEnabled(selector);
39
- });
40
-
41
- // Check if a selector should be focused
42
- Then("User expects {string} should be focused", async function (selector) {
43
- await assert.shouldBeFocused(selector);
44
- });
45
-
46
- // Check if a selector should be hidden
47
- Then("User expects {string} should be hidden", async function (selector) {
48
- await assert.shouldBeHidden(selector);
49
- });
50
-
51
- // Check if a selector should be in the viewport
52
- Then(
53
- "User expects {string} should be on the screen",
54
- async function (selector) {
55
- await assert.shouldBeInViewport(selector);
56
- },
57
- );
58
-
59
- // Check if a selector should be visible
60
- Then("User expects {string} should be visible", async function (selector) {
61
- await assert.shouldBeVisible(selector);
62
- });
63
-
64
- // Check if a selector should contain specific text
65
- Then(
66
- "User expects {string} should have {string} text",
67
- async function (selector, text) {
68
- await assert.shouldContainText(selector, text);
69
- },
70
- );
71
-
72
- Then(
73
- "User expects default value of {string} should have {string} text",
74
- async (selector, text) => {
75
- const defaultValue = await element(selector).inputValue();
76
- await expect(defaultValue).toContain(text);
77
- },
78
- );
79
-
80
- Then(
81
- "User expects multiple {string} should have {string} text",
82
- async (elements, expectedText) => {
83
- await assert.multipleElementsShouldContainText(elements, expectedText);
84
- },
85
- );
86
-
87
- // Check if a selector should have an accessible description
88
- Then(
89
- "User expects {string} should have {string} description",
90
- async function (selector, description) {
91
- await assert.shouldHaveAccessibleDescription(selector, description);
92
- },
93
- );
94
-
95
- // Check if a selector should have an accessible name
96
- Then(
97
- "User expects {string} should have {string} name",
98
- async function (selector, name) {
99
- await assert.shouldHaveAccessibleName(selector, name);
100
- },
101
- );
102
-
103
- // Check if a selector should have a specific attribute with a given value
104
- Then(
105
- "User expects {string} should have {string} attribute with {string} value",
106
- async function (selector, attribute, value) {
107
- await assert.shouldHaveAttribute(selector, attribute, value);
108
- },
109
- );
110
-
111
- // Check if a selector should have a specific class
112
- Then(
113
- "User expects {string} should have {string} class",
114
- async function (selector, className) {
115
- await assert.shouldHaveClass(selector, className);
116
- },
117
- );
118
-
119
- // Check if a selector should have a specific count
120
- Then(
121
- "User expects count of {string} should be {int}",
122
- async function (selector, count) {
123
- await assert.shouldHaveCount(selector, count);
124
- },
125
- );
126
-
127
- // Check if a selector should have a specific CSS property with a given value
128
- Then(
129
- "User expects {string} should have {string} CSS property with {string} value",
130
- async function (selector, property, value) {
131
- await assert.shouldHaveCSS(selector, property, value);
132
- },
133
- );
134
-
135
- // Check if a selector should have a specific id
136
- Then(
137
- "User expects {string} should have {string} id",
138
- async function (selector, id) {
139
- await assert.shouldHaveId(selector, id);
140
- },
141
- );
142
-
143
- // Check if a selector should have a specific JavaScript property with a given value
144
- Then(
145
- "User expects {string} should have {string} JavaScript property with {string} value",
146
- async function (selector, property, value) {
147
- await assert.shouldHaveJSProperty(selector, property, value);
148
- },
149
- );
150
-
151
- // Check if a selector should have a specific role
152
- Then(
153
- "User expects {string} should have {string} role",
154
- async function (selector, role) {
155
- await assert.shouldHaveRole(selector, role);
156
- },
157
- );
158
-
159
- // Check if a selector should have a screenshot
160
- Then(
161
- "User expects {string} should have a screenshot",
162
- async function (selector) {
163
- await assert.shouldHaveScreenshot(selector);
164
- },
165
- );
166
-
167
- // Check if a selector should have specific text
168
- Then(
169
- "User expects {string} should match {string} text",
170
- async function (selector, text) {
171
- await assert.shouldHaveText(selector, text);
172
- },
173
- );
174
-
175
- // Check if a selector should have a specific value
176
- Then(
177
- "User expects {string} should have {string} value",
178
- async function (selector, value) {
179
- await assert.shouldHaveValue(selector, value);
180
- },
181
- );
182
-
183
- // Check if a selector should have specific values
184
- Then(
185
- "User expects {string} should have {string} values",
186
- async function (selector, values) {
187
- await assert.shouldHaveValues(selector, values.split(","));
188
- },
189
- );
190
-
191
- // Check if the page should have a screenshot
192
- Then("User expects the page should have a screenshot", async function () {
193
- await assert.shouldPageHaveScreenshot();
194
- });
195
-
196
- // Check if the page should have a specific title
197
- Then(
198
- "User expects the page should have {string} title",
199
- async function (title) {
200
- await assert.shouldPageHaveTitle(title);
201
- },
202
- );
203
-
204
- // Check if the page should have a specific URL
205
- Then("User expects to be in {string} page", async function (url) {
206
- const URL = await selector(url);
207
- await assert.shouldPageHaveURL(URL);
208
- });
209
-
210
- // Check if the response should be OK
211
- Then("The response should be OK", async function (response) {
212
- await assert.shouldResponseBeOK(response);
213
- });
214
-
215
- // Check if a selector should not be attached
216
- Then("User expects {string} should not be attached", async function (selector) {
217
- await assert.shouldNotBeAttached(selector);
218
- });
219
-
220
- // Check if a selector should not be checked
221
- Then("User expects {string} should not be checked", async function (selector) {
222
- await assert.shouldNotBeChecked(selector);
223
- });
224
-
225
- // Check if a selector should not be disabled
226
- Then("User expects {string} should not be disabled", async function (selector) {
227
- await assert.shouldNotBeDisabled(selector);
228
- });
229
-
230
- // Check if a selector should not be editable
231
- Then("User expects {string} should not be editable", async function (selector) {
232
- await assert.shouldNotBeEditable(selector);
233
- });
234
-
235
- // Check if a selector should not be empty
236
- Then("User expects {string} should not be empty", async function (selector) {
237
- await assert.shouldNotBeEmpty(selector);
238
- });
239
-
240
- // Check if a selector should not be enabled
241
- Then("User expects {string} should not be enabled", async function (selector) {
242
- await assert.shouldNotBeEnabled(selector);
243
- });
244
-
245
- // Check if a selector should not be focused
246
- Then("User expects {string} should not be focused", async function (selector) {
247
- await assert.shouldNotBeFocused(selector);
248
- });
249
-
250
- // Check if a selector should not be hidden
251
- Then("User expects {string} should not be hidden", async function (selector) {
252
- await assert.shouldNotBeHidden(selector);
253
- });
254
-
255
- // Check if a selector should not be in the viewport
256
- Then(
257
- "User expects {string} should not be on screen",
258
- async function (selector) {
259
- await assert.shouldNotBeInViewport(selector);
260
- },
261
- );
262
-
263
- // Check if a selector should not be visible
264
- Then("User expects {string} should not be visible", async function (selector) {
265
- await assert.shouldNotBeVisible(selector);
266
- });
267
-
268
- // Check if a selector should not contain specific text
269
- Then(
270
- "User expects {string} should not have {string} text",
271
- async function (selector, text) {
272
- await assert.shouldNotContainText(selector, text);
273
- },
274
- );
275
-
276
- // Check if a selector should not have an accessible description
277
- Then(
278
- "User expects {string} should not have {string} description",
279
- async function (selector, description) {
280
- await assert.shouldNotHaveAccessibleDescription(selector, description);
281
- },
282
- );
283
-
284
- // Check if a selector should not have an accessible name
285
- Then(
286
- "User expects {string} should not have {string} name",
287
- async function (selector, name) {
288
- await assert.shouldNotHaveAccessibleName(selector, name);
289
- },
290
- );
291
-
292
- // Check if a selector should not have a specific attribute with a given value
293
- Then(
294
- "User expects {string} should not have {string} attribute with {string} value",
295
- async function (selector, attribute, value) {
296
- await assert.shouldNotHaveAttribute(selector, attribute, value);
297
- },
298
- );
299
-
300
- // Check if a selector should not have a specific class
301
- Then(
302
- "User expects {string} should not have {string} class",
303
- async function (selector, className) {
304
- await assert.shouldNotHaveClass(selector, className);
305
- },
306
- );
307
-
308
- // Check if a selector should not have a specific count
309
- Then(
310
- "User expects count of {string} should not be {int}",
311
- async function (selector, count) {
312
- await assert.shouldNotHaveCount(selector, count);
313
- },
314
- );
315
-
316
- // Check if a selector should not have a specific CSS property with a given value
317
- Then(
318
- "User expects {string} should not have {string} CSS property with {string} value",
319
- async function (selector, property, value) {
320
- await assert.shouldNotHaveCSS(selector, property, value);
321
- },
322
- );
323
-
324
- // Check if a selector should not have a specific ID
325
- Then(
326
- "User expects {string} should not have {string} id",
327
- async function (selector, id) {
328
- await assert.shouldNotHaveId(selector, id);
329
- },
330
- );
331
-
332
- // Check if a selector should not have a specific JavaScript property with a given value
333
- Then(
334
- "User expects {string} should not have {string} JavaScript property with {string} value",
335
- async function (selector, property, value) {
336
- await assert.shouldNotHaveJSProperty(selector, property, value);
337
- },
338
- );
339
-
340
- // Check if a selector should not have a specific role
341
- Then(
342
- "User expects {string} should not have {string} role",
343
- async function (selector, role) {
344
- await assert.shouldNotHaveRole(selector, role);
345
- },
346
- );
347
-
348
- // Check if a selector should not have specific text
349
- Then(
350
- "User expects {string} should not match {string} text",
351
- async function (selector, text) {
352
- await assert.shouldNotHaveText(selector, text);
353
- },
354
- );
355
-
356
- // Check if a selector should not have a specific value
357
- Then(
358
- "User expects {string} should not have {string} value",
359
- async function (selector, value) {
360
- await assert.shouldNotHaveValue(selector, value);
361
- },
362
- );
363
-
364
- // Check if a selector should not have specific values
365
- Then(
366
- "User expects {string} should not have {string} values",
367
- async function (selector, values) {
368
- await assert.shouldNotHaveValues(selector, values.split(","));
369
- },
370
- );
371
-
372
- // Check if the page should not have a screenshot
373
- Then("User expects the page should not have a screenshot", async function () {
374
- await assert.shouldNotPageHaveScreenshot();
375
- });
376
-
377
- // Check if the page should not have a specific title
378
- Then(
379
- "User expects the page should not have {string} title",
380
- async function (title) {
381
- await assert.shouldNotPageHaveTitle(title);
382
- },
383
- );
384
-
385
- // Check if the page should not have a specific URL
386
- Then("User expects the page url should not be {string}", async function (url) {
387
- await assert.shouldNotPageHaveURL(url);
388
- });
389
-
390
- Then("User is not on {string} page", async function (url) {
391
- await assert.shouldNotPageHaveURL(url);
392
- });
393
-
394
- // Check if a response should not be OK
395
- Then("The response should not be OK", async function (response) {
396
- await assert.shouldNotResponseBeOK(response);
397
- });
398
-
399
- // Check if a selector's value should be equal to the expected value
400
- Then(
401
- "User expects {string} should be {string} text",
402
- async function (selector, expected) {
403
- await assert.shouldBe(selector, expected);
404
- },
405
- );
406
-
407
- // Check if a selector's value should be close to the expected value within a precision
408
- Then(
409
- "User expects {string} should be close to {float} with precision {int}",
410
- async function (selector, expected, precision) {
411
- await assert.shouldBeCloseTo(selector, expected, precision);
412
- },
413
- );
414
-
415
- // Check if a selector's value should be defined
416
- Then("User expects {string} should be defined", async function (selector) {
417
- await assert.shouldBeDefined(selector);
418
- });
419
-
420
- // Check if a selector's text content should be falsy
421
- Then("User expects {string} should be falsy", async function (selector) {
422
- await assert.shouldBeFalsy(selector);
423
- });
424
-
425
- // Check if a selector's value should be greater than the expected value
426
- Then(
427
- "User expects {string} should be greater than {float}",
428
- async function (selector, expected) {
429
- await assert.shouldBeGreaterThan(selector, expected);
430
- },
431
- );
432
-
433
- // Check if a selector's value should be greater than or equal to the expected value
434
- Then(
435
- "User expects {string} should be greater than or equal to {float}",
436
- async function (selector, expected) {
437
- await assert.shouldBeGreaterThanOrEqual(selector, expected);
438
- },
439
- );
440
-
441
- // Check if a selector's value should be an instance of a specific constructor
442
- Then(
443
- "User expects {string} should be an instance of {string}",
444
- async function (selector, constructor) {
445
- await assert.shouldBeInstanceOf(selector, constructor);
446
- },
447
- );
448
-
449
- // Check if a selector's value should be less than the expected value
450
- Then(
451
- "User expects {string} should be less than {float}",
452
- async function (selector, expected) {
453
- await assert.shouldBeLessThan(selector, expected);
454
- },
455
- );
456
-
457
- // Check if a selector's value should be less than or equal to the expected value
458
- Then(
459
- "User expects {string} should be less than or equal to {float}",
460
- async function (selector, expected) {
461
- await assert.shouldBeLessThanOrEqual(selector, expected);
462
- },
463
- );
464
-
465
- // Check if a selector's value should be NaN
466
- Then("User expects {string} should be NaN", async function (selector) {
467
- await assert.shouldBeNaN(selector);
468
- });
469
-
470
- // Check if a selector's value should be null
471
- Then("User expects {string} should be null", async function (selector) {
472
- await assert.shouldBeNull(selector);
473
- });
474
-
475
- // Check if a selector's value should be truthy
476
- Then("User expects {string} should be truthy", async function (selector) {
477
- await assert.shouldBeTruthy(selector);
478
- });
479
-
480
- // Check if a selector's value should be undefined
481
- Then("User expects {string} should be undefined", async function (selector) {
482
- await assert.shouldBeUndefined(selector);
483
- });
484
-
485
- // Check if a selector's value should contain a specific substring
486
- Then(
487
- "User expects {string} should have {string} substring",
488
- async function (selector, substring) {
489
- await assert.shouldContain(selector, substring);
490
- },
491
- );
492
-
493
- // Check if a selector's value should contain an equal value
494
- Then(
495
- "User expects {string} should contain equal {string}",
496
- async function (selector, expected) {
497
- await assert.shouldContainEqual(selector, expected);
498
- },
499
- );
500
-
501
- // Check if a selector's value should equal the expected value
502
- Then(
503
- "User expects {string} should equal {int}",
504
- async function (selector, expected) {
505
- await assert.shouldEqual(selector, expected);
506
- },
507
- );
508
-
509
- // Check if a selector's text content should have a specific length
510
- Then(
511
- "User expects length of {string} should be {int}",
512
- async function (selector, length) {
513
- await assert.shouldHaveLength(selector, length);
514
- },
515
- );
516
-
517
- // Check if a selector's text content should have a specific property
518
- Then(
519
- "User expects {string} should have {string} property",
520
- async function (selector, property) {
521
- await assert.shouldHaveProperty(selector, property);
522
- },
523
- );
524
-
525
- // Check if a selector's text content should match a specific regex
526
- Then(
527
- "User expects {string} should match {string} regex",
528
- async function (selector, regex) {
529
- await assert.shouldMatch(selector, new RegExp(regex));
530
- },
531
- );
532
-
533
- // Check if a selector's text content should match a specific object
534
- Then(
535
- "User expects {string} should match {string} object",
536
- async function (selector, object) {
537
- await assert.shouldMatchObject(selector, JSON.parse(object));
538
- },
539
- );
540
-
541
- // Check if a selector's text content should strictly equal the expected value
542
- Then(
543
- "User expects {string} should strictly equal {string}",
544
- async function (selector, expected) {
545
- await assert.shouldStrictEqual(selector, expected);
546
- },
547
- );
548
-
549
- // Check if a async function should throw an error
550
- Then("The async function should throw", async function (fn) {
551
- await assert.shouldThrow(fn);
552
- });
553
-
554
- // Check if the text content of a selector should be an instance of a specific constructor
555
- Then(
556
- "User expects {string} should be any instance of {string}",
557
- async function (selector, constructor) {
558
- await assert.shouldAny(selector, constructor);
559
- },
560
- );
561
-
562
- // Check if the text content of a selector may be anything (truthy)
563
- Then("User expects {string} may be anything", async function (selector) {
564
- await assert.shouldAnything(selector);
565
- });
566
-
567
- // Check if the text content of a selector should contain any of the specified elements in an array
568
- Then(
569
- "User expects {string} should contain {string} array elements",
570
- async function (selector, elements) {
571
- const parsedElements = elements.split(",");
572
- await assert.shouldArrayContaining(selector, parsedElements);
573
- },
574
- );
575
-
576
- // Check if the text content of a selector should be close to the expected value within a precision
577
- Then(
578
- "User expects {string} should be close to {float} with precision {int}",
579
- async function (selector, expected, precision) {
580
- await assert.shouldCloseTo(selector, expected, precision);
581
- },
582
- );
583
-
584
- // Check if the text content of a selector should contain the specified properties in an object
585
- Then(
586
- "User expects {string} should contain {string} object properties",
587
- async function (selector, properties) {
588
- const parsedProperties = properties.split(",");
589
- await assert.shouldObjectContaining(selector, parsedProperties);
590
- },
591
- );
592
-
593
- // Check if the text content of a selector should contain a specific substring
594
- Then(
595
- "User expects {string} should have {string} substring",
596
- async function (selector, substring) {
597
- await assert.shouldStringContaining(selector, substring);
598
- },
599
- );
600
-
601
- // Check if the text content of a selector should match a specific regex
602
- Then(
603
- "User expects {string} should match {string} regex",
604
- async function (selector, regex) {
605
- await assert.shouldStringMatching(selector, new RegExp(regex));
606
- },
607
- );
608
-
609
- // Check if a selector's text content should not be equal to the expected value
610
- Then(
611
- "User expects {string} should not be {string} text",
612
- async function (selector, expected) {
613
- await assert.shouldNotBe(selector, expected);
614
- },
615
- );
616
-
617
- // Check if a selector's text content should not be close to the expected value within a precision
618
- Then(
619
- "User expects {string} should not be close to {float} with precision {int}",
620
- async function (selector, expected, precision) {
621
- await assert.shouldNotBeCloseTo(selector, expected, precision);
622
- },
623
- );
624
-
625
- // Check if a selector's text content should not be defined
626
- Then("User expects {string} should not be defined", async function (selector) {
627
- await assert.shouldNotBeDefined(selector);
628
- });
629
-
630
- // Check if a selector's text content should not be falsy
631
- Then("User expects {string} should not be falsy", async function (selector) {
632
- await assert.shouldNotBeFalsy(selector);
633
- });
634
-
635
- // Check if a selector's text content should not be greater than the expected value
636
- Then(
637
- "User expects {string} should not be greater than {float}",
638
- async function (selector, expected) {
639
- await assert.shouldNotBeGreaterThan(selector, expected);
640
- },
641
- );
642
-
643
- // Check if a selector's text content should not be greater than or equal to the expected value
644
- Then(
645
- "User expects {string} should not be greater than or equal to {float}",
646
- async function (selector, expected) {
647
- await assert.shouldNotBeGreaterThanOrEqual(selector, expected);
648
- },
649
- );
650
-
651
- // Check if a selector's text content should not be an instance of a specific constructor
652
- Then(
653
- "User expects {string} should not be an instance of {string}",
654
- async function (selector, constructor) {
655
- await assert.shouldNotBeInstanceOf(selector, constructor);
656
- },
657
- );
658
-
659
- // Check if a selector's text content should not be less than the expected value
660
- Then(
661
- "User expects {string} should not be less than {float}",
662
- async function (selector, expected) {
663
- await assert.shouldNotBeLessThan(selector, expected);
664
- },
665
- );
666
-
667
- // Check if a selector's text content should not be less than or equal to the expected value
668
- Then(
669
- "User expects {string} should not be less than or equal to {float}",
670
- async function (selector, expected) {
671
- await assert.shouldNotBeLessThanOrEqual(selector, expected);
672
- },
673
- );
674
-
675
- // Check if a selector's text content should not be NaN
676
- Then("User expects {string} should not be NaN", async function (selector) {
677
- await assert.shouldNotBeNaN(selector);
678
- });
679
-
680
- // Check if a selector's text content should not be null
681
- Then("User expects {string} should not be null", async function (selector) {
682
- await assert.shouldNotBeNull(selector);
683
- });
684
-
685
- // Check if a selector's text content should not be truthy
686
- Then("User expects {string} should not be truthy", async function (selector) {
687
- await assert.shouldNotBeTruthy(selector);
688
- });
689
-
690
- // Check if a selector's text content should not be undefined
691
- Then(
692
- "User expects {string} should not be undefined",
693
- async function (selector) {
694
- await assert.shouldNotBeUndefined(selector);
695
- },
696
- );
697
-
698
- // Check if a selector's text content should not contain a specific substring
699
- Then(
700
- "User expects {string} should not have {string} substring",
701
- async function (selector, substring) {
702
- await assert.shouldNotContain(selector, substring);
703
- },
704
- );
705
-
706
- // Check if a selector's text content should not contain an equal value
707
- Then(
708
- "User expects {string} should not contain equal {string}",
709
- async function (selector, expected) {
710
- await assert.shouldNotContainEqual(selector, expected);
711
- },
712
- );
713
-
714
- // Check if a selector's text content should not equal the expected value
715
- Then(
716
- "User expects {string} should not equal {string}",
717
- async function (selector, expected) {
718
- await assert.shouldNotEqual(selector, expected);
719
- },
720
- );
721
-
722
- // Check if a selector's text content should not have a specific length
723
- Then(
724
- "User expects length of {string} should not be {int} ",
725
- async function (selector, length) {
726
- await assert.shouldNotHaveLength(selector, length);
727
- },
728
- );
729
-
730
- // Check if a selector's text content should not have a specific property
731
- Then(
732
- "User expects {string} should not have {string} property",
733
- async function (selector, property) {
734
- await assert.shouldNotHaveProperty(selector, property);
735
- },
736
- );
737
-
738
- // Check if a selector's text content should not match a specific regex
739
- Then(
740
- "User expects {string} should not match {string} regex",
741
- async function (selector, regex) {
742
- await assert.shouldNotMatch(selector, new RegExp(regex));
743
- },
744
- );
745
-
746
- // Check if a selector's text content should not match a specific object
747
- Then(
748
- "User expects {string} should not match {string} object",
749
- async function (selector, object) {
750
- await assert.shouldNotMatchObject(selector, JSON.parse(object));
751
- },
752
- );
753
-
754
- // Check if a async function should not throw an error
755
- Then("The async function should not throw", async function (fn) {
756
- await assert.shouldNotThrow(fn);
757
- });
758
-
759
- // Check if a selector's text content should not be any instance of a specific constructor
760
- Then(
761
- "User expects {string} should not be any instance of {string}",
762
- async function (selector, constructor) {
763
- await assert.shouldNotAny(selector, constructor);
764
- },
765
- );
766
-
767
- // Check if a selector's text content may not be anything (falsy)
768
- Then("User expects {string} may not be anything", async function (selector) {
769
- await assert.shouldNotAnything(selector);
770
- });
771
-
772
- // Check if a selector's text content should not contain any of the specified elements in an array
773
- Then(
774
- "User expects {string} should not contain {string} array elements",
775
- async function (selector, elements) {
776
- const parsedElements = elements.split(",");
777
- await assert.shouldNotArrayContaining(selector, parsedElements);
778
- },
779
- );
780
-
781
- // Check if a selector's text content should not be close to the expected value within a precision
782
- Then(
783
- "User expects {string} should not be close to {float} with precision {int}",
784
- async function (selector, expected, precision) {
785
- await assert.shouldNotCloseTo(selector, expected, precision);
786
- },
787
- );
788
-
789
- // Check if a selector's text content should not contain the specified properties in an object
790
- Then(
791
- "User expects {string} should not contain {string} object properties",
792
- async function (selector, properties) {
793
- const parsedProperties = JSON.parse(properties);
794
- await assert.shouldNotObjectContaining(selector, parsedProperties);
795
- },
796
- );
797
-
798
- // Check if a selector's text content should not contain a specific substring
799
- Then(
800
- "User expects {string} should not contain {string} substring",
801
- async function (selector, substring) {
802
- await assert.shouldNotStringContaining(selector, substring);
803
- },
804
- );
805
-
806
- // Check if a selector's text content should not match a specific regex
807
- Then(
808
- "User expects {string} should not match {string} regex",
809
- async function (selector, regex) {
810
- await assert.shouldNotStringMatching(selector, new RegExp(regex));
811
- },
812
- );
813
-
814
- Then("User expects should have {int} {string}", async (count, elements) => {
815
- const elementCount = await frame.count(elements);
816
- expect(elementCount).toEqual(count);
817
- });
818
-
819
- Then(
820
- "User expects that response has {string} field with {string} value",
821
- async (field, value) => {
822
- extractVarsFromResponse(context.response["Response Body"], field);
823
-
824
- expect(context.vars[field]).toBe(value);
825
- },
826
- );
1
+ const {
2
+ Then,
3
+ selector,
4
+ expect,
5
+ element,
6
+ extractVarsFromResponse,
7
+ context,
8
+ } = require("../helper/imports/commons");
9
+ const { assert, frame } = require("../helper/stepFunctions/exporter");
10
+
11
+ // Check if a selector should be attached
12
+ Then("User expects {string} should be attached", async function (selector) {
13
+ await assert.shouldBeAttached(selector);
14
+ });
15
+
16
+ // Check if a selector should be checked
17
+ Then("User expects {string} should be checked", async function (selector) {
18
+ await assert.shouldBeChecked(selector);
19
+ });
20
+
21
+ // Check if a selector should be disabled
22
+ Then("User expects {string} should be disabled", async function (selector) {
23
+ await assert.shouldBeDisabled(selector);
24
+ });
25
+
26
+ // Check if a selector should be editable
27
+ Then("User expects {string} should be editable", async function (selector) {
28
+ await assert.shouldBeEditable(selector);
29
+ });
30
+
31
+ // Check if a selector should be empty
32
+ Then("User expects {string} should be empty", async function (selector) {
33
+ await assert.shouldBeEmpty(selector);
34
+ });
35
+
36
+ // Check if a selector should be enabled
37
+ Then("User expects {string} should be enabled", async function (selector) {
38
+ await assert.shouldBeEnabled(selector);
39
+ });
40
+
41
+ // Check if a selector should be focused
42
+ Then("User expects {string} should be focused", async function (selector) {
43
+ await assert.shouldBeFocused(selector);
44
+ });
45
+
46
+ // Check if a selector should be hidden
47
+ Then("User expects {string} should be hidden", async function (selector) {
48
+ await assert.shouldBeHidden(selector);
49
+ });
50
+
51
+ // Check if a selector should be in the viewport
52
+ Then(
53
+ "User expects {string} should be on the screen",
54
+ async function (selector) {
55
+ await assert.shouldBeInViewport(selector);
56
+ },
57
+ );
58
+
59
+ // Check if a selector should be visible
60
+ Then("User expects {string} should be visible", async function (selector) {
61
+ await assert.shouldBeVisible(selector);
62
+ });
63
+
64
+ // Check if a selector should contain specific text
65
+ Then(
66
+ "User expects {string} should have {string} text",
67
+ async function (selector, text) {
68
+ await assert.shouldContainText(selector, text);
69
+ },
70
+ );
71
+
72
+ Then(
73
+ "User expects default value of {string} should have {string} text",
74
+ async (selector, text) => {
75
+ const defaultValue = await element(selector).inputValue();
76
+ await expect(defaultValue).toContain(text);
77
+ },
78
+ );
79
+
80
+ Then(
81
+ "User expects multiple {string} should have {string} text",
82
+ async (elements, expectedText) => {
83
+ await assert.multipleElementsShouldContainText(elements, expectedText);
84
+ },
85
+ );
86
+
87
+ // Check if a selector should have an accessible description
88
+ Then(
89
+ "User expects {string} should have {string} description",
90
+ async function (selector, description) {
91
+ await assert.shouldHaveAccessibleDescription(selector, description);
92
+ },
93
+ );
94
+
95
+ // Check if a selector should have an accessible name
96
+ Then(
97
+ "User expects {string} should have {string} name",
98
+ async function (selector, name) {
99
+ await assert.shouldHaveAccessibleName(selector, name);
100
+ },
101
+ );
102
+
103
+ // Check if a selector should have a specific attribute with a given value
104
+ Then(
105
+ "User expects {string} should have {string} attribute with {string} value",
106
+ async function (selector, attribute, value) {
107
+ await assert.shouldHaveAttribute(selector, attribute, value);
108
+ },
109
+ );
110
+
111
+ // Check if a selector should have a specific class
112
+ Then(
113
+ "User expects {string} should have {string} class",
114
+ async function (selector, className) {
115
+ await assert.shouldHaveClass(selector, className);
116
+ },
117
+ );
118
+
119
+ // Check if a selector should have a specific count
120
+ Then(
121
+ "User expects count of {string} should be {int}",
122
+ async function (selector, count) {
123
+ await assert.shouldHaveCount(selector, count);
124
+ },
125
+ );
126
+
127
+ // Check if a selector should have a specific CSS property with a given value
128
+ Then(
129
+ "User expects {string} should have {string} CSS property with {string} value",
130
+ async function (selector, property, value) {
131
+ await assert.shouldHaveCSS(selector, property, value);
132
+ },
133
+ );
134
+
135
+ // Check if a selector should have a specific id
136
+ Then(
137
+ "User expects {string} should have {string} id",
138
+ async function (selector, id) {
139
+ await assert.shouldHaveId(selector, id);
140
+ },
141
+ );
142
+
143
+ // Check if a selector should have a specific JavaScript property with a given value
144
+ Then(
145
+ "User expects {string} should have {string} JavaScript property with {string} value",
146
+ async function (selector, property, value) {
147
+ await assert.shouldHaveJSProperty(selector, property, value);
148
+ },
149
+ );
150
+
151
+ // Check if a selector should have a specific role
152
+ Then(
153
+ "User expects {string} should have {string} role",
154
+ async function (selector, role) {
155
+ await assert.shouldHaveRole(selector, role);
156
+ },
157
+ );
158
+
159
+ // Check if a selector should have a screenshot
160
+ Then(
161
+ "User expects {string} should have a screenshot",
162
+ async function (selector) {
163
+ await assert.shouldHaveScreenshot(selector);
164
+ },
165
+ );
166
+
167
+ // Check if a selector should have specific text
168
+ Then(
169
+ "User expects {string} should match {string} text",
170
+ async function (selector, text) {
171
+ await assert.shouldHaveText(selector, text);
172
+ },
173
+ );
174
+
175
+ // Check if a selector should have a specific value
176
+ Then(
177
+ "User expects {string} should have {string} value",
178
+ async function (selector, value) {
179
+ await assert.shouldHaveValue(selector, value);
180
+ },
181
+ );
182
+
183
+ // Check if a selector should have specific values
184
+ Then(
185
+ "User expects {string} should have {string} values",
186
+ async function (selector, values) {
187
+ await assert.shouldHaveValues(selector, values.split(","));
188
+ },
189
+ );
190
+
191
+ // Check if the page should have a screenshot
192
+ Then("User expects the page should have a screenshot", async function () {
193
+ await assert.shouldPageHaveScreenshot();
194
+ });
195
+
196
+ // Check if the page should have a specific title
197
+ Then(
198
+ "User expects the page should have {string} title",
199
+ async function (title) {
200
+ await assert.shouldPageHaveTitle(title);
201
+ },
202
+ );
203
+
204
+ // Check if the page should have a specific URL
205
+ Then("User expects to be in {string} page", async function (url) {
206
+ const URL = await selector(url);
207
+ await assert.shouldPageHaveURL(URL);
208
+ });
209
+
210
+ // Check if the response should be OK
211
+ Then("The response should be OK", async function (response) {
212
+ await assert.shouldResponseBeOK(response);
213
+ });
214
+
215
+ // Check if a selector should not be attached
216
+ Then("User expects {string} should not be attached", async function (selector) {
217
+ await assert.shouldNotBeAttached(selector);
218
+ });
219
+
220
+ // Check if a selector should not be checked
221
+ Then("User expects {string} should not be checked", async function (selector) {
222
+ await assert.shouldNotBeChecked(selector);
223
+ });
224
+
225
+ // Check if a selector should not be disabled
226
+ Then("User expects {string} should not be disabled", async function (selector) {
227
+ await assert.shouldNotBeDisabled(selector);
228
+ });
229
+
230
+ // Check if a selector should not be editable
231
+ Then("User expects {string} should not be editable", async function (selector) {
232
+ await assert.shouldNotBeEditable(selector);
233
+ });
234
+
235
+ // Check if a selector should not be empty
236
+ Then("User expects {string} should not be empty", async function (selector) {
237
+ await assert.shouldNotBeEmpty(selector);
238
+ });
239
+
240
+ // Check if a selector should not be enabled
241
+ Then("User expects {string} should not be enabled", async function (selector) {
242
+ await assert.shouldNotBeEnabled(selector);
243
+ });
244
+
245
+ // Check if a selector should not be focused
246
+ Then("User expects {string} should not be focused", async function (selector) {
247
+ await assert.shouldNotBeFocused(selector);
248
+ });
249
+
250
+ // Check if a selector should not be hidden
251
+ Then("User expects {string} should not be hidden", async function (selector) {
252
+ await assert.shouldNotBeHidden(selector);
253
+ });
254
+
255
+ // Check if a selector should not be in the viewport
256
+ Then(
257
+ "User expects {string} should not be on screen",
258
+ async function (selector) {
259
+ await assert.shouldNotBeInViewport(selector);
260
+ },
261
+ );
262
+
263
+ // Check if a selector should not be visible
264
+ Then("User expects {string} should not be visible", async function (selector) {
265
+ await assert.shouldNotBeVisible(selector);
266
+ });
267
+
268
+ // Check if a selector should not contain specific text
269
+ Then(
270
+ "User expects {string} should not have {string} text",
271
+ async function (selector, text) {
272
+ await assert.shouldNotContainText(selector, text);
273
+ },
274
+ );
275
+
276
+ // Check if a selector should not have an accessible description
277
+ Then(
278
+ "User expects {string} should not have {string} description",
279
+ async function (selector, description) {
280
+ await assert.shouldNotHaveAccessibleDescription(selector, description);
281
+ },
282
+ );
283
+
284
+ // Check if a selector should not have an accessible name
285
+ Then(
286
+ "User expects {string} should not have {string} name",
287
+ async function (selector, name) {
288
+ await assert.shouldNotHaveAccessibleName(selector, name);
289
+ },
290
+ );
291
+
292
+ // Check if a selector should not have a specific attribute with a given value
293
+ Then(
294
+ "User expects {string} should not have {string} attribute with {string} value",
295
+ async function (selector, attribute, value) {
296
+ await assert.shouldNotHaveAttribute(selector, attribute, value);
297
+ },
298
+ );
299
+
300
+ // Check if a selector should not have a specific class
301
+ Then(
302
+ "User expects {string} should not have {string} class",
303
+ async function (selector, className) {
304
+ await assert.shouldNotHaveClass(selector, className);
305
+ },
306
+ );
307
+
308
+ // Check if a selector should not have a specific count
309
+ Then(
310
+ "User expects count of {string} should not be {int}",
311
+ async function (selector, count) {
312
+ await assert.shouldNotHaveCount(selector, count);
313
+ },
314
+ );
315
+
316
+ // Check if a selector should not have a specific CSS property with a given value
317
+ Then(
318
+ "User expects {string} should not have {string} CSS property with {string} value",
319
+ async function (selector, property, value) {
320
+ await assert.shouldNotHaveCSS(selector, property, value);
321
+ },
322
+ );
323
+
324
+ // Check if a selector should not have a specific ID
325
+ Then(
326
+ "User expects {string} should not have {string} id",
327
+ async function (selector, id) {
328
+ await assert.shouldNotHaveId(selector, id);
329
+ },
330
+ );
331
+
332
+ // Check if a selector should not have a specific JavaScript property with a given value
333
+ Then(
334
+ "User expects {string} should not have {string} JavaScript property with {string} value",
335
+ async function (selector, property, value) {
336
+ await assert.shouldNotHaveJSProperty(selector, property, value);
337
+ },
338
+ );
339
+
340
+ // Check if a selector should not have a specific role
341
+ Then(
342
+ "User expects {string} should not have {string} role",
343
+ async function (selector, role) {
344
+ await assert.shouldNotHaveRole(selector, role);
345
+ },
346
+ );
347
+
348
+ // Check if a selector should not have specific text
349
+ Then(
350
+ "User expects {string} should not match {string} text",
351
+ async function (selector, text) {
352
+ await assert.shouldNotHaveText(selector, text);
353
+ },
354
+ );
355
+
356
+ // Check if a selector should not have a specific value
357
+ Then(
358
+ "User expects {string} should not have {string} value",
359
+ async function (selector, value) {
360
+ await assert.shouldNotHaveValue(selector, value);
361
+ },
362
+ );
363
+
364
+ // Check if a selector should not have specific values
365
+ Then(
366
+ "User expects {string} should not have {string} values",
367
+ async function (selector, values) {
368
+ await assert.shouldNotHaveValues(selector, values.split(","));
369
+ },
370
+ );
371
+
372
+ // Check if the page should not have a screenshot
373
+ Then("User expects the page should not have a screenshot", async function () {
374
+ await assert.shouldNotPageHaveScreenshot();
375
+ });
376
+
377
+ // Check if the page should not have a specific title
378
+ Then(
379
+ "User expects the page should not have {string} title",
380
+ async function (title) {
381
+ await assert.shouldNotPageHaveTitle(title);
382
+ },
383
+ );
384
+
385
+ // Check if the page should not have a specific URL
386
+ Then("User expects the page url should not be {string}", async function (url) {
387
+ await assert.shouldNotPageHaveURL(url);
388
+ });
389
+
390
+ Then("User is not on {string} page", async function (url) {
391
+ await assert.shouldNotPageHaveURL(url);
392
+ });
393
+
394
+ // Check if a response should not be OK
395
+ Then("The response should not be OK", async function (response) {
396
+ await assert.shouldNotResponseBeOK(response);
397
+ });
398
+
399
+ // Check if a selector's value should be equal to the expected value
400
+ Then(
401
+ "User expects {string} should be {string} text",
402
+ async function (selector, expected) {
403
+ await assert.shouldBe(selector, expected);
404
+ },
405
+ );
406
+
407
+ // Check if a selector's value should be close to the expected value within a precision
408
+ Then(
409
+ "User expects {string} should be close to {float} with precision {int}",
410
+ async function (selector, expected, precision) {
411
+ await assert.shouldBeCloseTo(selector, expected, precision);
412
+ },
413
+ );
414
+
415
+ // Check if a selector's value should be defined
416
+ Then("User expects {string} should be defined", async function (selector) {
417
+ await assert.shouldBeDefined(selector);
418
+ });
419
+
420
+ // Check if a selector's text content should be falsy
421
+ Then("User expects {string} should be falsy", async function (selector) {
422
+ await assert.shouldBeFalsy(selector);
423
+ });
424
+
425
+ // Check if a selector's value should be greater than the expected value
426
+ Then(
427
+ "User expects {string} should be greater than {float}",
428
+ async function (selector, expected) {
429
+ await assert.shouldBeGreaterThan(selector, expected);
430
+ },
431
+ );
432
+
433
+ // Check if a selector's value should be greater than or equal to the expected value
434
+ Then(
435
+ "User expects {string} should be greater than or equal to {float}",
436
+ async function (selector, expected) {
437
+ await assert.shouldBeGreaterThanOrEqual(selector, expected);
438
+ },
439
+ );
440
+
441
+ // Check if a selector's value should be an instance of a specific constructor
442
+ Then(
443
+ "User expects {string} should be an instance of {string}",
444
+ async function (selector, constructor) {
445
+ await assert.shouldBeInstanceOf(selector, constructor);
446
+ },
447
+ );
448
+
449
+ // Check if a selector's value should be less than the expected value
450
+ Then(
451
+ "User expects {string} should be less than {float}",
452
+ async function (selector, expected) {
453
+ await assert.shouldBeLessThan(selector, expected);
454
+ },
455
+ );
456
+
457
+ // Check if a selector's value should be less than or equal to the expected value
458
+ Then(
459
+ "User expects {string} should be less than or equal to {float}",
460
+ async function (selector, expected) {
461
+ await assert.shouldBeLessThanOrEqual(selector, expected);
462
+ },
463
+ );
464
+
465
+ // Check if a selector's value should be NaN
466
+ Then("User expects {string} should be NaN", async function (selector) {
467
+ await assert.shouldBeNaN(selector);
468
+ });
469
+
470
+ // Check if a selector's value should be null
471
+ Then("User expects {string} should be null", async function (selector) {
472
+ await assert.shouldBeNull(selector);
473
+ });
474
+
475
+ // Check if a selector's value should be truthy
476
+ Then("User expects {string} should be truthy", async function (selector) {
477
+ await assert.shouldBeTruthy(selector);
478
+ });
479
+
480
+ // Check if a selector's value should be undefined
481
+ Then("User expects {string} should be undefined", async function (selector) {
482
+ await assert.shouldBeUndefined(selector);
483
+ });
484
+
485
+ // Check if a selector's value should contain a specific substring
486
+ Then(
487
+ "User expects {string} should have {string} substring",
488
+ async function (selector, substring) {
489
+ await assert.shouldContain(selector, substring);
490
+ },
491
+ );
492
+
493
+ // Check if a selector's value should contain an equal value
494
+ Then(
495
+ "User expects {string} should contain equal {string}",
496
+ async function (selector, expected) {
497
+ await assert.shouldContainEqual(selector, expected);
498
+ },
499
+ );
500
+
501
+ // Check if a selector's value should equal the expected value
502
+ Then(
503
+ "User expects {string} should equal {int}",
504
+ async function (selector, expected) {
505
+ await assert.shouldEqual(selector, expected);
506
+ },
507
+ );
508
+
509
+ // Check if a selector's text content should have a specific length
510
+ Then(
511
+ "User expects length of {string} should be {int}",
512
+ async function (selector, length) {
513
+ await assert.shouldHaveLength(selector, length);
514
+ },
515
+ );
516
+
517
+ // Check if a selector's text content should have a specific property
518
+ Then(
519
+ "User expects {string} should have {string} property",
520
+ async function (selector, property) {
521
+ await assert.shouldHaveProperty(selector, property);
522
+ },
523
+ );
524
+
525
+ // Check if a selector's text content should match a specific regex
526
+ Then(
527
+ "User expects {string} should match {string} regex",
528
+ async function (selector, regex) {
529
+ await assert.shouldMatch(selector, new RegExp(regex));
530
+ },
531
+ );
532
+
533
+ // Check if a selector's text content should match a specific object
534
+ Then(
535
+ "User expects {string} should match {string} object",
536
+ async function (selector, object) {
537
+ await assert.shouldMatchObject(selector, JSON.parse(object));
538
+ },
539
+ );
540
+
541
+ // Check if a selector's text content should strictly equal the expected value
542
+ Then(
543
+ "User expects {string} should strictly equal {string}",
544
+ async function (selector, expected) {
545
+ await assert.shouldStrictEqual(selector, expected);
546
+ },
547
+ );
548
+
549
+ // Check if a async function should throw an error
550
+ Then("The async function should throw", async function (fn) {
551
+ await assert.shouldThrow(fn);
552
+ });
553
+
554
+ // Check if the text content of a selector should be an instance of a specific constructor
555
+ Then(
556
+ "User expects {string} should be any instance of {string}",
557
+ async function (selector, constructor) {
558
+ await assert.shouldAny(selector, constructor);
559
+ },
560
+ );
561
+
562
+ // Check if the text content of a selector may be anything (truthy)
563
+ Then("User expects {string} may be anything", async function (selector) {
564
+ await assert.shouldAnything(selector);
565
+ });
566
+
567
+ // Check if the text content of a selector should contain any of the specified elements in an array
568
+ Then(
569
+ "User expects {string} should contain {string} array elements",
570
+ async function (selector, elements) {
571
+ const parsedElements = elements.split(",");
572
+ await assert.shouldArrayContaining(selector, parsedElements);
573
+ },
574
+ );
575
+
576
+ // Check if the text content of a selector should be close to the expected value within a precision
577
+ Then(
578
+ "User expects {string} should be close to {float} with precision {int}",
579
+ async function (selector, expected, precision) {
580
+ await assert.shouldCloseTo(selector, expected, precision);
581
+ },
582
+ );
583
+
584
+ // Check if the text content of a selector should contain the specified properties in an object
585
+ Then(
586
+ "User expects {string} should contain {string} object properties",
587
+ async function (selector, properties) {
588
+ const parsedProperties = properties.split(",");
589
+ await assert.shouldObjectContaining(selector, parsedProperties);
590
+ },
591
+ );
592
+
593
+ // Check if the text content of a selector should contain a specific substring
594
+ Then(
595
+ "User expects {string} should have {string} substring",
596
+ async function (selector, substring) {
597
+ await assert.shouldStringContaining(selector, substring);
598
+ },
599
+ );
600
+
601
+ // Check if the text content of a selector should match a specific regex
602
+ Then(
603
+ "User expects {string} should match {string} regex",
604
+ async function (selector, regex) {
605
+ await assert.shouldStringMatching(selector, new RegExp(regex));
606
+ },
607
+ );
608
+
609
+ // Check if a selector's text content should not be equal to the expected value
610
+ Then(
611
+ "User expects {string} should not be {string} text",
612
+ async function (selector, expected) {
613
+ await assert.shouldNotBe(selector, expected);
614
+ },
615
+ );
616
+
617
+ // Check if a selector's text content should not be close to the expected value within a precision
618
+ Then(
619
+ "User expects {string} should not be close to {float} with precision {int}",
620
+ async function (selector, expected, precision) {
621
+ await assert.shouldNotBeCloseTo(selector, expected, precision);
622
+ },
623
+ );
624
+
625
+ // Check if a selector's text content should not be defined
626
+ Then("User expects {string} should not be defined", async function (selector) {
627
+ await assert.shouldNotBeDefined(selector);
628
+ });
629
+
630
+ // Check if a selector's text content should not be falsy
631
+ Then("User expects {string} should not be falsy", async function (selector) {
632
+ await assert.shouldNotBeFalsy(selector);
633
+ });
634
+
635
+ // Check if a selector's text content should not be greater than the expected value
636
+ Then(
637
+ "User expects {string} should not be greater than {float}",
638
+ async function (selector, expected) {
639
+ await assert.shouldNotBeGreaterThan(selector, expected);
640
+ },
641
+ );
642
+
643
+ // Check if a selector's text content should not be greater than or equal to the expected value
644
+ Then(
645
+ "User expects {string} should not be greater than or equal to {float}",
646
+ async function (selector, expected) {
647
+ await assert.shouldNotBeGreaterThanOrEqual(selector, expected);
648
+ },
649
+ );
650
+
651
+ // Check if a selector's text content should not be an instance of a specific constructor
652
+ Then(
653
+ "User expects {string} should not be an instance of {string}",
654
+ async function (selector, constructor) {
655
+ await assert.shouldNotBeInstanceOf(selector, constructor);
656
+ },
657
+ );
658
+
659
+ // Check if a selector's text content should not be less than the expected value
660
+ Then(
661
+ "User expects {string} should not be less than {float}",
662
+ async function (selector, expected) {
663
+ await assert.shouldNotBeLessThan(selector, expected);
664
+ },
665
+ );
666
+
667
+ // Check if a selector's text content should not be less than or equal to the expected value
668
+ Then(
669
+ "User expects {string} should not be less than or equal to {float}",
670
+ async function (selector, expected) {
671
+ await assert.shouldNotBeLessThanOrEqual(selector, expected);
672
+ },
673
+ );
674
+
675
+ // Check if a selector's text content should not be NaN
676
+ Then("User expects {string} should not be NaN", async function (selector) {
677
+ await assert.shouldNotBeNaN(selector);
678
+ });
679
+
680
+ // Check if a selector's text content should not be null
681
+ Then("User expects {string} should not be null", async function (selector) {
682
+ await assert.shouldNotBeNull(selector);
683
+ });
684
+
685
+ // Check if a selector's text content should not be truthy
686
+ Then("User expects {string} should not be truthy", async function (selector) {
687
+ await assert.shouldNotBeTruthy(selector);
688
+ });
689
+
690
+ // Check if a selector's text content should not be undefined
691
+ Then(
692
+ "User expects {string} should not be undefined",
693
+ async function (selector) {
694
+ await assert.shouldNotBeUndefined(selector);
695
+ },
696
+ );
697
+
698
+ // Check if a selector's text content should not contain a specific substring
699
+ Then(
700
+ "User expects {string} should not have {string} substring",
701
+ async function (selector, substring) {
702
+ await assert.shouldNotContain(selector, substring);
703
+ },
704
+ );
705
+
706
+ // Check if a selector's text content should not contain an equal value
707
+ Then(
708
+ "User expects {string} should not contain equal {string}",
709
+ async function (selector, expected) {
710
+ await assert.shouldNotContainEqual(selector, expected);
711
+ },
712
+ );
713
+
714
+ // Check if a selector's text content should not equal the expected value
715
+ Then(
716
+ "User expects {string} should not equal {string}",
717
+ async function (selector, expected) {
718
+ await assert.shouldNotEqual(selector, expected);
719
+ },
720
+ );
721
+
722
+ // Check if a selector's text content should not have a specific length
723
+ Then(
724
+ "User expects length of {string} should not be {int} ",
725
+ async function (selector, length) {
726
+ await assert.shouldNotHaveLength(selector, length);
727
+ },
728
+ );
729
+
730
+ // Check if a selector's text content should not have a specific property
731
+ Then(
732
+ "User expects {string} should not have {string} property",
733
+ async function (selector, property) {
734
+ await assert.shouldNotHaveProperty(selector, property);
735
+ },
736
+ );
737
+
738
+ // Check if a selector's text content should not match a specific regex
739
+ Then(
740
+ "User expects {string} should not match {string} regex",
741
+ async function (selector, regex) {
742
+ await assert.shouldNotMatch(selector, new RegExp(regex));
743
+ },
744
+ );
745
+
746
+ // Check if a selector's text content should not match a specific object
747
+ Then(
748
+ "User expects {string} should not match {string} object",
749
+ async function (selector, object) {
750
+ await assert.shouldNotMatchObject(selector, JSON.parse(object));
751
+ },
752
+ );
753
+
754
+ // Check if a async function should not throw an error
755
+ Then("The async function should not throw", async function (fn) {
756
+ await assert.shouldNotThrow(fn);
757
+ });
758
+
759
+ // Check if a selector's text content should not be any instance of a specific constructor
760
+ Then(
761
+ "User expects {string} should not be any instance of {string}",
762
+ async function (selector, constructor) {
763
+ await assert.shouldNotAny(selector, constructor);
764
+ },
765
+ );
766
+
767
+ // Check if a selector's text content may not be anything (falsy)
768
+ Then("User expects {string} may not be anything", async function (selector) {
769
+ await assert.shouldNotAnything(selector);
770
+ });
771
+
772
+ // Check if a selector's text content should not contain any of the specified elements in an array
773
+ Then(
774
+ "User expects {string} should not contain {string} array elements",
775
+ async function (selector, elements) {
776
+ const parsedElements = elements.split(",");
777
+ await assert.shouldNotArrayContaining(selector, parsedElements);
778
+ },
779
+ );
780
+
781
+ // Check if a selector's text content should not be close to the expected value within a precision
782
+ Then(
783
+ "User expects {string} should not be close to {float} with precision {int}",
784
+ async function (selector, expected, precision) {
785
+ await assert.shouldNotCloseTo(selector, expected, precision);
786
+ },
787
+ );
788
+
789
+ // Check if a selector's text content should not contain the specified properties in an object
790
+ Then(
791
+ "User expects {string} should not contain {string} object properties",
792
+ async function (selector, properties) {
793
+ const parsedProperties = JSON.parse(properties);
794
+ await assert.shouldNotObjectContaining(selector, parsedProperties);
795
+ },
796
+ );
797
+
798
+ // Check if a selector's text content should not contain a specific substring
799
+ Then(
800
+ "User expects {string} should not contain {string} substring",
801
+ async function (selector, substring) {
802
+ await assert.shouldNotStringContaining(selector, substring);
803
+ },
804
+ );
805
+
806
+ // Check if a selector's text content should not match a specific regex
807
+ Then(
808
+ "User expects {string} should not match {string} regex",
809
+ async function (selector, regex) {
810
+ await assert.shouldNotStringMatching(selector, new RegExp(regex));
811
+ },
812
+ );
813
+
814
+ Then("User expects should have {int} {string}", async (count, elements) => {
815
+ const elementCount = await frame.count(elements);
816
+ expect(elementCount).toEqual(count);
817
+ });
818
+
819
+ Then(
820
+ "User expects that response has {string} field with {string} value",
821
+ async (field, value) => {
822
+ extractVarsFromResponse(context.response["Response Body"], field);
823
+
824
+ expect(context.vars[field]).toBe(value);
825
+ },
826
+ );