artes 1.2.17 → 1.2.19

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 +644 -630
  2. package/cucumber.config.js +182 -171
  3. package/docs/functionDefinitions.md +2398 -2401
  4. package/docs/stepDefinitions.md +401 -391
  5. package/executer.js +165 -161
  6. package/index.js +48 -48
  7. package/package.json +52 -51
  8. package/src/helper/contextManager/browserManager.js +63 -63
  9. package/src/helper/contextManager/requestManager.js +23 -23
  10. package/src/helper/controller/elementController.js +182 -182
  11. package/src/helper/controller/pomCollector.js +25 -25
  12. package/src/helper/executers/cleaner.js +19 -19
  13. package/src/helper/executers/exporter.js +15 -15
  14. package/src/helper/executers/helper.js +98 -95
  15. package/src/helper/executers/projectCreator.js +201 -198
  16. package/src/helper/executers/reportGenerator.js +74 -58
  17. package/src/helper/executers/testRunner.js +30 -30
  18. package/src/helper/executers/versionChecker.js +31 -31
  19. package/src/helper/imports/commons.js +57 -56
  20. package/src/helper/stepFunctions/APIActions.js +362 -363
  21. package/src/helper/stepFunctions/assertions.js +523 -523
  22. package/src/helper/stepFunctions/browserActions.js +22 -22
  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 +257 -257
  31. package/src/stepDefinitions/API.steps.js +300 -300
  32. package/src/stepDefinitions/assertions.steps.js +864 -862
  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 +261 -227
  36. package/src/stepDefinitions/mouseActions.steps.js +276 -276
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +178 -159
@@ -1,2401 +1,2398 @@
1
- ## 📋 Simplified Functions
2
-
3
- If you don't want to deal with Playwright methods directly, you can simply use the following predefined actions methods by import them:
4
-
5
- ```javascript
6
- const {
7
- mouse,
8
- keyboard,
9
- frame,
10
- elementInteractions,
11
- page,
12
- api,
13
- } = require("artes");
14
- ```
15
-
16
- - **Mouse Actions:**
17
- `mouse.click(element)`
18
-
19
- - **Keyboard Actions:**
20
- `keyboard.press(key)`
21
-
22
- - **Element Interactions:**
23
- `elementInteractions.isChecked()`
24
-
25
- - **Assertions:**
26
- `assert.shouldBeTruthy(element)`
27
-
28
- - **Frame Actions:**
29
- `frame.first()`
30
-
31
- - **API Actions:**
32
- `api.post(url, payload, requestDataType)`
33
-
34
- ---
35
-
36
- ## Table of Contents
37
-
38
- - [Mouse Functions](#mouse-functions)
39
- - [Keyboard Functions](#keyboard-functions)
40
- - [Assertions Functions](#assertions-functions)
41
- - [Page Functions](#page-functions)
42
- - [Frame Functions](#frame-functions)
43
- - [API Functions](#api-object-methods)
44
- - [Usage Examples](#usage-examples)
45
-
46
- ### **Mouse Functions**
47
-
48
- #### `click(selector)`
49
-
50
- Clicks on the specified element.
51
-
52
- ```javascript
53
- await click("button#submit");
54
- ```
55
-
56
- ---
57
-
58
- #### `forceClick(selector)`
59
-
60
- Clicks on the specified element, forcing the action even if not visible.
61
-
62
- ```javascript
63
- await forceClick("button#hiddenSubmit");
64
- ```
65
-
66
- ---
67
-
68
- #### `clickPosition(selector, position)`
69
-
70
- Clicks on a specific position within the element, specified as `x,y`.
71
-
72
- ```javascript
73
- await clickPosition("div#map", "50,100");
74
- ```
75
-
76
- ---
77
-
78
- #### `forceClickPosition(selector, position)`
79
-
80
- Forces a click at a specific position within the element.
81
-
82
- ```javascript
83
- await forceClickPosition("div#map", "50,100");
84
- ```
85
-
86
- ---
87
-
88
- #### `rightClick(selector)`
89
-
90
- Performs a right-click on the element.
91
-
92
- ```javascript
93
- await rightClick("div#contextMenu");
94
- ```
95
-
96
- ---
97
-
98
- #### `forceRightClick(selector)`
99
-
100
- Forces a right-click on the element.
101
-
102
- ```javascript
103
- await forceRightClick("div#hiddenContextMenu");
104
- ```
105
-
106
- ---
107
-
108
- #### `leftClick(selector)`
109
-
110
- Performs a left-click on the element (default click).
111
-
112
- ```javascript
113
- await leftClick("button#start");
114
- ```
115
-
116
- ---
117
-
118
- #### `forceLeftClick(selector)`
119
-
120
- Forces a left-click on the element.
121
-
122
- ```javascript
123
- await forceLeftClick("button#hiddenStart");
124
- ```
125
-
126
- ---
127
-
128
- #### `doubleClick(selector)`
129
-
130
- Performs a double-click on the element.
131
-
132
- ```javascript
133
- await doubleClick("input#textBox");
134
- ```
135
-
136
- ---
137
-
138
- #### `forceDoubleClick(selector)`
139
-
140
- Forces a double-click on the element.
141
-
142
- ```javascript
143
- await forceDoubleClick("input#hiddenTextBox");
144
- ```
145
-
146
- ---
147
-
148
- #### `forceDoubleClickPosition(selector, position)`
149
-
150
- Forces a double-click at a specific position within the element.
151
-
152
- ```javascript
153
- await forceDoubleClickPosition("div#image", "100,150");
154
- ```
155
-
156
- ---
157
-
158
- ### **Hover Functions**
159
-
160
- #### `hover(selector)`
161
-
162
- Moves the mouse pointer over the element.
163
-
164
- ```javascript
165
- await hover("button#hoverMe");
166
- ```
167
-
168
- ---
169
-
170
- #### `forceHover(selector)`
171
-
172
- Forces a hover action over the element.
173
-
174
- ```javascript
175
- await forceHover("button#hiddenHoverMe");
176
- ```
177
-
178
- ---
179
-
180
- #### `hoverPosition(selector, position)`
181
-
182
- Hovers at a specific position within the element.
183
-
184
- ```javascript
185
- await hoverPosition("div#image", "75,50");
186
- ```
187
-
188
- ---
189
-
190
- #### `forceHoverPosition(selector, position)`
191
-
192
- Forces a hover at a specific position within the element.
193
-
194
- ```javascript
195
- await forceHoverPosition("div#hiddenImage", "75,50");
196
- ```
197
-
198
- ---
199
-
200
- ### **Focus Functions**
201
-
202
- #### `focus(selector)`
203
-
204
- Focuses on the specified element.
205
-
206
- ```javascript
207
- await focus("input#username");
208
- ```
209
-
210
- ---
211
-
212
- #### `forceFocus(selector)`
213
-
214
- Forces focus on the specified element.
215
-
216
- ```javascript
217
- await forceFocus("input#hiddenUsername");
218
- ```
219
-
220
- ---
221
-
222
- #### `focusPosition(selector, position)`
223
-
224
- Focuses on a specific position within the element.
225
-
226
- ```javascript
227
- await focusPosition("div#editor", "200,300");
228
- ```
229
-
230
- ---
231
-
232
- #### `forceFocusPosition(selector, position)`
233
-
234
- Forces focus at a specific position within the element.
235
-
236
- ```javascript
237
- await forceFocusPosition("div#hiddenEditor", "200,300");
238
- ```
239
-
240
- ---
241
-
242
- ### **Drag-and-Drop Functions**
243
-
244
- #### `dragAndDrop(sourceSelector, targetSelector)`
245
-
246
- Drags an element from the source and drops it at the target.
247
-
248
- ```javascript
249
- await dragAndDrop("div#source", "div#target");
250
- ```
251
-
252
- ---
253
-
254
- #### `dragAndDropPosition(sourceSelector, position)`
255
-
256
- Drags an element and drops it at a specified position.
257
-
258
- ```javascript
259
- await dragAndDropPosition("div#source", "300,400");
260
- ```
261
-
262
- ---
263
-
264
- ### **Select Functions**
265
-
266
- #### `selectByValue(selector, value)`
267
-
268
- Selects an option in a dropdown by value.
269
-
270
- ```javascript
271
- await selectByValue("select#dropdown", "value1,value2");
272
- ```
273
-
274
- ---
275
-
276
- #### `selectByText(selector, value)`
277
-
278
- Selects an option in a dropdown by visible text.
279
-
280
- ```javascript
281
- await selectByText("select#dropdown", "Option 1");
282
- ```
283
-
284
- ---
285
-
286
- ### **Checkbox Functions**
287
-
288
- #### `check(selector)`
289
-
290
- Checks the specified checkbox.
291
-
292
- ```javascript
293
- await check("input#termsCheckbox");
294
- ```
295
-
296
- ---
297
-
298
- #### `uncheck(selector)`
299
-
300
- Unchecks the specified checkbox.
301
-
302
- ```javascript
303
- await uncheck("input#termsCheckbox");
304
- ```
305
-
306
- ---
307
-
308
- ### **Scroll Functions**
309
-
310
- #### `scrollIntoViewIfNeeded(selector)`
311
-
312
- Scrolls the element into view if it is not already visible.
313
-
314
- ```javascript
315
- await scrollIntoViewIfNeeded("div#content");
316
- ```
317
-
318
- ---
319
-
320
- ### **Keyboard Functions**
321
-
322
- #### `press(selector, key)`
323
-
324
- Simulates a key press on the specified element.
325
-
326
- ```javascript
327
- await press("input#searchBox", "Enter");
328
- ```
329
-
330
- ---
331
-
332
- #### `pressSequentially(selector, keys)`
333
-
334
- Presses a sequence of keys on the specified element.
335
-
336
- ```javascript
337
- await pressSequentially("input#textField", ["Shift", "A", "B", "C"]);
338
- ```
339
-
340
- ---
341
-
342
- #### `pressSequentiallyDelay(selector, keys, delay)`
343
-
344
- Presses a sequence of keys on the specified element with a delay between each key press.
345
-
346
- ```javascript
347
- await pressSequentiallyDelay("input#textField", ["H", "E", "L", "L", "O"], 200);
348
- ```
349
-
350
- ---
351
-
352
- #### `fill(selector, value)`
353
-
354
- Fills the specified element (like an input field) with the provided value.
355
-
356
- ```javascript
357
- await fill("input#email", "example@example.com");
358
- ```
359
-
360
- ---
361
-
362
- #### `clear(selector)`
363
-
364
- Clears the value of the specified input field.
365
-
366
- ```javascript
367
- await clear("input#email");
368
- ```
369
-
370
- ---
371
-
372
- #### `selectText(selector)`
373
-
374
- Selects the text within the specified element.
375
-
376
- ```javascript
377
- await selectText("input#email");
378
- ```
379
-
380
- ---
381
-
382
- #### `setInputFiles(selector, files)`
383
-
384
- Sets the specified file(s) to an input field.
385
-
386
- ```javascript
387
- await setInputFiles("input#fileUpload", [
388
- "path/to/file1.png",
389
- "path/to/file2.jpg",
390
- ]);
391
- ```
392
-
393
- ### **Page Functions**
394
-
395
- #### `navigateTo(url)`
396
-
397
- Navigates to the specified URL in the current page context.
398
-
399
- ```javascript
400
- await navigateTo("https://example.com");
401
- ```
402
-
403
- - **Parameters**:
404
- - `url` _(string)_: The URL to navigate to.
405
-
406
- ---
407
-
408
- #### `navigateBack()`
409
-
410
- Navigates to the previous page.
411
-
412
- ```javascript
413
- navigateBack();
414
- ```
415
-
416
- ---
417
-
418
- #### `navigateForward()`
419
-
420
- Navigates to the next page.
421
-
422
- ```javascript
423
- navigateForward();
424
- ```
425
-
426
- ---
427
-
428
- #### `getURL()`
429
-
430
- Retrieves the current URL of the page.
431
-
432
- ```javascript
433
- await getURL();
434
- ```
435
-
436
- - **Returns**:
437
-
438
- - _(string)_: The current page URL.
439
-
440
- ***
441
-
442
- #### `wait()`
443
-
444
- Waits on the page until specified times.
445
-
446
- ```javascript
447
- await wait(time);
448
- ```
449
-
450
- - **Parameters**:
451
- - `time` _(int)_: millisecond.
452
-
453
- ---
454
-
455
- ### **Assertions Functions**
456
-
457
- #### `shouldBeAttached(selector)`
458
-
459
- Asserts that the element is attached to the DOM.
460
-
461
- ```javascript
462
- await shouldBeAttached("#element-id");
463
- ```
464
-
465
- ---
466
-
467
- #### `shouldBeChecked(selector)`
468
-
469
- Asserts that the element is checked (e.g., a checkbox).
470
-
471
- ```javascript
472
- await shouldBeChecked("#checkbox-id");
473
- ```
474
-
475
- ---
476
-
477
- #### `shouldBeDisabled(selector)`
478
-
479
- Asserts that the element is disabled.
480
-
481
- ```javascript
482
- await shouldBeDisabled("#button-id");
483
- ```
484
-
485
- ---
486
-
487
- #### `shouldBeEditable(selector)`
488
-
489
- Asserts that the element is editable (e.g., an input field).
490
-
491
- ```javascript
492
- await shouldBeEditable("#input-id");
493
- ```
494
-
495
- ---
496
-
497
- #### `shouldBeEmpty(selector)`
498
-
499
- Asserts that the element has no content.
500
-
501
- ```javascript
502
- await shouldBeEmpty("#container-id");
503
- ```
504
-
505
- ---
506
-
507
- #### `shouldBeEnabled(selector)`
508
-
509
- Asserts that the element is enabled.
510
-
511
- ```javascript
512
- await shouldBeEnabled("#button-id");
513
- ```
514
-
515
- ---
516
-
517
- #### `shouldBeFocused(selector)`
518
-
519
- Asserts that the element is currently focused.
520
-
521
- ```javascript
522
- await shouldBeFocused("#input-id");
523
- ```
524
-
525
- ---
526
-
527
- #### `shouldBeHidden(selector)`
528
-
529
- Asserts that the element is hidden.
530
-
531
- ```javascript
532
- await shouldBeHidden("#hidden-element-id");
533
- ```
534
-
535
- ---
536
-
537
- #### `shouldBeInViewport(selector)`
538
-
539
- Asserts that the element is visible within the viewport.
540
-
541
- ```javascript
542
- await shouldBeInViewport("#element-id");
543
- ```
544
-
545
- ---
546
-
547
- #### `shouldBeVisible(selector)`
548
-
549
- Asserts that the element is visible.
550
-
551
- ```javascript
552
- await shouldBeVisible("#visible-element-id");
553
- ```
554
-
555
- ---
556
-
557
- #### `shouldContainText(selector, text)`
558
-
559
- Asserts that the element contains the specified text.
560
-
561
- ```javascript
562
- await shouldContainText("#element-id", "Expected Text");
563
- ```
564
-
565
- - **Parameters**:
566
- - `text` _(string)_: The text to check for.
567
-
568
- ---
569
-
570
- #### `shouldHaveAccessibleDescription(selector, description)`
571
-
572
- Asserts that the element has the specified accessible description.
573
-
574
- ```javascript
575
- await shouldHaveAccessibleDescription("#element-id", "Description");
576
- ```
577
-
578
- - **Parameters**:
579
- - `description` _(string)_: The expected accessible description.
580
-
581
- ---
582
-
583
- #### `shouldHaveAccessibleName(selector, name)`
584
-
585
- Asserts that the element has the specified accessible name.
586
-
587
- ```javascript
588
- await shouldHaveAccessibleName("#element-id", "Name");
589
- ```
590
-
591
- - **Parameters**:
592
- - `name` _(string)_: The expected accessible name.
593
-
594
- ---
595
-
596
- #### `shouldHaveAttribute(selector, attribute, value)`
597
-
598
- Asserts that the element has the specified attribute with the given value.
599
-
600
- ```javascript
601
- await shouldHaveAttribute("#element-id", "data-type", "example");
602
- ```
603
-
604
- - **Parameters**:
605
- - `attribute` _(string)_: The attribute to check.
606
- - `value` _(string)_: The expected value of the attribute.
607
-
608
- ---
609
-
610
- #### `shouldHaveClass(selector, className)`
611
-
612
- Asserts that the element has the specified class.
613
-
614
- ```javascript
615
- await shouldHaveClass("#element-id", "active-class");
616
- ```
617
-
618
- - **Parameters**:
619
- - `className` _(string)_: The expected class name.
620
-
621
- ---
622
-
623
- #### `shouldHaveCount(selector, count)`
624
-
625
- Asserts that the number of matching elements equals the specified count.
626
-
627
- ```javascript
628
- await shouldHaveCount(".list-item", 5);
629
- ```
630
-
631
- - **Parameters**:
632
- - `count` _(number)_: The expected number of elements.
633
-
634
- ---
635
-
636
- #### `shouldHaveCSS(selector, property, value)`
637
-
638
- Asserts that the element has the specified CSS property with the given value.
639
-
640
- ```javascript
641
- await shouldHaveCSS("#element-id", "color", "red");
642
- ```
643
-
644
- - **Parameters**:
645
- - `property` _(string)_: The CSS property to check.
646
- - `value` _(string)_: The expected value of the property.
647
-
648
- ---
649
-
650
- #### `shouldHaveId(selector, id)`
651
-
652
- Asserts that the element has the specified ID.
653
-
654
- ```javascript
655
- await shouldHaveId("#element-id", "unique-id");
656
- ```
657
-
658
- - **Parameters**:
659
-
660
- - `id` _(string)_: The expected ID.
661
-
662
- Got it! Here’s the refined format for the assertion methods:
663
-
664
- ---
665
-
666
- #### `shouldHaveJSProperty(selector, property, value)`
667
-
668
- Asserts that the element has the specified JavaScript property with the expected value.
669
-
670
- ```javascript
671
- await shouldHaveJSProperty("#element", "disabled", true);
672
- ```
673
-
674
- - **Parameters**:
675
- - `selector` _(string)_: The target element’s selector.
676
- - `property` _(string)_: The JavaScript property to check.
677
- - `value` _(any)_: The expected value of the property.
678
-
679
- ---
680
-
681
- #### `shouldHaveRole(selector, role)`
682
-
683
- Asserts that the element has the specified role.
684
-
685
- ```javascript
686
- await shouldHaveRole("#element", "button");
687
- ```
688
-
689
- - **Parameters**:
690
- - `selector` _(string)_: The target element’s selector.
691
- - `role` _(string)_: The expected role of the element.
692
-
693
- ---
694
-
695
- #### `shouldHaveScreenshot(selector)`
696
-
697
- Asserts that the element has a screenshot.
698
-
699
- ```javascript
700
- await shouldHaveScreenshot("#element");
701
- ```
702
-
703
- - **Parameters**:
704
- - `selector` _(string)_: The target element’s selector.
705
-
706
- ---
707
-
708
- #### `shouldHaveText(selector, text)`
709
-
710
- Asserts that the element contains the specified text.
711
-
712
- ```javascript
713
- await shouldHaveText("#element", "Hello World");
714
- ```
715
-
716
- - **Parameters**:
717
- - `selector` _(string)_: The target element’s selector.
718
- - `text` _(string)_: The expected text in the element.
719
-
720
- ---
721
-
722
- #### `shouldHaveValue(selector, value)`
723
-
724
- Asserts that the element has the specified value.
725
-
726
- ```javascript
727
- await shouldHaveValue("#input-field", "test value");
728
- ```
729
-
730
- - **Parameters**:
731
- - `selector` _(string)_: The target element’s selector.
732
- - `value` _(string)_: The expected value of the element.
733
-
734
- ---
735
-
736
- #### `shouldHaveValues(selector, values)`
737
-
738
- Asserts that the element has the specified values.
739
-
740
- ```javascript
741
- await shouldHaveValues("#multi-select", ["Option 1", "Option 2"]);
742
- ```
743
-
744
- - **Parameters**:
745
- - `selector` _(string)_: The target element’s selector.
746
- - `values` _(array)_: The expected values in the element.
747
-
748
- ---
749
-
750
- #### `shouldPageHaveScreenshot()`
751
-
752
- Asserts that the current page has a screenshot.
753
-
754
- ```javascript
755
- await shouldPageHaveScreenshot();
756
- ```
757
-
758
- - **Parameters**:
759
- None
760
-
761
- ---
762
-
763
- #### `shouldPageHaveTitle(title)`
764
-
765
- Asserts that the page has the specified title.
766
-
767
- ```javascript
768
- await shouldPageHaveTitle("Page Title");
769
- ```
770
-
771
- - **Parameters**:
772
- - `title` _(string)_: The expected title of the page.
773
-
774
- ---
775
-
776
- #### `shouldPageHaveURL(url)`
777
-
778
- Asserts that the page has the specified URL.
779
-
780
- ```javascript
781
- await shouldPageHaveURL("https://www.example.com");
782
- ```
783
-
784
- - **Parameters**:
785
- - `url` _(string)_: The expected URL of the page.
786
-
787
- ---
788
-
789
- #### `shouldResponseBeOK(response)`
790
-
791
- Asserts that the response status is OK (200).
792
-
793
- ```javascript
794
- await shouldResponseBeOK(response);
795
- ```
796
-
797
- - **Parameters**:
798
- - `response` _(object)_: The response object to check.
799
-
800
- #### `shouldNotBeAttached(selector)`
801
-
802
- Asserts that the element is not attached to the DOM.
803
-
804
- ```javascript
805
- await shouldNotBeAttached("#element");
806
- ```
807
-
808
- - **Parameters**:
809
- - `selector` _(string)_: The target element’s selector.
810
-
811
- ---
812
-
813
- #### `shouldNotBeChecked(selector)`
814
-
815
- Asserts that the element is not checked.
816
-
817
- ```javascript
818
- await shouldNotBeChecked("#checkbox");
819
- ```
820
-
821
- - **Parameters**:
822
- - `selector` _(string)_: The target element’s selector.
823
-
824
- ---
825
-
826
- #### `shouldNotBeDisabled(selector)`
827
-
828
- Asserts that the element is not disabled.
829
-
830
- ```javascript
831
- await shouldNotBeDisabled("#button");
832
- ```
833
-
834
- - **Parameters**:
835
- - `selector` _(string)_: The target element’s selector.
836
-
837
- ---
838
-
839
- #### `shouldNotBeEditable(selector)`
840
-
841
- Asserts that the element is not editable.
842
-
843
- ```javascript
844
- await shouldNotBeEditable("#input");
845
- ```
846
-
847
- - **Parameters**:
848
- - `selector` _(string)_: The target element’s selector.
849
-
850
- ---
851
-
852
- #### `shouldNotBeEmpty(selector)`
853
-
854
- Asserts that the element is not empty.
855
-
856
- ```javascript
857
- await shouldNotBeEmpty("#input-field");
858
- ```
859
-
860
- - **Parameters**:
861
- - `selector` _(string)_: The target element’s selector.
862
-
863
- ---
864
-
865
- #### `shouldNotBeEnabled(selector)`
866
-
867
- Asserts that the element is not enabled.
868
-
869
- ```javascript
870
- await shouldNotBeEnabled("#button");
871
- ```
872
-
873
- - **Parameters**:
874
- - `selector` _(string)_: The target element’s selector.
875
-
876
- ---
877
-
878
- #### `shouldNotBeFocused(selector)`
879
-
880
- Asserts that the element is not focused.
881
-
882
- ```javascript
883
- await shouldNotBeFocused("#element");
884
- ```
885
-
886
- - **Parameters**:
887
- - `selector` _(string)_: The target element’s selector.
888
-
889
- ---
890
-
891
- #### `shouldNotBeHidden(selector)`
892
-
893
- Asserts that the element is not hidden.
894
-
895
- ```javascript
896
- await shouldNotBeHidden("#element");
897
- ```
898
-
899
- - **Parameters**:
900
- - `selector` _(string)_: The target element’s selector.
901
-
902
- ---
903
-
904
- #### `shouldNotBeInViewport(selector)`
905
-
906
- Asserts that the element is not in the viewport.
907
-
908
- ```javascript
909
- await shouldNotBeInViewport("#element");
910
- ```
911
-
912
- - **Parameters**:
913
- - `selector` _(string)_: The target element’s selector.
914
-
915
- ---
916
-
917
- #### `shouldNotBeVisible(selector)`
918
-
919
- Asserts that the element is not visible.
920
-
921
- ```javascript
922
- await shouldNotBeVisible("#element");
923
- ```
924
-
925
- - **Parameters**:
926
- - `selector` _(string)_: The target element’s selector.
927
-
928
- ---
929
-
930
- #### `shouldNotContainText(selector, text)`
931
-
932
- Asserts that the element does not contain the specified text.
933
-
934
- ```javascript
935
- await shouldNotContainText("#element", "Some text");
936
- ```
937
-
938
- - **Parameters**:
939
- - `selector` _(string)_: The target element’s selector.
940
- - `text` _(string)_: The text that should not be present in the element.
941
-
942
- ---
943
-
944
- #### `shouldNotHaveAccessibleDescription(selector, description)`
945
-
946
- Asserts that the element does not have the specified accessible description.
947
-
948
- ```javascript
949
- await shouldNotHaveAccessibleDescription("#element", "Description");
950
- ```
951
-
952
- - **Parameters**:
953
- - `selector` _(string)_: The target element’s selector.
954
- - `description` _(string)_: The description that should not be associated with the element.
955
-
956
- ---
957
-
958
- #### `shouldNotHaveAccessibleName(selector, name)`
959
-
960
- Asserts that the element does not have the specified accessible name.
961
-
962
- ```javascript
963
- await shouldNotHaveAccessibleName("#element", "Element Name");
964
- ```
965
-
966
- - **Parameters**:
967
- - `selector` _(string)_: The target element’s selector.
968
- - `name` _(string)_: The name that should not be associated with the element.
969
-
970
- ---
971
-
972
- #### `shouldNotHaveAttribute(selector, attribute, value)`
973
-
974
- Asserts that the element does not have the specified attribute with the given value.
975
-
976
- ```javascript
977
- await shouldNotHaveAttribute("#element", "type", "submit");
978
- ```
979
-
980
- - **Parameters**:
981
- - `selector` _(string)_: The target element’s selector.
982
- - `attribute` _(string)_: The attribute to check.
983
- - `value` _(string)_: The expected value of the attribute.
984
-
985
- ---
986
-
987
- #### `shouldNotHaveClass(selector, className)`
988
-
989
- Asserts that the element does not have the specified class.
990
-
991
- ```javascript
992
- await shouldNotHaveClass("#element", "disabled");
993
- ```
994
-
995
- - **Parameters**:
996
- - `selector` _(string)_: The target element’s selector.
997
- - `className` _(string)_: The class that should not be associated with the element.
998
-
999
- ---
1000
-
1001
- #### `shouldNotHaveCount(selector, count)`
1002
-
1003
- Asserts that the number of elements matching the selector is not equal to the specified count.
1004
-
1005
- ```javascript
1006
- await shouldNotHaveCount("#element", 5);
1007
- ```
1008
-
1009
- - **Parameters**:
1010
- - `selector` _(string)_: The target element’s selector.
1011
- - `count` _(number)_: The expected count of elements.
1012
-
1013
- ---
1014
-
1015
- #### `shouldNotHaveCSS(selector, property, value)`
1016
-
1017
- Asserts that the element does not have the specified CSS property with the given value.
1018
-
1019
- ```javascript
1020
- await shouldNotHaveCSS("#element", "color", "red");
1021
- ```
1022
-
1023
- - **Parameters**:
1024
- - `selector` _(string)_: The target element’s selector.
1025
- - `property` _(string)_: The CSS property to check.
1026
- - `value` _(string)_: The expected value of the property.
1027
-
1028
- ---
1029
-
1030
- #### `shouldNotHaveId(selector, id)`
1031
-
1032
- Asserts that the element does not have the specified ID.
1033
-
1034
- ```javascript
1035
- await shouldNotHaveId("#element", "unique-id");
1036
- ```
1037
-
1038
- - **Parameters**:
1039
- - `selector` _(string)_: The target element’s selector.
1040
- - `id` _(string)_: The ID that should not be associated with the element.
1041
-
1042
- ---
1043
-
1044
- #### `shouldNotHaveJSProperty(selector, property, value)`
1045
-
1046
- Asserts that the element does not have the specified JavaScript property with the given value.
1047
-
1048
- ```javascript
1049
- await shouldNotHaveJSProperty("#element", "disabled", true);
1050
- ```
1051
-
1052
- - **Parameters**:
1053
- - `selector` _(string)_: The target element’s selector.
1054
- - `property` _(string)_: The JavaScript property to check.
1055
- - `value` _(any)_: The value that the property should not have.
1056
-
1057
- ---
1058
-
1059
- #### `shouldNotHaveRole(selector, role)`
1060
-
1061
- Asserts that the element does not have the specified role.
1062
-
1063
- ```javascript
1064
- await shouldNotHaveRole("#element", "button");
1065
- ```
1066
-
1067
- - **Parameters**:
1068
- - `selector` _(string)_: The target element’s selector.
1069
- - `role` _(string)_: The role that should not be associated with the element.
1070
-
1071
- ---
1072
-
1073
- #### `shouldNotHaveScreenshot(selector)`
1074
-
1075
- Asserts that the element does not have a screenshot.
1076
-
1077
- ```javascript
1078
- await shouldNotHaveScreenshot("#element");
1079
- ```
1080
-
1081
- - **Parameters**:
1082
- - `selector` _(string)_: The target element’s selector.
1083
-
1084
- ---
1085
-
1086
- #### `shouldNotHaveText(selector, text)`
1087
-
1088
- Asserts that the element does not contain the specified text.
1089
-
1090
- ```javascript
1091
- await shouldNotHaveText("#element", "Some text");
1092
- ```
1093
-
1094
- - **Parameters**:
1095
- - `selector` _(string)_: The target element’s selector.
1096
- - `text` _(string)_: The text that should not be present in the element.
1097
-
1098
- ---
1099
-
1100
- #### `shouldNotHaveValue(selector, value)`
1101
-
1102
- Asserts that the element does not have the specified value.
1103
-
1104
- ```javascript
1105
- await shouldNotHaveValue("#element", "input value");
1106
- ```
1107
-
1108
- - **Parameters**:
1109
- - `selector` _(string)_: The target element’s selector.
1110
- - `value` _(string)_: The value that should not be present in the element.
1111
-
1112
- ---
1113
-
1114
- #### `shouldNotHaveValues(selector, values)`
1115
-
1116
- Asserts that the element does not have the specified values.
1117
-
1118
- ```javascript
1119
- await shouldNotHaveValues("#element", ["value1", "value2"]);
1120
- ```
1121
-
1122
- - **Parameters**:
1123
- - `selector` _(string)_: The target element’s selector.
1124
- - `values` _(array)_: The values that should not be present in the element.
1125
-
1126
- ---
1127
-
1128
- #### `shouldNotPageHaveScreenshot()`
1129
-
1130
- Asserts that the page does not have a screenshot.
1131
-
1132
- ```javascript
1133
- await shouldNotPageHaveScreenshot();
1134
- ```
1135
-
1136
- - **Parameters**:
1137
- - None.
1138
-
1139
- ---
1140
-
1141
- #### `shouldNotPageHaveTitle(title)`
1142
-
1143
- Asserts that the page does not have the specified title.
1144
-
1145
- ```javascript
1146
- await shouldNotPageHaveTitle("Page Title");
1147
- ```
1148
-
1149
- - **Parameters**:
1150
- - `title` _(string)_: The title that should not be associated with the page.
1151
-
1152
- ---
1153
-
1154
- #### `shouldNotPageHaveURL(url)`
1155
-
1156
- Asserts that the page does not have the specified URL.
1157
-
1158
- ```javascript
1159
- await shouldNotPageHaveURL("https://example.com");
1160
- ```
1161
-
1162
- - **Parameters**:
1163
- - `url` _(string)_: The URL that should not be associated with the page.
1164
-
1165
- ---
1166
-
1167
- #### `shouldNotResponseBeOK(response)`
1168
-
1169
- Asserts that the response is not OK (status code 200).
1170
-
1171
- ```javascript
1172
- await shouldNotResponseBeOK(response);
1173
- ```
1174
-
1175
- - **Parameters**:
1176
- - `response` _(object)_: The response object to check.
1177
-
1178
- ---
1179
-
1180
- #### `shouldBe(selector, expected)`
1181
-
1182
- Asserts that the element’s text content is equal to the expected value.
1183
-
1184
- ```javascript
1185
- await shouldBe("#element", "expected text");
1186
- ```
1187
-
1188
- - **Parameters**:
1189
- - `selector` _(string)_: The target element’s selector.
1190
- - `expected` _(string)_: The expected text content.
1191
-
1192
- ---
1193
-
1194
- #### `shouldBeCloseTo(selector, expected, precision)`
1195
-
1196
- Asserts that the element’s text content is a number close to the expected value, within the specified precision.
1197
-
1198
- ```javascript
1199
- await shouldBeCloseTo("#element", 100, 2);
1200
- ```
1201
-
1202
- - **Parameters**:
1203
- - `selector` _(string)_: The target element’s selector.
1204
- - `expected` _(number)_: The expected value.
1205
- - `precision` _(number)_: The allowed precision (number of decimal places).
1206
-
1207
- ---
1208
-
1209
- #### `shouldBeDefined(selector)`
1210
-
1211
- Asserts that the element’s text content is defined.
1212
-
1213
- ```javascript
1214
- await shouldBeDefined("#element");
1215
- ```
1216
-
1217
- - **Parameters**:
1218
- - `selector` _(string)_: The target element’s selector.
1219
-
1220
- ---
1221
-
1222
- #### `shouldBeFalsy(selector)`
1223
-
1224
- Asserts that the element’s text content is falsy (e.g., `false`, `0`, `null`, `undefined`, `NaN`, or an empty string).
1225
-
1226
- ```javascript
1227
- await shouldBeFalsy("#element");
1228
- ```
1229
-
1230
- - **Parameters**:
1231
- - `selector` _(string)_: The target element’s selector.
1232
-
1233
- ---
1234
-
1235
- #### `shouldBeGreaterThan(selector, expected)`
1236
-
1237
- Asserts that the element’s text content, converted to a number, is greater than the expected value.
1238
-
1239
- ```javascript
1240
- await shouldBeGreaterThan("#element", 100);
1241
- ```
1242
-
1243
- - **Parameters**:
1244
- - `selector` _(string)_: The target element’s selector.
1245
- - `expected` _(number)_: The expected value.
1246
-
1247
- ---
1248
-
1249
- #### `shouldBeGreaterThanOrEqual(selector, expected)`
1250
-
1251
- Asserts that the element’s text content, converted to a number, is greater than or equal to the expected value.
1252
-
1253
- ```javascript
1254
- await shouldBeGreaterThanOrEqual("#element", 100);
1255
- ```
1256
-
1257
- - **Parameters**:
1258
- - `selector` _(string)_: The target element’s selector.
1259
- - `expected` _(number)_: The expected value.
1260
-
1261
- ---
1262
-
1263
- #### `shouldBeInstanceOf(selector, constructor)`
1264
-
1265
- Asserts that the element’s text content is an instance of the specified constructor.
1266
-
1267
- ```javascript
1268
- await shouldBeInstanceOf("#element", Array);
1269
- ```
1270
-
1271
- - **Parameters**:
1272
- - `selector` _(string)_: The target element’s selector.
1273
- - `constructor` _(function)_: The constructor function (e.g., `Array`, `Date`, etc.).
1274
-
1275
- ---
1276
-
1277
- #### `shouldBeLessThan(selector, expected)`
1278
-
1279
- Asserts that the element’s text content, converted to a number, is less than the expected value.
1280
-
1281
- ```javascript
1282
- await shouldBeLessThan("#element", 100);
1283
- ```
1284
-
1285
- - **Parameters**:
1286
- - `selector` _(string)_: The target element’s selector.
1287
- - `expected` _(number)_: The expected value.
1288
-
1289
- ---
1290
-
1291
- #### `shouldBeLessThanOrEqual(selector, expected)`
1292
-
1293
- Asserts that the element’s text content, converted to a number, is less than or equal to the expected value.
1294
-
1295
- ```javascript
1296
- await shouldBeLessThanOrEqual("#element", 100);
1297
- ```
1298
-
1299
- - **Parameters**:
1300
- - `selector` _(string)_: The target element’s selector.
1301
- - `expected` _(number)_: The expected value.
1302
-
1303
- ---
1304
-
1305
- #### `shouldBeNaN(selector)`
1306
-
1307
- Asserts that the element’s text content, converted to a number, is `NaN` (Not-a-Number).
1308
-
1309
- ```javascript
1310
- await shouldBeNaN("#element");
1311
- ```
1312
-
1313
- - **Parameters**:
1314
- - `selector` _(string)_: The target element’s selector.
1315
-
1316
- ---
1317
-
1318
- #### `shouldBeNull(selector)`
1319
-
1320
- Asserts that the element’s text content is `null`.
1321
-
1322
- ```javascript
1323
- await shouldBeNull("#element");
1324
- ```
1325
-
1326
- - **Parameters**:
1327
- - `selector` _(string)_: The target element’s selector.
1328
-
1329
- ---
1330
-
1331
- #### `shouldBeTruthy(selector)`
1332
-
1333
- Asserts that the element’s text content is truthy (i.e., a value that evaluates to `true` in a Boolean context).
1334
-
1335
- ```javascript
1336
- await shouldBeTruthy("#element");
1337
- ```
1338
-
1339
- - **Parameters**:
1340
- - `selector` _(string)_: The target element’s selector.
1341
-
1342
- ---
1343
-
1344
- #### `shouldBeUndefined(selector)`
1345
-
1346
- Asserts that the element’s text content is `undefined`.
1347
-
1348
- ```javascript
1349
- await shouldBeUndefined("#element");
1350
- ```
1351
-
1352
- - **Parameters**:
1353
- - `selector` _(string)_: The target element’s selector.
1354
-
1355
- ---
1356
-
1357
- #### `shouldContain(selector, substring)`
1358
-
1359
- Asserts that the element’s text content contains the specified substring.
1360
-
1361
- ```javascript
1362
- await shouldContain("#element", "expected substring");
1363
- ```
1364
-
1365
- - **Parameters**:
1366
- - `selector` _(string)_: The target element’s selector.
1367
- - `substring` _(string)_: The substring that should be contained in the text content.
1368
-
1369
- ---
1370
-
1371
- #### `shouldContainEqual(selector, expected)`
1372
-
1373
- Asserts that the element’s text content contains an equal value to the expected value.
1374
-
1375
- ```javascript
1376
- await shouldContainEqual("#element", "expected value");
1377
- ```
1378
-
1379
- - **Parameters**:
1380
- - `selector` _(string)_: The target element’s selector.
1381
- - `expected` _(any)_: The expected value.
1382
-
1383
- ---
1384
-
1385
- #### `shouldEqual(selector, expected)`
1386
-
1387
- Asserts that the element’s text content, converted to a number, is equal to the expected value.
1388
-
1389
- ```javascript
1390
- await shouldEqual("#element", 100);
1391
- ```
1392
-
1393
- - **Parameters**:
1394
- - `selector` _(string)_: The target element’s selector.
1395
- - `expected` _(number)_: The expected value.
1396
-
1397
- ---
1398
-
1399
- #### `shouldHaveLength(selector, length)`
1400
-
1401
- Asserts that the element's text content has the specified length.
1402
-
1403
- ```javascript
1404
- await shouldHaveLength(".element", 5);
1405
- ```
1406
-
1407
- - **Parameters**:
1408
- - `selector` _(string)_: The CSS selector for the element.
1409
- - `length` _(number)_: The expected length of the text content.
1410
-
1411
- ---
1412
-
1413
- #### `shouldHaveProperty(selector, property)`
1414
-
1415
- Asserts that the element's text content has the specified property.
1416
-
1417
- ```javascript
1418
- await shouldHaveProperty(".element", "propertyName");
1419
- ```
1420
-
1421
- - **Parameters**:
1422
- - `selector` _(string)_: The CSS selector for the element.
1423
- - `property` _(string)_: The property name to check for.
1424
-
1425
- ---
1426
-
1427
- #### `shouldMatch(selector, regex)`
1428
-
1429
- Asserts that the element's text content matches the provided regular expression.
1430
-
1431
- ```javascript
1432
- await shouldMatch(".element", /pattern/);
1433
- ```
1434
-
1435
- - **Parameters**:
1436
- - `selector` _(string)_: The CSS selector for the element.
1437
- - `regex` _(RegExp)_: The regular expression to match against.
1438
-
1439
- ---
1440
-
1441
- #### `shouldMatchObject(selector, object)`
1442
-
1443
- Asserts that the element's text content matches the provided object structure.
1444
-
1445
- ```javascript
1446
- await shouldMatchObject(".element", { key: "value" });
1447
- ```
1448
-
1449
- - **Parameters**:
1450
- - `selector` _(string)_: The CSS selector for the element.
1451
- - `object` _(object)_: The object to match against.
1452
-
1453
- ---
1454
-
1455
- #### `shouldStrictEqual(selector, expected)`
1456
-
1457
- Asserts that the numeric value of the element's text content strictly equals the expected value.
1458
-
1459
- ```javascript
1460
- await shouldStrictEqual(".element", 42);
1461
- ```
1462
-
1463
- - **Parameters**:
1464
- - `selector` _(string)_: The CSS selector for the element.
1465
- - `expected` _(number)_: The expected numeric value.
1466
-
1467
- ---
1468
-
1469
- #### `shouldThrow(fn)`
1470
-
1471
- Asserts that the provided function throws an error when executed.
1472
-
1473
- ```javascript
1474
- await shouldThrow(() => functionThatShouldThrow());
1475
- ```
1476
-
1477
- - **Parameters**:
1478
- - `fn` _(Function)_: The function expected to throw an error.
1479
-
1480
- ---
1481
-
1482
- #### `shouldAny(selector, constructor)`
1483
-
1484
- Asserts that the element's text content is an instance of the specified constructor.
1485
-
1486
- ```javascript
1487
- await shouldAny(".element", Constructor);
1488
- ```
1489
-
1490
- - **Parameters**:
1491
- - `selector` _(string)_: The CSS selector for the element.
1492
- - `constructor` _(Function)_: The constructor function to check against.
1493
-
1494
- ---
1495
-
1496
- #### `shouldAnything(selector)`
1497
-
1498
- Asserts that the element's text content matches anything (always passes).
1499
-
1500
- ```javascript
1501
- await shouldAnything(".element");
1502
- ```
1503
-
1504
- - **Parameters**:
1505
- - `selector` _(string)_: The CSS selector for the element.
1506
-
1507
- ---
1508
-
1509
- #### `shouldArrayContaining(selector, elements)`
1510
-
1511
- Asserts that the element's text content contains all the elements in the provided array.
1512
-
1513
- ```javascript
1514
- await shouldArrayContaining(".element", ["item1", "item2"]);
1515
- ```
1516
-
1517
- - **Parameters**:
1518
- - `selector` _(string)_: The CSS selector for the element.
1519
- - `elements` _(Array)_: The array of elements to check for.
1520
-
1521
- ---
1522
-
1523
- #### `shouldCloseTo(selector, expected, precision)`
1524
-
1525
- Asserts that the numeric value of the element's text content is close to the expected value within the specified precision.
1526
-
1527
- ```javascript
1528
- await shouldCloseTo(".element", 3.14159, 2);
1529
- ```
1530
-
1531
- - **Parameters**:
1532
- - `selector` _(string)_: The CSS selector for the element.
1533
- - `expected` _(number)_: The expected numeric value.
1534
- - `precision` _(number)_: The number of decimal places to check.
1535
-
1536
- ---
1537
-
1538
- #### `shouldObjectContaining(selector, properties)`
1539
-
1540
- Asserts that the element's text content contains an object with the specified properties.
1541
-
1542
- ```javascript
1543
- await shouldObjectContaining(".element", { key: "value" });
1544
- ```
1545
-
1546
- - **Parameters**:
1547
-
1548
- - `selector` _(string)_: The CSS selector for the element.
1549
- - `properties` _(object)_: The object properties to check for.
1550
-
1551
- #### `shouldStringContaining(selector, substring)`
1552
-
1553
- Asserts that the element's text content contains the specified substring.
1554
-
1555
- ```javascript
1556
- await shouldStringContaining(".element", "expected text");
1557
- ```
1558
-
1559
- - **Parameters**:
1560
- - `selector` _(string)_: The CSS selector for the element.
1561
- - `substring` _(string)_: The substring to check for.
1562
-
1563
- ---
1564
-
1565
- #### `shouldStringMatching(selector, regex)`
1566
-
1567
- Asserts that the element's text content matches the specified regular expression.
1568
-
1569
- ```javascript
1570
- await shouldStringMatching(".element", /pattern/);
1571
- ```
1572
-
1573
- - **Parameters**:
1574
- - `selector` _(string)_: The CSS selector for the element.
1575
- - `regex` _(RegExp)_: The regular expression to match against.
1576
-
1577
- ---
1578
-
1579
- #### `shouldNotBe(selector, expected)`
1580
-
1581
- Asserts that the element's text content is not strictly equal to the expected value.
1582
-
1583
- ```javascript
1584
- await shouldNotBe(".element", "unexpected value");
1585
- ```
1586
-
1587
- - **Parameters**:
1588
- - `selector` _(string)_: The CSS selector for the element.
1589
- - `expected` _(any)_: The value that should not match.
1590
-
1591
- ---
1592
-
1593
- #### `shouldNotBeCloseTo(selector, expected, precision)`
1594
-
1595
- Asserts that the numeric value of the element's text content is not close to the expected value within the specified precision.
1596
-
1597
- ```javascript
1598
- await shouldNotBeCloseTo(".element", 3.14159, 2);
1599
- ```
1600
-
1601
- - **Parameters**:
1602
- - `selector` _(string)_: The CSS selector for the element.
1603
- - `expected` _(number)_: The numeric value that should not be close.
1604
- - `precision` _(number)_: The number of decimal places to check.
1605
-
1606
- ---
1607
-
1608
- #### `shouldNotBeDefined(selector)`
1609
-
1610
- Asserts that the element's text content is not defined.
1611
-
1612
- ```javascript
1613
- await shouldNotBeDefined(".element");
1614
- ```
1615
-
1616
- - **Parameters**:
1617
- - `selector` _(string)_: The CSS selector for the element.
1618
-
1619
- ---
1620
-
1621
- #### `shouldNotBeFalsy(selector)`
1622
-
1623
- Asserts that the element's text content is not falsy.
1624
-
1625
- ```javascript
1626
- await shouldNotBeFalsy(".element");
1627
- ```
1628
-
1629
- - **Parameters**:
1630
- - `selector` _(string)_: The CSS selector for the element.
1631
-
1632
- ---
1633
-
1634
- #### `shouldNotBeGreaterThan(selector, expected)`
1635
-
1636
- Asserts that the element's text content is not greater than the expected value.
1637
-
1638
- ```javascript
1639
- await shouldNotBeGreaterThan(".element", 100);
1640
- ```
1641
-
1642
- - **Parameters**:
1643
- - `selector` _(string)_: The CSS selector for the element.
1644
- - `expected` _(number)_: The value to compare against.
1645
-
1646
- ---
1647
-
1648
- #### `shouldNotBeGreaterThanOrEqual(selector, expected)`
1649
-
1650
- Asserts that the numeric value of the element's text content is not greater than or equal to the expected value.
1651
-
1652
- ```javascript
1653
- await shouldNotBeGreaterThanOrEqual(".element", 100);
1654
- ```
1655
-
1656
- - **Parameters**:
1657
- - `selector` _(string)_: The CSS selector for the element.
1658
- - `expected` _(number)_: The value to compare against.
1659
-
1660
- ---
1661
-
1662
- #### `shouldNotBeInstanceOf(selector, constructor)`
1663
-
1664
- Asserts that the element's text content is not an instance of the specified constructor.
1665
-
1666
- ```javascript
1667
- await shouldNotBeInstanceOf(".element", Constructor);
1668
- ```
1669
-
1670
- - **Parameters**:
1671
- - `selector` _(string)_: The CSS selector for the element.
1672
- - `constructor` _(Function)_: The constructor function to check against.
1673
-
1674
- ---
1675
-
1676
- #### `shouldNotBeLessThan(selector, expected)`
1677
-
1678
- Asserts that the numeric value of the element's text content is not less than the expected value.
1679
-
1680
- ```javascript
1681
- await shouldNotBeLessThan(".element", 100);
1682
- ```
1683
-
1684
- - **Parameters**:
1685
- - `selector` _(string)_: The CSS selector for the element.
1686
- - `expected` _(number)_: The value to compare against.
1687
-
1688
- ---
1689
-
1690
- #### `shouldNotBeLessThanOrEqual(selector, expected)`
1691
-
1692
- Asserts that the numeric value of the element's text content is not less than or equal to the expected value.
1693
-
1694
- ```javascript
1695
- await shouldNotBeLessThanOrEqual(".element", 100);
1696
- ```
1697
-
1698
- - **Parameters**:
1699
- - `selector` _(string)_: The CSS selector for the element.
1700
- - `expected` _(number)_: The value to compare against.
1701
-
1702
- ---
1703
-
1704
- #### `shouldNotBeNaN(selector)`
1705
-
1706
- Asserts that the numeric value of the element's text content is not NaN.
1707
-
1708
- ```javascript
1709
- await shouldNotBeNaN(".element");
1710
- ```
1711
-
1712
- - **Parameters**:
1713
- - `selector` _(string)_: The CSS selector for the element.
1714
-
1715
- ---
1716
-
1717
- #### `shouldNotBeNull(selector)`
1718
-
1719
- Asserts that the element's text content is not null.
1720
-
1721
- ```javascript
1722
- await shouldNotBeNull(".element");
1723
- ```
1724
-
1725
- - **Parameters**:
1726
- - `selector` _(string)_: The CSS selector for the element.
1727
-
1728
- ---
1729
-
1730
- #### `shouldNotBeTruthy(selector)`
1731
-
1732
- Asserts that the element's text content is not truthy.
1733
-
1734
- ```javascript
1735
- await shouldNotBeTruthy(".element");
1736
- ```
1737
-
1738
- - **Parameters**:
1739
- - `selector` _(string)_: The CSS selector for the element.
1740
-
1741
- ---
1742
-
1743
- #### `shouldNotBeUndefined(selector)`
1744
-
1745
- Asserts that the element's text content is not undefined.
1746
-
1747
- ```javascript
1748
- await shouldNotBeUndefined(".element");
1749
- ```
1750
-
1751
- - **Parameters**:
1752
- - `selector` _(string)_: The CSS selector for the element.
1753
-
1754
- ---
1755
-
1756
- #### `shouldNotContain(selector, substring)`
1757
-
1758
- Asserts that the element's text content does not contain the specified substring.
1759
-
1760
- ```javascript
1761
- await shouldNotContain(".element", "unexpected text");
1762
- ```
1763
-
1764
- - **Parameters**:
1765
- - `selector` _(string)_: The CSS selector for the element.
1766
- - `substring` _(string)_: The substring that should not be present.
1767
-
1768
- ---
1769
-
1770
- #### `shouldNotContainEqual(selector, expected)`
1771
-
1772
- Asserts that the numeric value of the element's text content does not contain an element equal to the expected value.
1773
-
1774
- ```javascript
1775
- await shouldNotContainEqual(".element", 42);
1776
- ```
1777
-
1778
- - **Parameters**:
1779
- - `selector` _(string)_: The CSS selector for the element.
1780
- - `expected` _(any)_: The value that should not be present.
1781
-
1782
- ---
1783
-
1784
- #### `shouldNotEqual(selector, expected)`
1785
-
1786
- Asserts that the numeric value of the element's text content does not equal the expected value.
1787
-
1788
- ```javascript
1789
- await shouldNotEqual(".element", 42);
1790
- ```
1791
-
1792
- - **Parameters**:
1793
- - `selector` _(string)_: The CSS selector for the element.
1794
- - `expected` _(number)_: The value that should not match.
1795
-
1796
- ---
1797
-
1798
- #### `shouldNotHaveLength(selector, length)`
1799
-
1800
- Asserts that the element's text content does not have the specified length.
1801
-
1802
- ```javascript
1803
- await shouldNotHaveLength(".element", 5);
1804
- ```
1805
-
1806
- - **Parameters**:
1807
- - `selector` _(string)_: The CSS selector for the element.
1808
- - `length` _(number)_: The length that should not match.
1809
-
1810
- ---
1811
-
1812
- #### `shouldNotHaveProperty(selector, property)`
1813
-
1814
- Asserts that the element’s text content does not have the specified property.
1815
-
1816
- ```javascript
1817
- await shouldNotHaveProperty("#element", "property-name");
1818
- ```
1819
-
1820
- - **Parameters**:
1821
- - `selector` _(string)_: The target element’s selector.
1822
- - `property` _(string)_: The property name that should not be present.
1823
-
1824
- ---
1825
-
1826
- #### `shouldNotMatch(selector, regex)`
1827
-
1828
- Asserts that the element’s text content does not match the given regular expression.
1829
-
1830
- ```javascript
1831
- await shouldNotMatch("#element", /regex/);
1832
- ```
1833
-
1834
- - **Parameters**:
1835
- - `selector` _(string)_: The target element’s selector.
1836
- - `regex` _(RegExp)_: The regular expression that the text content should not match.
1837
-
1838
- ---
1839
-
1840
- #### `shouldNotMatchObject(selector, object)`
1841
-
1842
- Asserts that the element’s text content does not match the given object.
1843
-
1844
- ```javascript
1845
- await shouldNotMatchObject("#element", { key: "value" });
1846
- ```
1847
-
1848
- - **Parameters**:
1849
- - `selector` _(string)_: The target element’s selector.
1850
- - `object` _(object)_: The object that the text content should not match.
1851
-
1852
- ---
1853
-
1854
- #### `shouldNotStrictEqual(selector, expected)`
1855
-
1856
- Asserts that the element’s text content, converted to a number, does not strictly equal the expected value.
1857
-
1858
- ```javascript
1859
- await shouldNotStrictEqual("#element", 100);
1860
- ```
1861
-
1862
- - **Parameters**:
1863
- - `selector` _(string)_: The target element’s selector.
1864
- - `expected` _(number)_: The expected value.
1865
-
1866
- ---
1867
-
1868
- #### `shouldNotThrow(fn)`
1869
-
1870
- Asserts that the provided function does not throw an error.
1871
-
1872
- ```javascript
1873
- await shouldNotThrow(() => {
1874
- someFunction();
1875
- });
1876
- ```
1877
-
1878
- - **Parameters**:
1879
- - `fn` _(function)_: The function that should not throw an error.
1880
-
1881
- ---
1882
-
1883
- #### `shouldNotAny(selector, constructor)`
1884
-
1885
- Asserts that the element’s text content is not an instance of the specified constructor.
1886
-
1887
- ```javascript
1888
- await shouldNotAny("#element", Array);
1889
- ```
1890
-
1891
- - **Parameters**:
1892
- - `selector` _(string)_: The target element’s selector.
1893
- - `constructor` _(function)_: The constructor function (e.g., `Array`, `Date`, etc.).
1894
-
1895
- ---
1896
-
1897
- #### `shouldNotAnything(selector)`
1898
-
1899
- Asserts that the element’s text content is not `anything` (e.g., `null`, `undefined`, `false`).
1900
-
1901
- ```javascript
1902
- await shouldNotAnything("#element");
1903
- ```
1904
-
1905
- - **Parameters**:
1906
- - `selector` _(string)_: The target element’s selector.
1907
-
1908
- ---
1909
-
1910
- #### `shouldNotArrayContaining(selector, elements)`
1911
-
1912
- Asserts that the element’s text content is not an array containing the specified elements.
1913
-
1914
- ```javascript
1915
- await shouldNotArrayContaining("#element", ["item1", "item2"]);
1916
- ```
1917
-
1918
- - **Parameters**:
1919
- - `selector` _(string)_: The target element’s selector.
1920
- - `elements` _(array)_: The elements that the array should not contain.
1921
-
1922
- ---
1923
-
1924
- #### `shouldNotCloseTo(selector, expected, precision)`
1925
-
1926
- Asserts that the element’s text content, converted to a number, is not close to the expected value within the specified precision.
1927
-
1928
- ```javascript
1929
- await shouldNotCloseTo("#element", 100, 2);
1930
- ```
1931
-
1932
- - **Parameters**:
1933
- - `selector` _(string)_: The target element’s selector.
1934
- - `expected` _(number)_: The expected value.
1935
- - `precision` _(number)_: The allowed precision (number of decimal places).
1936
-
1937
- ---
1938
-
1939
- #### `shouldNotObjectContaining(selector, properties)`
1940
-
1941
- Asserts that the element’s text content is not an object containing the specified properties.
1942
-
1943
- ```javascript
1944
- await shouldNotObjectContaining("#element", { key: "value" });
1945
- ```
1946
-
1947
- - **Parameters**:
1948
- - `selector` _(string)_: The target element’s selector.
1949
- - `properties` _(object)_: The properties that the object should not contain.
1950
-
1951
- ---
1952
-
1953
- #### `shouldNotStringContaining(selector, substring)`
1954
-
1955
- Asserts that the element’s text content does not contain the specified substring.
1956
-
1957
- ```javascript
1958
- await shouldNotStringContaining("#element", "substring");
1959
- ```
1960
-
1961
- - **Parameters**:
1962
- - `selector` _(string)_: The target element’s selector.
1963
- - `substring` _(string)_: The substring that should not be contained in the text content.
1964
-
1965
- ---
1966
-
1967
- #### `shouldNotStringMatching(selector, regex)`
1968
-
1969
- Asserts that the element’s text content does not match the specified regular expression.
1970
-
1971
- ```javascript
1972
- await shouldNotStringMatching("#element", /regex/);
1973
- ```
1974
-
1975
- - **Parameters**:
1976
- - `selector` _(string)_: The target element’s selector.
1977
- - `regex` _(RegExp)_: The regular expression that the text content should not match.
1978
-
1979
- ---
1980
-
1981
- ### **Frame Functions**
1982
-
1983
- #### `screenshot(selector)`
1984
-
1985
- Takes a screenshot of the specified element and saves it to the configured project path.
1986
-
1987
- ```javascript
1988
- await screenshot("div#content");
1989
- ```
1990
-
1991
- ---
1992
-
1993
- #### `contentFrame(selector)`
1994
-
1995
- Returns the `contentFrame` of the specified element (used for working with iframe content).
1996
-
1997
- ```javascript
1998
- const frame = await contentFrame("iframe#example");
1999
- ```
2000
-
2001
- ---
2002
-
2003
- #### `frameLocator(selector)`
2004
-
2005
- Returns the frame locator for the specified element.
2006
-
2007
- ```javascript
2008
- const locator = await frameLocator("iframe#example");
2009
- ```
2010
-
2011
- ---
2012
-
2013
- ### **Element Locator Functions**
2014
-
2015
- #### `nth(selector, index)`
2016
-
2017
- Returns the nth element matching the selector.
2018
-
2019
- ```javascript
2020
- const nthElement = await nth("div.list-item", 2);
2021
- ```
2022
-
2023
- ---
2024
-
2025
- #### `first(selector)`
2026
-
2027
- Returns the first element matching the selector.
2028
-
2029
- ```javascript
2030
- const firstElement = await first("div.list-item");
2031
- ```
2032
-
2033
- ---
2034
-
2035
- #### `last(selector)`
2036
-
2037
- Returns the last element matching the selector.
2038
-
2039
- ```javascript
2040
- const lastElement = await last("div.list-item");
2041
- ```
2042
-
2043
- ---
2044
-
2045
- #### `filter(selector, filter)`
2046
-
2047
- Returns elements matching the selector and an additional filter.
2048
-
2049
- ```javascript
2050
- const filteredElements = await filter("div.list-item", { hasText: "Active" });
2051
- ```
2052
-
2053
- ---
2054
-
2055
- #### `count(selector)`
2056
-
2057
- Returns the number of elements matching the selector.
2058
-
2059
- ```javascript
2060
- const itemCount = await count("div.list-item");
2061
- ```
2062
-
2063
- ---
2064
-
2065
- ### **Attribute-Based Locators**
2066
-
2067
- #### `getByAltText(text)`
2068
-
2069
- Returns elements that have the specified `alt` text.
2070
-
2071
- ```javascript
2072
- const image = await getByAltText("Profile Picture");
2073
- ```
2074
-
2075
- ---
2076
-
2077
- #### `getByLabel(label)`
2078
-
2079
- Returns elements with a label matching the specified text.
2080
-
2081
- ```javascript
2082
- const input = await getByLabel("Email Address");
2083
- ```
2084
-
2085
- ---
2086
-
2087
- #### `getByPlaceholder(placeholder)`
2088
-
2089
- Returns elements with a placeholder matching the specified text.
2090
-
2091
- ```javascript
2092
- const input = await getByPlaceholder("Enter your name");
2093
- ```
2094
-
2095
- ---
2096
-
2097
- #### `getByRole(role)`
2098
-
2099
- Returns elements with the specified role attribute.
2100
-
2101
- ```javascript
2102
- const button = await getByRole("button");
2103
- ```
2104
-
2105
- ---
2106
-
2107
- #### `getByTestId(testId)`
2108
-
2109
- Returns elements with the specified `data-testid` attribute.
2110
-
2111
- ```javascript
2112
- const element = await getByTestId("submit-button");
2113
- ```
2114
-
2115
- ## API Object Methods
2116
-
2117
- The `api` object provides methods for making HTTP requests with automatic URL resolution, payload processing, and response handling.
2118
-
2119
- ### `api.get(url, payload)`
2120
-
2121
- Makes a GET request to the specified URL.
2122
-
2123
- **Parameters:**
2124
-
2125
- - `url` (string): The target URL (supports variable resolution)
2126
- - `payload` (string, optional): JSON string containing headers and other request options
2127
-
2128
- **Returns:** Promise that resolves when the request completes
2129
-
2130
- **Example:**
2131
-
2132
- ```javascript
2133
- await api.get(
2134
- "https://api.example.com/users",
2135
- JSON.stringify({
2136
- headers: { Authorization: "Bearer {{token}}" },
2137
- }),
2138
- );
2139
- ```
2140
-
2141
- ### `api.head(url)`
2142
-
2143
- Makes a HEAD request to the specified URL.
2144
-
2145
- **Parameters:**
2146
-
2147
- - `url` (string): The target URL (supports variable resolution)
2148
-
2149
- **Returns:** Promise that resolves when the request completes
2150
-
2151
- **Example:**
2152
-
2153
- ```javascript
2154
- await api.head("https://api.example.com/status");
2155
- ```
2156
-
2157
- ### `api.post(url, payload, requestDataType)`
2158
-
2159
- Makes a POST request to the specified URL.
2160
-
2161
- **Parameters:**
2162
-
2163
- - `url` (string): The target URL (supports variable resolution)
2164
- - `payload` (string): JSON string containing headers, body, and other request options
2165
- - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2166
-
2167
- **Returns:** Promise that resolves when the request completes
2168
-
2169
- **Example:**
2170
-
2171
- ```javascript
2172
- // Regular POST request
2173
- await api.post(
2174
- "https://api.example.com/users",
2175
- JSON.stringify({
2176
- headers: { "Content-Type": "application/json" },
2177
- body: { name: "John", email: "john@example.com" },
2178
- }),
2179
- );
2180
-
2181
- // Multipart form data
2182
- await api.post(
2183
- "https://api.example.com/upload",
2184
- JSON.stringify({
2185
- headers: {},
2186
- body: { file: "/path/to/file.pdf", description: "Document upload" },
2187
- }),
2188
- "multipart",
2189
- );
2190
- ```
2191
-
2192
- ### `api.put(url, payload, requestDataType)`
2193
-
2194
- Makes a PUT request to the specified URL.
2195
-
2196
- **Parameters:**
2197
-
2198
- - `url` (string): The target URL (supports variable resolution)
2199
- - `payload` (string): JSON string containing headers, body, and other request options
2200
- - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2201
-
2202
- **Returns:** Promise that resolves when the request completes
2203
-
2204
- **Example:**
2205
-
2206
- ```javascript
2207
- await api.put(
2208
- "https://api.example.com/users/{{userId}}",
2209
- JSON.stringify({
2210
- headers: { "Content-Type": "application/json" },
2211
- body: { name: "Updated Name" },
2212
- }),
2213
- );
2214
- ```
2215
-
2216
- ### `api.patch(url, payload, requestDataType)`
2217
-
2218
- Makes a PATCH request to the specified URL.
2219
-
2220
- **Parameters:**
2221
-
2222
- - `url` (string): The target URL (supports variable resolution)
2223
- - `payload` (string): JSON string containing headers, body, and other request options
2224
- - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2225
-
2226
- **Returns:** Promise that resolves when the request completes
2227
-
2228
- **Example:**
2229
-
2230
- ```javascript
2231
- await api.patch(
2232
- "https://api.example.com/users/{{userId}}",
2233
- JSON.stringify({
2234
- headers: { "Content-Type": "application/json" },
2235
- body: { email: "newemail@example.com" },
2236
- }),
2237
- );
2238
- ```
2239
-
2240
- ### `api.delete(url, payload)`
2241
-
2242
- Makes a DELETE request to the specified URL.
2243
-
2244
- **Parameters:**
2245
-
2246
- - `url` (string): The target URL (supports variable resolution)
2247
- - `payload` (string, optional): JSON string containing headers and other request options
2248
-
2249
- **Returns:** Promise that resolves when the request completes
2250
-
2251
- **Example:**
2252
-
2253
- ```javascript
2254
- await api.delete(
2255
- "https://api.example.com/users/{{userId}}",
2256
- JSON.stringify({
2257
- headers: { Authorization: "Bearer {{token}}" },
2258
- }),
2259
- );
2260
- ```
2261
-
2262
- ### `api.vars()`
2263
-
2264
- Returns the current context variables object.
2265
-
2266
- **Returns:** Object containing all stored variables
2267
-
2268
- **Example:**
2269
-
2270
- ```javascript
2271
- const currentVars = api.vars();
2272
- console.log(currentVars); // { token: "abc123", userId: "user456" }
2273
- ```
2274
-
2275
- ## Static Methods
2276
-
2277
- ### `extractVarsFromResponse(object, vars, customVarName)`
2278
-
2279
- Extracts variables from the response body using dot notation paths.
2280
-
2281
- **Parameters:**
2282
-
2283
- - `vars` (string): Comma-separated list of dot notation paths (e.g., "user.id,user.name")
2284
- - `customVarName` (string, optional): Custom variable name to use instead of auto-generated names
2285
-
2286
- **Behavior:**
2287
-
2288
- - Extracts values from `context.response.responseBody` using specified paths
2289
- - Saves extracted values as variables using `saveVar()`
2290
- - If `customVarName` is provided, uses it; otherwise generates camelCase names
2291
-
2292
- **Example:**
2293
-
2294
- ```javascript
2295
- // Response body: { user: { id: 123, profile: { name: "John" } } }
2296
- extractVarsFromResponse(object, "user.id,user.profile.name");
2297
- // Creates variables: userId = 123, userProfileName = "John"
2298
-
2299
- extractVarsFromResponse(object, "user.id", "currentUserId");
2300
- // Creates variable: currentUserId = 123
2301
- ```
2302
-
2303
- ### `saveVar(value, customName, path)`
2304
-
2305
- Saves a variable to the context with either a custom name or auto-generated camelCase name.
2306
-
2307
- **Parameters:**
2308
-
2309
- - `value` (any): The value to store
2310
- - `customName` (string, optional): Custom variable name
2311
- - `path` (string): Dot notation path used for auto-generating variable name
2312
-
2313
- **Behavior:**
2314
-
2315
- - If `customName` is provided, uses it as the variable name
2316
- - Otherwise, converts dot notation path to camelCase (e.g., "user.profile.name" → "userProfileName")
2317
-
2318
- ### `resolveVariable(template)`
2319
-
2320
- Resolves variable placeholders in template strings using the format `{{variableName}}`.
2321
-
2322
- **Parameters:**
2323
-
2324
- - `template` (string): Template string containing variable placeholders
2325
-
2326
- **Returns:** String with variables resolved, or original value if not a string
2327
-
2328
- **Example:**
2329
-
2330
- ```javascript
2331
- // Assuming context.vars = { userId: "123", token: "abc" }
2332
- resolveVariable("https://api.example.com/users/{{userId}}");
2333
- // Returns: "https://api.example.com/users/123"
2334
-
2335
- resolveVariable("Bearer {{token}}");
2336
- // Returns: "Bearer abc"
2337
- ```
2338
-
2339
- ## Usage Examples
2340
-
2341
- ### Basic API Usage
2342
-
2343
- ```javascript
2344
- // Set up variables
2345
- context.vars.baseUrl = "https://api.example.com";
2346
- context.vars.token = "your-auth-token";
2347
-
2348
- // Make a GET request
2349
- await api.get(
2350
- "{{baseUrl}}/users",
2351
- JSON.stringify({
2352
- headers: { Authorization: "Bearer {{token}}" },
2353
- }),
2354
- );
2355
-
2356
- // Extract user ID from response
2357
- extractVarsFromResponse("data.0.id", "firstUserId");
2358
-
2359
- // Use extracted variable in subsequent request
2360
- await api.get("{{baseUrl}}/users/{{firstUserId}}/profile");
2361
- ```
2362
-
2363
- ### File Upload Example
2364
-
2365
- ```javascript
2366
- await api.post(
2367
- "{{baseUrl}}/upload",
2368
- JSON.stringify({
2369
- headers: { Authorization: "Bearer {{token}}" },
2370
- body: {
2371
- file: "/path/to/document.pdf",
2372
- description: "Important document",
2373
- metadata: { type: "legal", priority: "high" },
2374
- },
2375
- }),
2376
- "multipart",
2377
- );
2378
- ```
2379
-
2380
- ### Variable Extraction and Chaining
2381
-
2382
- ```javascript
2383
- // Login request
2384
- await api.post(
2385
- "{{baseUrl}}/auth/login",
2386
- JSON.stringify({
2387
- body: { username: "user@example.com", password: "password" },
2388
- }),
2389
- );
2390
-
2391
- // Extract token from login response
2392
- extractVarsFromResponse("access_token", "authToken");
2393
-
2394
- // Use token in protected endpoint
2395
- await api.get(
2396
- "{{baseUrl}}/protected-data",
2397
- JSON.stringify({
2398
- headers: { Authorization: "Bearer {{authToken}}" },
2399
- }),
2400
- );
2401
- ```
1
+ ## 📋 Simplified Functions
2
+
3
+ If you don't want to deal with Playwright methods directly, you can simply use the following predefined actions methods by import them:
4
+
5
+ ```javascript
6
+ const {
7
+ mouse,
8
+ keyboard,
9
+ frame,
10
+ elementInteractions,
11
+ page,
12
+ api,
13
+ } = require("artes");
14
+ ```
15
+
16
+ - **Mouse Actions:**
17
+ `mouse.click(element)`
18
+
19
+ - **Keyboard Actions:**
20
+ `keyboard.press(key)`
21
+
22
+ - **Element Interactions:**
23
+ `elementInteractions.isChecked()`
24
+
25
+ - **Assertions:**
26
+ `assert.shouldBeTruthy(element)`
27
+
28
+ - **Frame Actions:**
29
+ `frame.first()`
30
+
31
+ - **API Actions:**
32
+ `api.post(url, payload, requestDataType)`
33
+
34
+ ---
35
+
36
+ ## Table of Contents
37
+
38
+ - [Mouse Functions](#mouse-functions)
39
+ - [Keyboard Functions](#keyboard-functions)
40
+ - [Assertions Functions](#assertions-functions)
41
+ - [Page Functions](#page-functions)
42
+ - [Frame Functions](#frame-functions)
43
+ - [API Functions](#api-object-methods)
44
+ - [Usage Examples](#usage-examples)
45
+
46
+ ### **Mouse Functions**
47
+
48
+ #### `click(selector)`
49
+
50
+ Clicks on the specified element.
51
+
52
+ ```javascript
53
+ await click("button#submit");
54
+ ```
55
+
56
+ ---
57
+
58
+ #### `forceClick(selector)`
59
+
60
+ Clicks on the specified element, forcing the action even if not visible.
61
+
62
+ ```javascript
63
+ await forceClick("button#hiddenSubmit");
64
+ ```
65
+
66
+ ---
67
+
68
+ #### `clickPosition(selector, position)`
69
+
70
+ Clicks on a specific position within the element, specified as `x,y`.
71
+
72
+ ```javascript
73
+ await clickPosition("div#map", "50,100");
74
+ ```
75
+
76
+ ---
77
+
78
+ #### `forceClickPosition(selector, position)`
79
+
80
+ Forces a click at a specific position within the element.
81
+
82
+ ```javascript
83
+ await forceClickPosition("div#map", "50,100");
84
+ ```
85
+
86
+ ---
87
+
88
+ #### `rightClick(selector)`
89
+
90
+ Performs a right-click on the element.
91
+
92
+ ```javascript
93
+ await rightClick("div#contextMenu");
94
+ ```
95
+
96
+ ---
97
+
98
+ #### `forceRightClick(selector)`
99
+
100
+ Forces a right-click on the element.
101
+
102
+ ```javascript
103
+ await forceRightClick("div#hiddenContextMenu");
104
+ ```
105
+
106
+ ---
107
+
108
+ #### `leftClick(selector)`
109
+
110
+ Performs a left-click on the element (default click).
111
+
112
+ ```javascript
113
+ await leftClick("button#start");
114
+ ```
115
+
116
+ ---
117
+
118
+ #### `forceLeftClick(selector)`
119
+
120
+ Forces a left-click on the element.
121
+
122
+ ```javascript
123
+ await forceLeftClick("button#hiddenStart");
124
+ ```
125
+
126
+ ---
127
+
128
+ #### `doubleClick(selector)`
129
+
130
+ Performs a double-click on the element.
131
+
132
+ ```javascript
133
+ await doubleClick("input#textBox");
134
+ ```
135
+
136
+ ---
137
+
138
+ #### `forceDoubleClick(selector)`
139
+
140
+ Forces a double-click on the element.
141
+
142
+ ```javascript
143
+ await forceDoubleClick("input#hiddenTextBox");
144
+ ```
145
+
146
+ ---
147
+
148
+ #### `forceDoubleClickPosition(selector, position)`
149
+
150
+ Forces a double-click at a specific position within the element.
151
+
152
+ ```javascript
153
+ await forceDoubleClickPosition("div#image", "100,150");
154
+ ```
155
+
156
+ ---
157
+
158
+ ### **Hover Functions**
159
+
160
+ #### `hover(selector)`
161
+
162
+ Moves the mouse pointer over the element.
163
+
164
+ ```javascript
165
+ await hover("button#hoverMe");
166
+ ```
167
+
168
+ ---
169
+
170
+ #### `forceHover(selector)`
171
+
172
+ Forces a hover action over the element.
173
+
174
+ ```javascript
175
+ await forceHover("button#hiddenHoverMe");
176
+ ```
177
+
178
+ ---
179
+
180
+ #### `hoverPosition(selector, position)`
181
+
182
+ Hovers at a specific position within the element.
183
+
184
+ ```javascript
185
+ await hoverPosition("div#image", "75,50");
186
+ ```
187
+
188
+ ---
189
+
190
+ #### `forceHoverPosition(selector, position)`
191
+
192
+ Forces a hover at a specific position within the element.
193
+
194
+ ```javascript
195
+ await forceHoverPosition("div#hiddenImage", "75,50");
196
+ ```
197
+
198
+ ---
199
+
200
+ ### **Focus Functions**
201
+
202
+ #### `focus(selector)`
203
+
204
+ Focuses on the specified element.
205
+
206
+ ```javascript
207
+ await focus("input#username");
208
+ ```
209
+
210
+ ---
211
+
212
+ #### `forceFocus(selector)`
213
+
214
+ Forces focus on the specified element.
215
+
216
+ ```javascript
217
+ await forceFocus("input#hiddenUsername");
218
+ ```
219
+
220
+ ---
221
+
222
+ #### `focusPosition(selector, position)`
223
+
224
+ Focuses on a specific position within the element.
225
+
226
+ ```javascript
227
+ await focusPosition("div#editor", "200,300");
228
+ ```
229
+
230
+ ---
231
+
232
+ #### `forceFocusPosition(selector, position)`
233
+
234
+ Forces focus at a specific position within the element.
235
+
236
+ ```javascript
237
+ await forceFocusPosition("div#hiddenEditor", "200,300");
238
+ ```
239
+
240
+ ---
241
+
242
+ ### **Drag-and-Drop Functions**
243
+
244
+ #### `dragAndDrop(sourceSelector, targetSelector)`
245
+
246
+ Drags an element from the source and drops it at the target.
247
+
248
+ ```javascript
249
+ await dragAndDrop("div#source", "div#target");
250
+ ```
251
+
252
+ ---
253
+
254
+ #### `dragAndDropPosition(sourceSelector, position)`
255
+
256
+ Drags an element and drops it at a specified position.
257
+
258
+ ```javascript
259
+ await dragAndDropPosition("div#source", "300,400");
260
+ ```
261
+
262
+ ---
263
+
264
+ ### **Select Functions**
265
+
266
+ #### `selectByValue(selector, value)`
267
+
268
+ Selects an option in a dropdown by value.
269
+
270
+ ```javascript
271
+ await selectByValue("select#dropdown", "value1,value2");
272
+ ```
273
+
274
+ ---
275
+
276
+ #### `selectByText(selector, value)`
277
+
278
+ Selects an option in a dropdown by visible text.
279
+
280
+ ```javascript
281
+ await selectByText("select#dropdown", "Option 1");
282
+ ```
283
+
284
+ ---
285
+
286
+ ### **Checkbox Functions**
287
+
288
+ #### `check(selector)`
289
+
290
+ Checks the specified checkbox.
291
+
292
+ ```javascript
293
+ await check("input#termsCheckbox");
294
+ ```
295
+
296
+ ---
297
+
298
+ #### `uncheck(selector)`
299
+
300
+ Unchecks the specified checkbox.
301
+
302
+ ```javascript
303
+ await uncheck("input#termsCheckbox");
304
+ ```
305
+
306
+ ---
307
+
308
+ ### **Scroll Functions**
309
+
310
+ #### `scrollIntoViewIfNeeded(selector)`
311
+
312
+ Scrolls the element into view if it is not already visible.
313
+
314
+ ```javascript
315
+ await scrollIntoViewIfNeeded("div#content");
316
+ ```
317
+
318
+ ---
319
+
320
+ ### **Keyboard Functions**
321
+
322
+ #### `press(selector, key)`
323
+
324
+ Simulates a key press on the specified element.
325
+
326
+ ```javascript
327
+ await press("input#searchBox", "Enter");
328
+ ```
329
+
330
+ ---
331
+
332
+ #### `pressSequentially(selector, keys)`
333
+
334
+ Presses a sequence of keys on the specified element.
335
+
336
+ ```javascript
337
+ await pressSequentially("input#textField", ["Shift", "A", "B", "C"]);
338
+ ```
339
+
340
+ ---
341
+
342
+ #### `pressSequentiallyDelay(selector, keys, delay)`
343
+
344
+ Presses a sequence of keys on the specified element with a delay between each key press.
345
+
346
+ ```javascript
347
+ await pressSequentiallyDelay("input#textField", ["H", "E", "L", "L", "O"], 200);
348
+ ```
349
+
350
+ ---
351
+
352
+ #### `fill(selector, value)`
353
+
354
+ Fills the specified element (like an input field) with the provided value.
355
+
356
+ ```javascript
357
+ await fill("input#email", "example@example.com");
358
+ ```
359
+
360
+ ---
361
+
362
+ #### `clear(selector)`
363
+
364
+ Clears the value of the specified input field.
365
+
366
+ ```javascript
367
+ await clear("input#email");
368
+ ```
369
+
370
+ ---
371
+
372
+ #### `selectText(selector)`
373
+
374
+ Selects the text within the specified element.
375
+
376
+ ```javascript
377
+ await selectText("input#email");
378
+ ```
379
+
380
+ ---
381
+
382
+ #### `setInputFiles(selector, files)`
383
+
384
+ Sets the specified file(s) to an input field.
385
+
386
+ ```javascript
387
+ await setInputFiles("input#fileUpload", [
388
+ "path/to/file1.png",
389
+ "path/to/file2.jpg",
390
+ ]);
391
+ ```
392
+
393
+ ### **Page Functions**
394
+
395
+ #### `navigateTo(url)`
396
+
397
+ Navigates to the specified URL in the current page context.
398
+
399
+ ```javascript
400
+ await navigateTo("https://example.com");
401
+ ```
402
+
403
+ - **Parameters**:
404
+ - `url` _(string)_: The URL to navigate to.
405
+
406
+ ---
407
+
408
+ #### `navigateBack()`
409
+
410
+ Navigates to the previous page.
411
+
412
+ ```javascript
413
+ navigateBack();
414
+ ```
415
+
416
+ ---
417
+
418
+ #### `navigateForward()`
419
+
420
+ Navigates to the next page.
421
+
422
+ ```javascript
423
+ navigateForward();
424
+ ```
425
+
426
+ ---
427
+
428
+ #### `getURL()`
429
+
430
+ Retrieves the current URL of the page.
431
+
432
+ ```javascript
433
+ await getURL();
434
+ ```
435
+
436
+ - **Returns**:
437
+ - _(string)_: The current page URL.
438
+
439
+ ***
440
+
441
+ #### `wait()`
442
+
443
+ Waits on the page until specified times.
444
+
445
+ ```javascript
446
+ await wait(time);
447
+ ```
448
+
449
+ - **Parameters**:
450
+ - `time` _(int)_: millisecond.
451
+
452
+ ---
453
+
454
+ ### **Assertions Functions**
455
+
456
+ #### `shouldBeAttached(selector)`
457
+
458
+ Asserts that the element is attached to the DOM.
459
+
460
+ ```javascript
461
+ await shouldBeAttached("#element-id");
462
+ ```
463
+
464
+ ---
465
+
466
+ #### `shouldBeChecked(selector)`
467
+
468
+ Asserts that the element is checked (e.g., a checkbox).
469
+
470
+ ```javascript
471
+ await shouldBeChecked("#checkbox-id");
472
+ ```
473
+
474
+ ---
475
+
476
+ #### `shouldBeDisabled(selector)`
477
+
478
+ Asserts that the element is disabled.
479
+
480
+ ```javascript
481
+ await shouldBeDisabled("#button-id");
482
+ ```
483
+
484
+ ---
485
+
486
+ #### `shouldBeEditable(selector)`
487
+
488
+ Asserts that the element is editable (e.g., an input field).
489
+
490
+ ```javascript
491
+ await shouldBeEditable("#input-id");
492
+ ```
493
+
494
+ ---
495
+
496
+ #### `shouldBeEmpty(selector)`
497
+
498
+ Asserts that the element has no content.
499
+
500
+ ```javascript
501
+ await shouldBeEmpty("#container-id");
502
+ ```
503
+
504
+ ---
505
+
506
+ #### `shouldBeEnabled(selector)`
507
+
508
+ Asserts that the element is enabled.
509
+
510
+ ```javascript
511
+ await shouldBeEnabled("#button-id");
512
+ ```
513
+
514
+ ---
515
+
516
+ #### `shouldBeFocused(selector)`
517
+
518
+ Asserts that the element is currently focused.
519
+
520
+ ```javascript
521
+ await shouldBeFocused("#input-id");
522
+ ```
523
+
524
+ ---
525
+
526
+ #### `shouldBeHidden(selector)`
527
+
528
+ Asserts that the element is hidden.
529
+
530
+ ```javascript
531
+ await shouldBeHidden("#hidden-element-id");
532
+ ```
533
+
534
+ ---
535
+
536
+ #### `shouldBeInViewport(selector)`
537
+
538
+ Asserts that the element is visible within the viewport.
539
+
540
+ ```javascript
541
+ await shouldBeInViewport("#element-id");
542
+ ```
543
+
544
+ ---
545
+
546
+ #### `shouldBeVisible(selector)`
547
+
548
+ Asserts that the element is visible.
549
+
550
+ ```javascript
551
+ await shouldBeVisible("#visible-element-id");
552
+ ```
553
+
554
+ ---
555
+
556
+ #### `shouldContainText(selector, text)`
557
+
558
+ Asserts that the element contains the specified text.
559
+
560
+ ```javascript
561
+ await shouldContainText("#element-id", "Expected Text");
562
+ ```
563
+
564
+ - **Parameters**:
565
+ - `text` _(string)_: The text to check for.
566
+
567
+ ---
568
+
569
+ #### `shouldHaveAccessibleDescription(selector, description)`
570
+
571
+ Asserts that the element has the specified accessible description.
572
+
573
+ ```javascript
574
+ await shouldHaveAccessibleDescription("#element-id", "Description");
575
+ ```
576
+
577
+ - **Parameters**:
578
+ - `description` _(string)_: The expected accessible description.
579
+
580
+ ---
581
+
582
+ #### `shouldHaveAccessibleName(selector, name)`
583
+
584
+ Asserts that the element has the specified accessible name.
585
+
586
+ ```javascript
587
+ await shouldHaveAccessibleName("#element-id", "Name");
588
+ ```
589
+
590
+ - **Parameters**:
591
+ - `name` _(string)_: The expected accessible name.
592
+
593
+ ---
594
+
595
+ #### `shouldHaveAttribute(selector, attribute, value)`
596
+
597
+ Asserts that the element has the specified attribute with the given value.
598
+
599
+ ```javascript
600
+ await shouldHaveAttribute("#element-id", "data-type", "example");
601
+ ```
602
+
603
+ - **Parameters**:
604
+ - `attribute` _(string)_: The attribute to check.
605
+ - `value` _(string)_: The expected value of the attribute.
606
+
607
+ ---
608
+
609
+ #### `shouldHaveClass(selector, className)`
610
+
611
+ Asserts that the element has the specified class.
612
+
613
+ ```javascript
614
+ await shouldHaveClass("#element-id", "active-class");
615
+ ```
616
+
617
+ - **Parameters**:
618
+ - `className` _(string)_: The expected class name.
619
+
620
+ ---
621
+
622
+ #### `shouldHaveCount(selector, count)`
623
+
624
+ Asserts that the number of matching elements equals the specified count.
625
+
626
+ ```javascript
627
+ await shouldHaveCount(".list-item", 5);
628
+ ```
629
+
630
+ - **Parameters**:
631
+ - `count` _(number)_: The expected number of elements.
632
+
633
+ ---
634
+
635
+ #### `shouldHaveCSS(selector, property, value)`
636
+
637
+ Asserts that the element has the specified CSS property with the given value.
638
+
639
+ ```javascript
640
+ await shouldHaveCSS("#element-id", "color", "red");
641
+ ```
642
+
643
+ - **Parameters**:
644
+ - `property` _(string)_: The CSS property to check.
645
+ - `value` _(string)_: The expected value of the property.
646
+
647
+ ---
648
+
649
+ #### `shouldHaveId(selector, id)`
650
+
651
+ Asserts that the element has the specified ID.
652
+
653
+ ```javascript
654
+ await shouldHaveId("#element-id", "unique-id");
655
+ ```
656
+
657
+ - **Parameters**:
658
+ - `id` _(string)_: The expected ID.
659
+
660
+ Got it! Here’s the refined format for the assertion methods:
661
+
662
+ ---
663
+
664
+ #### `shouldHaveJSProperty(selector, property, value)`
665
+
666
+ Asserts that the element has the specified JavaScript property with the expected value.
667
+
668
+ ```javascript
669
+ await shouldHaveJSProperty("#element", "disabled", true);
670
+ ```
671
+
672
+ - **Parameters**:
673
+ - `selector` _(string)_: The target element’s selector.
674
+ - `property` _(string)_: The JavaScript property to check.
675
+ - `value` _(any)_: The expected value of the property.
676
+
677
+ ---
678
+
679
+ #### `shouldHaveRole(selector, role)`
680
+
681
+ Asserts that the element has the specified role.
682
+
683
+ ```javascript
684
+ await shouldHaveRole("#element", "button");
685
+ ```
686
+
687
+ - **Parameters**:
688
+ - `selector` _(string)_: The target element’s selector.
689
+ - `role` _(string)_: The expected role of the element.
690
+
691
+ ---
692
+
693
+ #### `shouldHaveScreenshot(selector)`
694
+
695
+ Asserts that the element has a screenshot.
696
+
697
+ ```javascript
698
+ await shouldHaveScreenshot("#element");
699
+ ```
700
+
701
+ - **Parameters**:
702
+ - `selector` _(string)_: The target element’s selector.
703
+
704
+ ---
705
+
706
+ #### `shouldHaveText(selector, text)`
707
+
708
+ Asserts that the element contains the specified text.
709
+
710
+ ```javascript
711
+ await shouldHaveText("#element", "Hello World");
712
+ ```
713
+
714
+ - **Parameters**:
715
+ - `selector` _(string)_: The target element’s selector.
716
+ - `text` _(string)_: The expected text in the element.
717
+
718
+ ---
719
+
720
+ #### `shouldHaveValue(selector, value)`
721
+
722
+ Asserts that the element has the specified value.
723
+
724
+ ```javascript
725
+ await shouldHaveValue("#input-field", "test value");
726
+ ```
727
+
728
+ - **Parameters**:
729
+ - `selector` _(string)_: The target element’s selector.
730
+ - `value` _(string)_: The expected value of the element.
731
+
732
+ ---
733
+
734
+ #### `shouldHaveValues(selector, values)`
735
+
736
+ Asserts that the element has the specified values.
737
+
738
+ ```javascript
739
+ await shouldHaveValues("#multi-select", ["Option 1", "Option 2"]);
740
+ ```
741
+
742
+ - **Parameters**:
743
+ - `selector` _(string)_: The target element’s selector.
744
+ - `values` _(array)_: The expected values in the element.
745
+
746
+ ---
747
+
748
+ #### `shouldPageHaveScreenshot()`
749
+
750
+ Asserts that the current page has a screenshot.
751
+
752
+ ```javascript
753
+ await shouldPageHaveScreenshot();
754
+ ```
755
+
756
+ - **Parameters**:
757
+ None
758
+
759
+ ---
760
+
761
+ #### `shouldPageHaveTitle(title)`
762
+
763
+ Asserts that the page has the specified title.
764
+
765
+ ```javascript
766
+ await shouldPageHaveTitle("Page Title");
767
+ ```
768
+
769
+ - **Parameters**:
770
+ - `title` _(string)_: The expected title of the page.
771
+
772
+ ---
773
+
774
+ #### `shouldPageHaveURL(url)`
775
+
776
+ Asserts that the page has the specified URL.
777
+
778
+ ```javascript
779
+ await shouldPageHaveURL("https://www.example.com");
780
+ ```
781
+
782
+ - **Parameters**:
783
+ - `url` _(string)_: The expected URL of the page.
784
+
785
+ ---
786
+
787
+ #### `shouldResponseBeOK(response)`
788
+
789
+ Asserts that the response status is OK (200).
790
+
791
+ ```javascript
792
+ await shouldResponseBeOK(response);
793
+ ```
794
+
795
+ - **Parameters**:
796
+ - `response` _(object)_: The response object to check.
797
+
798
+ #### `shouldNotBeAttached(selector)`
799
+
800
+ Asserts that the element is not attached to the DOM.
801
+
802
+ ```javascript
803
+ await shouldNotBeAttached("#element");
804
+ ```
805
+
806
+ - **Parameters**:
807
+ - `selector` _(string)_: The target element’s selector.
808
+
809
+ ---
810
+
811
+ #### `shouldNotBeChecked(selector)`
812
+
813
+ Asserts that the element is not checked.
814
+
815
+ ```javascript
816
+ await shouldNotBeChecked("#checkbox");
817
+ ```
818
+
819
+ - **Parameters**:
820
+ - `selector` _(string)_: The target element’s selector.
821
+
822
+ ---
823
+
824
+ #### `shouldNotBeDisabled(selector)`
825
+
826
+ Asserts that the element is not disabled.
827
+
828
+ ```javascript
829
+ await shouldNotBeDisabled("#button");
830
+ ```
831
+
832
+ - **Parameters**:
833
+ - `selector` _(string)_: The target element’s selector.
834
+
835
+ ---
836
+
837
+ #### `shouldNotBeEditable(selector)`
838
+
839
+ Asserts that the element is not editable.
840
+
841
+ ```javascript
842
+ await shouldNotBeEditable("#input");
843
+ ```
844
+
845
+ - **Parameters**:
846
+ - `selector` _(string)_: The target element’s selector.
847
+
848
+ ---
849
+
850
+ #### `shouldNotBeEmpty(selector)`
851
+
852
+ Asserts that the element is not empty.
853
+
854
+ ```javascript
855
+ await shouldNotBeEmpty("#input-field");
856
+ ```
857
+
858
+ - **Parameters**:
859
+ - `selector` _(string)_: The target element’s selector.
860
+
861
+ ---
862
+
863
+ #### `shouldNotBeEnabled(selector)`
864
+
865
+ Asserts that the element is not enabled.
866
+
867
+ ```javascript
868
+ await shouldNotBeEnabled("#button");
869
+ ```
870
+
871
+ - **Parameters**:
872
+ - `selector` _(string)_: The target element’s selector.
873
+
874
+ ---
875
+
876
+ #### `shouldNotBeFocused(selector)`
877
+
878
+ Asserts that the element is not focused.
879
+
880
+ ```javascript
881
+ await shouldNotBeFocused("#element");
882
+ ```
883
+
884
+ - **Parameters**:
885
+ - `selector` _(string)_: The target element’s selector.
886
+
887
+ ---
888
+
889
+ #### `shouldNotBeHidden(selector)`
890
+
891
+ Asserts that the element is not hidden.
892
+
893
+ ```javascript
894
+ await shouldNotBeHidden("#element");
895
+ ```
896
+
897
+ - **Parameters**:
898
+ - `selector` _(string)_: The target element’s selector.
899
+
900
+ ---
901
+
902
+ #### `shouldNotBeInViewport(selector)`
903
+
904
+ Asserts that the element is not in the viewport.
905
+
906
+ ```javascript
907
+ await shouldNotBeInViewport("#element");
908
+ ```
909
+
910
+ - **Parameters**:
911
+ - `selector` _(string)_: The target element’s selector.
912
+
913
+ ---
914
+
915
+ #### `shouldNotBeVisible(selector)`
916
+
917
+ Asserts that the element is not visible.
918
+
919
+ ```javascript
920
+ await shouldNotBeVisible("#element");
921
+ ```
922
+
923
+ - **Parameters**:
924
+ - `selector` _(string)_: The target element’s selector.
925
+
926
+ ---
927
+
928
+ #### `shouldNotContainText(selector, text)`
929
+
930
+ Asserts that the element does not contain the specified text.
931
+
932
+ ```javascript
933
+ await shouldNotContainText("#element", "Some text");
934
+ ```
935
+
936
+ - **Parameters**:
937
+ - `selector` _(string)_: The target element’s selector.
938
+ - `text` _(string)_: The text that should not be present in the element.
939
+
940
+ ---
941
+
942
+ #### `shouldNotHaveAccessibleDescription(selector, description)`
943
+
944
+ Asserts that the element does not have the specified accessible description.
945
+
946
+ ```javascript
947
+ await shouldNotHaveAccessibleDescription("#element", "Description");
948
+ ```
949
+
950
+ - **Parameters**:
951
+ - `selector` _(string)_: The target element’s selector.
952
+ - `description` _(string)_: The description that should not be associated with the element.
953
+
954
+ ---
955
+
956
+ #### `shouldNotHaveAccessibleName(selector, name)`
957
+
958
+ Asserts that the element does not have the specified accessible name.
959
+
960
+ ```javascript
961
+ await shouldNotHaveAccessibleName("#element", "Element Name");
962
+ ```
963
+
964
+ - **Parameters**:
965
+ - `selector` _(string)_: The target element’s selector.
966
+ - `name` _(string)_: The name that should not be associated with the element.
967
+
968
+ ---
969
+
970
+ #### `shouldNotHaveAttribute(selector, attribute, value)`
971
+
972
+ Asserts that the element does not have the specified attribute with the given value.
973
+
974
+ ```javascript
975
+ await shouldNotHaveAttribute("#element", "type", "submit");
976
+ ```
977
+
978
+ - **Parameters**:
979
+ - `selector` _(string)_: The target element’s selector.
980
+ - `attribute` _(string)_: The attribute to check.
981
+ - `value` _(string)_: The expected value of the attribute.
982
+
983
+ ---
984
+
985
+ #### `shouldNotHaveClass(selector, className)`
986
+
987
+ Asserts that the element does not have the specified class.
988
+
989
+ ```javascript
990
+ await shouldNotHaveClass("#element", "disabled");
991
+ ```
992
+
993
+ - **Parameters**:
994
+ - `selector` _(string)_: The target element’s selector.
995
+ - `className` _(string)_: The class that should not be associated with the element.
996
+
997
+ ---
998
+
999
+ #### `shouldNotHaveCount(selector, count)`
1000
+
1001
+ Asserts that the number of elements matching the selector is not equal to the specified count.
1002
+
1003
+ ```javascript
1004
+ await shouldNotHaveCount("#element", 5);
1005
+ ```
1006
+
1007
+ - **Parameters**:
1008
+ - `selector` _(string)_: The target element’s selector.
1009
+ - `count` _(number)_: The expected count of elements.
1010
+
1011
+ ---
1012
+
1013
+ #### `shouldNotHaveCSS(selector, property, value)`
1014
+
1015
+ Asserts that the element does not have the specified CSS property with the given value.
1016
+
1017
+ ```javascript
1018
+ await shouldNotHaveCSS("#element", "color", "red");
1019
+ ```
1020
+
1021
+ - **Parameters**:
1022
+ - `selector` _(string)_: The target element’s selector.
1023
+ - `property` _(string)_: The CSS property to check.
1024
+ - `value` _(string)_: The expected value of the property.
1025
+
1026
+ ---
1027
+
1028
+ #### `shouldNotHaveId(selector, id)`
1029
+
1030
+ Asserts that the element does not have the specified ID.
1031
+
1032
+ ```javascript
1033
+ await shouldNotHaveId("#element", "unique-id");
1034
+ ```
1035
+
1036
+ - **Parameters**:
1037
+ - `selector` _(string)_: The target element’s selector.
1038
+ - `id` _(string)_: The ID that should not be associated with the element.
1039
+
1040
+ ---
1041
+
1042
+ #### `shouldNotHaveJSProperty(selector, property, value)`
1043
+
1044
+ Asserts that the element does not have the specified JavaScript property with the given value.
1045
+
1046
+ ```javascript
1047
+ await shouldNotHaveJSProperty("#element", "disabled", true);
1048
+ ```
1049
+
1050
+ - **Parameters**:
1051
+ - `selector` _(string)_: The target element’s selector.
1052
+ - `property` _(string)_: The JavaScript property to check.
1053
+ - `value` _(any)_: The value that the property should not have.
1054
+
1055
+ ---
1056
+
1057
+ #### `shouldNotHaveRole(selector, role)`
1058
+
1059
+ Asserts that the element does not have the specified role.
1060
+
1061
+ ```javascript
1062
+ await shouldNotHaveRole("#element", "button");
1063
+ ```
1064
+
1065
+ - **Parameters**:
1066
+ - `selector` _(string)_: The target element’s selector.
1067
+ - `role` _(string)_: The role that should not be associated with the element.
1068
+
1069
+ ---
1070
+
1071
+ #### `shouldNotHaveScreenshot(selector)`
1072
+
1073
+ Asserts that the element does not have a screenshot.
1074
+
1075
+ ```javascript
1076
+ await shouldNotHaveScreenshot("#element");
1077
+ ```
1078
+
1079
+ - **Parameters**:
1080
+ - `selector` _(string)_: The target element’s selector.
1081
+
1082
+ ---
1083
+
1084
+ #### `shouldNotHaveText(selector, text)`
1085
+
1086
+ Asserts that the element does not contain the specified text.
1087
+
1088
+ ```javascript
1089
+ await shouldNotHaveText("#element", "Some text");
1090
+ ```
1091
+
1092
+ - **Parameters**:
1093
+ - `selector` _(string)_: The target element’s selector.
1094
+ - `text` _(string)_: The text that should not be present in the element.
1095
+
1096
+ ---
1097
+
1098
+ #### `shouldNotHaveValue(selector, value)`
1099
+
1100
+ Asserts that the element does not have the specified value.
1101
+
1102
+ ```javascript
1103
+ await shouldNotHaveValue("#element", "input value");
1104
+ ```
1105
+
1106
+ - **Parameters**:
1107
+ - `selector` _(string)_: The target element’s selector.
1108
+ - `value` _(string)_: The value that should not be present in the element.
1109
+
1110
+ ---
1111
+
1112
+ #### `shouldNotHaveValues(selector, values)`
1113
+
1114
+ Asserts that the element does not have the specified values.
1115
+
1116
+ ```javascript
1117
+ await shouldNotHaveValues("#element", ["value1", "value2"]);
1118
+ ```
1119
+
1120
+ - **Parameters**:
1121
+ - `selector` _(string)_: The target element’s selector.
1122
+ - `values` _(array)_: The values that should not be present in the element.
1123
+
1124
+ ---
1125
+
1126
+ #### `shouldNotPageHaveScreenshot()`
1127
+
1128
+ Asserts that the page does not have a screenshot.
1129
+
1130
+ ```javascript
1131
+ await shouldNotPageHaveScreenshot();
1132
+ ```
1133
+
1134
+ - **Parameters**:
1135
+ - None.
1136
+
1137
+ ---
1138
+
1139
+ #### `shouldNotPageHaveTitle(title)`
1140
+
1141
+ Asserts that the page does not have the specified title.
1142
+
1143
+ ```javascript
1144
+ await shouldNotPageHaveTitle("Page Title");
1145
+ ```
1146
+
1147
+ - **Parameters**:
1148
+ - `title` _(string)_: The title that should not be associated with the page.
1149
+
1150
+ ---
1151
+
1152
+ #### `shouldNotPageHaveURL(url)`
1153
+
1154
+ Asserts that the page does not have the specified URL.
1155
+
1156
+ ```javascript
1157
+ await shouldNotPageHaveURL("https://example.com");
1158
+ ```
1159
+
1160
+ - **Parameters**:
1161
+ - `url` _(string)_: The URL that should not be associated with the page.
1162
+
1163
+ ---
1164
+
1165
+ #### `shouldNotResponseBeOK(response)`
1166
+
1167
+ Asserts that the response is not OK (status code 200).
1168
+
1169
+ ```javascript
1170
+ await shouldNotResponseBeOK(response);
1171
+ ```
1172
+
1173
+ - **Parameters**:
1174
+ - `response` _(object)_: The response object to check.
1175
+
1176
+ ---
1177
+
1178
+ #### `shouldBe(selector, expected)`
1179
+
1180
+ Asserts that the element’s text content is equal to the expected value.
1181
+
1182
+ ```javascript
1183
+ await shouldBe("#element", "expected text");
1184
+ ```
1185
+
1186
+ - **Parameters**:
1187
+ - `selector` _(string)_: The target element’s selector.
1188
+ - `expected` _(string)_: The expected text content.
1189
+
1190
+ ---
1191
+
1192
+ #### `shouldBeCloseTo(selector, expected, precision)`
1193
+
1194
+ Asserts that the element’s text content is a number close to the expected value, within the specified precision.
1195
+
1196
+ ```javascript
1197
+ await shouldBeCloseTo("#element", 100, 2);
1198
+ ```
1199
+
1200
+ - **Parameters**:
1201
+ - `selector` _(string)_: The target element’s selector.
1202
+ - `expected` _(number)_: The expected value.
1203
+ - `precision` _(number)_: The allowed precision (number of decimal places).
1204
+
1205
+ ---
1206
+
1207
+ #### `shouldBeDefined(selector)`
1208
+
1209
+ Asserts that the element’s text content is defined.
1210
+
1211
+ ```javascript
1212
+ await shouldBeDefined("#element");
1213
+ ```
1214
+
1215
+ - **Parameters**:
1216
+ - `selector` _(string)_: The target element’s selector.
1217
+
1218
+ ---
1219
+
1220
+ #### `shouldBeFalsy(selector)`
1221
+
1222
+ Asserts that the element’s text content is falsy (e.g., `false`, `0`, `null`, `undefined`, `NaN`, or an empty string).
1223
+
1224
+ ```javascript
1225
+ await shouldBeFalsy("#element");
1226
+ ```
1227
+
1228
+ - **Parameters**:
1229
+ - `selector` _(string)_: The target element’s selector.
1230
+
1231
+ ---
1232
+
1233
+ #### `shouldBeGreaterThan(selector, expected)`
1234
+
1235
+ Asserts that the element’s text content, converted to a number, is greater than the expected value.
1236
+
1237
+ ```javascript
1238
+ await shouldBeGreaterThan("#element", 100);
1239
+ ```
1240
+
1241
+ - **Parameters**:
1242
+ - `selector` _(string)_: The target element’s selector.
1243
+ - `expected` _(number)_: The expected value.
1244
+
1245
+ ---
1246
+
1247
+ #### `shouldBeGreaterThanOrEqual(selector, expected)`
1248
+
1249
+ Asserts that the element’s text content, converted to a number, is greater than or equal to the expected value.
1250
+
1251
+ ```javascript
1252
+ await shouldBeGreaterThanOrEqual("#element", 100);
1253
+ ```
1254
+
1255
+ - **Parameters**:
1256
+ - `selector` _(string)_: The target element’s selector.
1257
+ - `expected` _(number)_: The expected value.
1258
+
1259
+ ---
1260
+
1261
+ #### `shouldBeInstanceOf(selector, constructor)`
1262
+
1263
+ Asserts that the element’s text content is an instance of the specified constructor.
1264
+
1265
+ ```javascript
1266
+ await shouldBeInstanceOf("#element", Array);
1267
+ ```
1268
+
1269
+ - **Parameters**:
1270
+ - `selector` _(string)_: The target element’s selector.
1271
+ - `constructor` _(function)_: The constructor function (e.g., `Array`, `Date`, etc.).
1272
+
1273
+ ---
1274
+
1275
+ #### `shouldBeLessThan(selector, expected)`
1276
+
1277
+ Asserts that the element’s text content, converted to a number, is less than the expected value.
1278
+
1279
+ ```javascript
1280
+ await shouldBeLessThan("#element", 100);
1281
+ ```
1282
+
1283
+ - **Parameters**:
1284
+ - `selector` _(string)_: The target element’s selector.
1285
+ - `expected` _(number)_: The expected value.
1286
+
1287
+ ---
1288
+
1289
+ #### `shouldBeLessThanOrEqual(selector, expected)`
1290
+
1291
+ Asserts that the element’s text content, converted to a number, is less than or equal to the expected value.
1292
+
1293
+ ```javascript
1294
+ await shouldBeLessThanOrEqual("#element", 100);
1295
+ ```
1296
+
1297
+ - **Parameters**:
1298
+ - `selector` _(string)_: The target element’s selector.
1299
+ - `expected` _(number)_: The expected value.
1300
+
1301
+ ---
1302
+
1303
+ #### `shouldBeNaN(selector)`
1304
+
1305
+ Asserts that the element’s text content, converted to a number, is `NaN` (Not-a-Number).
1306
+
1307
+ ```javascript
1308
+ await shouldBeNaN("#element");
1309
+ ```
1310
+
1311
+ - **Parameters**:
1312
+ - `selector` _(string)_: The target element’s selector.
1313
+
1314
+ ---
1315
+
1316
+ #### `shouldBeNull(selector)`
1317
+
1318
+ Asserts that the element’s text content is `null`.
1319
+
1320
+ ```javascript
1321
+ await shouldBeNull("#element");
1322
+ ```
1323
+
1324
+ - **Parameters**:
1325
+ - `selector` _(string)_: The target element’s selector.
1326
+
1327
+ ---
1328
+
1329
+ #### `shouldBeTruthy(selector)`
1330
+
1331
+ Asserts that the element’s text content is truthy (i.e., a value that evaluates to `true` in a Boolean context).
1332
+
1333
+ ```javascript
1334
+ await shouldBeTruthy("#element");
1335
+ ```
1336
+
1337
+ - **Parameters**:
1338
+ - `selector` _(string)_: The target element’s selector.
1339
+
1340
+ ---
1341
+
1342
+ #### `shouldBeUndefined(selector)`
1343
+
1344
+ Asserts that the element’s text content is `undefined`.
1345
+
1346
+ ```javascript
1347
+ await shouldBeUndefined("#element");
1348
+ ```
1349
+
1350
+ - **Parameters**:
1351
+ - `selector` _(string)_: The target element’s selector.
1352
+
1353
+ ---
1354
+
1355
+ #### `shouldContain(selector, substring)`
1356
+
1357
+ Asserts that the element’s text content contains the specified substring.
1358
+
1359
+ ```javascript
1360
+ await shouldContain("#element", "expected substring");
1361
+ ```
1362
+
1363
+ - **Parameters**:
1364
+ - `selector` _(string)_: The target element’s selector.
1365
+ - `substring` _(string)_: The substring that should be contained in the text content.
1366
+
1367
+ ---
1368
+
1369
+ #### `shouldContainEqual(selector, expected)`
1370
+
1371
+ Asserts that the element’s text content contains an equal value to the expected value.
1372
+
1373
+ ```javascript
1374
+ await shouldContainEqual("#element", "expected value");
1375
+ ```
1376
+
1377
+ - **Parameters**:
1378
+ - `selector` _(string)_: The target element’s selector.
1379
+ - `expected` _(any)_: The expected value.
1380
+
1381
+ ---
1382
+
1383
+ #### `shouldEqual(selector, expected)`
1384
+
1385
+ Asserts that the element’s text content, converted to a number, is equal to the expected value.
1386
+
1387
+ ```javascript
1388
+ await shouldEqual("#element", 100);
1389
+ ```
1390
+
1391
+ - **Parameters**:
1392
+ - `selector` _(string)_: The target element’s selector.
1393
+ - `expected` _(number)_: The expected value.
1394
+
1395
+ ---
1396
+
1397
+ #### `shouldHaveLength(selector, length)`
1398
+
1399
+ Asserts that the element's text content has the specified length.
1400
+
1401
+ ```javascript
1402
+ await shouldHaveLength(".element", 5);
1403
+ ```
1404
+
1405
+ - **Parameters**:
1406
+ - `selector` _(string)_: The CSS selector for the element.
1407
+ - `length` _(number)_: The expected length of the text content.
1408
+
1409
+ ---
1410
+
1411
+ #### `shouldHaveProperty(selector, property)`
1412
+
1413
+ Asserts that the element's text content has the specified property.
1414
+
1415
+ ```javascript
1416
+ await shouldHaveProperty(".element", "propertyName");
1417
+ ```
1418
+
1419
+ - **Parameters**:
1420
+ - `selector` _(string)_: The CSS selector for the element.
1421
+ - `property` _(string)_: The property name to check for.
1422
+
1423
+ ---
1424
+
1425
+ #### `shouldMatch(selector, regex)`
1426
+
1427
+ Asserts that the element's text content matches the provided regular expression.
1428
+
1429
+ ```javascript
1430
+ await shouldMatch(".element", /pattern/);
1431
+ ```
1432
+
1433
+ - **Parameters**:
1434
+ - `selector` _(string)_: The CSS selector for the element.
1435
+ - `regex` _(RegExp)_: The regular expression to match against.
1436
+
1437
+ ---
1438
+
1439
+ #### `shouldMatchObject(selector, object)`
1440
+
1441
+ Asserts that the element's text content matches the provided object structure.
1442
+
1443
+ ```javascript
1444
+ await shouldMatchObject(".element", { key: "value" });
1445
+ ```
1446
+
1447
+ - **Parameters**:
1448
+ - `selector` _(string)_: The CSS selector for the element.
1449
+ - `object` _(object)_: The object to match against.
1450
+
1451
+ ---
1452
+
1453
+ #### `shouldStrictEqual(selector, expected)`
1454
+
1455
+ Asserts that the numeric value of the element's text content strictly equals the expected value.
1456
+
1457
+ ```javascript
1458
+ await shouldStrictEqual(".element", 42);
1459
+ ```
1460
+
1461
+ - **Parameters**:
1462
+ - `selector` _(string)_: The CSS selector for the element.
1463
+ - `expected` _(number)_: The expected numeric value.
1464
+
1465
+ ---
1466
+
1467
+ #### `shouldThrow(fn)`
1468
+
1469
+ Asserts that the provided function throws an error when executed.
1470
+
1471
+ ```javascript
1472
+ await shouldThrow(() => functionThatShouldThrow());
1473
+ ```
1474
+
1475
+ - **Parameters**:
1476
+ - `fn` _(Function)_: The function expected to throw an error.
1477
+
1478
+ ---
1479
+
1480
+ #### `shouldAny(selector, constructor)`
1481
+
1482
+ Asserts that the element's text content is an instance of the specified constructor.
1483
+
1484
+ ```javascript
1485
+ await shouldAny(".element", Constructor);
1486
+ ```
1487
+
1488
+ - **Parameters**:
1489
+ - `selector` _(string)_: The CSS selector for the element.
1490
+ - `constructor` _(Function)_: The constructor function to check against.
1491
+
1492
+ ---
1493
+
1494
+ #### `shouldAnything(selector)`
1495
+
1496
+ Asserts that the element's text content matches anything (always passes).
1497
+
1498
+ ```javascript
1499
+ await shouldAnything(".element");
1500
+ ```
1501
+
1502
+ - **Parameters**:
1503
+ - `selector` _(string)_: The CSS selector for the element.
1504
+
1505
+ ---
1506
+
1507
+ #### `shouldArrayContaining(selector, elements)`
1508
+
1509
+ Asserts that the element's text content contains all the elements in the provided array.
1510
+
1511
+ ```javascript
1512
+ await shouldArrayContaining(".element", ["item1", "item2"]);
1513
+ ```
1514
+
1515
+ - **Parameters**:
1516
+ - `selector` _(string)_: The CSS selector for the element.
1517
+ - `elements` _(Array)_: The array of elements to check for.
1518
+
1519
+ ---
1520
+
1521
+ #### `shouldCloseTo(selector, expected, precision)`
1522
+
1523
+ Asserts that the numeric value of the element's text content is close to the expected value within the specified precision.
1524
+
1525
+ ```javascript
1526
+ await shouldCloseTo(".element", 3.14159, 2);
1527
+ ```
1528
+
1529
+ - **Parameters**:
1530
+ - `selector` _(string)_: The CSS selector for the element.
1531
+ - `expected` _(number)_: The expected numeric value.
1532
+ - `precision` _(number)_: The number of decimal places to check.
1533
+
1534
+ ---
1535
+
1536
+ #### `shouldObjectContaining(selector, properties)`
1537
+
1538
+ Asserts that the element's text content contains an object with the specified properties.
1539
+
1540
+ ```javascript
1541
+ await shouldObjectContaining(".element", { key: "value" });
1542
+ ```
1543
+
1544
+ - **Parameters**:
1545
+ - `selector` _(string)_: The CSS selector for the element.
1546
+ - `properties` _(object)_: The object properties to check for.
1547
+
1548
+ #### `shouldStringContaining(selector, substring)`
1549
+
1550
+ Asserts that the element's text content contains the specified substring.
1551
+
1552
+ ```javascript
1553
+ await shouldStringContaining(".element", "expected text");
1554
+ ```
1555
+
1556
+ - **Parameters**:
1557
+ - `selector` _(string)_: The CSS selector for the element.
1558
+ - `substring` _(string)_: The substring to check for.
1559
+
1560
+ ---
1561
+
1562
+ #### `shouldStringMatching(selector, regex)`
1563
+
1564
+ Asserts that the element's text content matches the specified regular expression.
1565
+
1566
+ ```javascript
1567
+ await shouldStringMatching(".element", /pattern/);
1568
+ ```
1569
+
1570
+ - **Parameters**:
1571
+ - `selector` _(string)_: The CSS selector for the element.
1572
+ - `regex` _(RegExp)_: The regular expression to match against.
1573
+
1574
+ ---
1575
+
1576
+ #### `shouldNotBe(selector, expected)`
1577
+
1578
+ Asserts that the element's text content is not strictly equal to the expected value.
1579
+
1580
+ ```javascript
1581
+ await shouldNotBe(".element", "unexpected value");
1582
+ ```
1583
+
1584
+ - **Parameters**:
1585
+ - `selector` _(string)_: The CSS selector for the element.
1586
+ - `expected` _(any)_: The value that should not match.
1587
+
1588
+ ---
1589
+
1590
+ #### `shouldNotBeCloseTo(selector, expected, precision)`
1591
+
1592
+ Asserts that the numeric value of the element's text content is not close to the expected value within the specified precision.
1593
+
1594
+ ```javascript
1595
+ await shouldNotBeCloseTo(".element", 3.14159, 2);
1596
+ ```
1597
+
1598
+ - **Parameters**:
1599
+ - `selector` _(string)_: The CSS selector for the element.
1600
+ - `expected` _(number)_: The numeric value that should not be close.
1601
+ - `precision` _(number)_: The number of decimal places to check.
1602
+
1603
+ ---
1604
+
1605
+ #### `shouldNotBeDefined(selector)`
1606
+
1607
+ Asserts that the element's text content is not defined.
1608
+
1609
+ ```javascript
1610
+ await shouldNotBeDefined(".element");
1611
+ ```
1612
+
1613
+ - **Parameters**:
1614
+ - `selector` _(string)_: The CSS selector for the element.
1615
+
1616
+ ---
1617
+
1618
+ #### `shouldNotBeFalsy(selector)`
1619
+
1620
+ Asserts that the element's text content is not falsy.
1621
+
1622
+ ```javascript
1623
+ await shouldNotBeFalsy(".element");
1624
+ ```
1625
+
1626
+ - **Parameters**:
1627
+ - `selector` _(string)_: The CSS selector for the element.
1628
+
1629
+ ---
1630
+
1631
+ #### `shouldNotBeGreaterThan(selector, expected)`
1632
+
1633
+ Asserts that the element's text content is not greater than the expected value.
1634
+
1635
+ ```javascript
1636
+ await shouldNotBeGreaterThan(".element", 100);
1637
+ ```
1638
+
1639
+ - **Parameters**:
1640
+ - `selector` _(string)_: The CSS selector for the element.
1641
+ - `expected` _(number)_: The value to compare against.
1642
+
1643
+ ---
1644
+
1645
+ #### `shouldNotBeGreaterThanOrEqual(selector, expected)`
1646
+
1647
+ Asserts that the numeric value of the element's text content is not greater than or equal to the expected value.
1648
+
1649
+ ```javascript
1650
+ await shouldNotBeGreaterThanOrEqual(".element", 100);
1651
+ ```
1652
+
1653
+ - **Parameters**:
1654
+ - `selector` _(string)_: The CSS selector for the element.
1655
+ - `expected` _(number)_: The value to compare against.
1656
+
1657
+ ---
1658
+
1659
+ #### `shouldNotBeInstanceOf(selector, constructor)`
1660
+
1661
+ Asserts that the element's text content is not an instance of the specified constructor.
1662
+
1663
+ ```javascript
1664
+ await shouldNotBeInstanceOf(".element", Constructor);
1665
+ ```
1666
+
1667
+ - **Parameters**:
1668
+ - `selector` _(string)_: The CSS selector for the element.
1669
+ - `constructor` _(Function)_: The constructor function to check against.
1670
+
1671
+ ---
1672
+
1673
+ #### `shouldNotBeLessThan(selector, expected)`
1674
+
1675
+ Asserts that the numeric value of the element's text content is not less than the expected value.
1676
+
1677
+ ```javascript
1678
+ await shouldNotBeLessThan(".element", 100);
1679
+ ```
1680
+
1681
+ - **Parameters**:
1682
+ - `selector` _(string)_: The CSS selector for the element.
1683
+ - `expected` _(number)_: The value to compare against.
1684
+
1685
+ ---
1686
+
1687
+ #### `shouldNotBeLessThanOrEqual(selector, expected)`
1688
+
1689
+ Asserts that the numeric value of the element's text content is not less than or equal to the expected value.
1690
+
1691
+ ```javascript
1692
+ await shouldNotBeLessThanOrEqual(".element", 100);
1693
+ ```
1694
+
1695
+ - **Parameters**:
1696
+ - `selector` _(string)_: The CSS selector for the element.
1697
+ - `expected` _(number)_: The value to compare against.
1698
+
1699
+ ---
1700
+
1701
+ #### `shouldNotBeNaN(selector)`
1702
+
1703
+ Asserts that the numeric value of the element's text content is not NaN.
1704
+
1705
+ ```javascript
1706
+ await shouldNotBeNaN(".element");
1707
+ ```
1708
+
1709
+ - **Parameters**:
1710
+ - `selector` _(string)_: The CSS selector for the element.
1711
+
1712
+ ---
1713
+
1714
+ #### `shouldNotBeNull(selector)`
1715
+
1716
+ Asserts that the element's text content is not null.
1717
+
1718
+ ```javascript
1719
+ await shouldNotBeNull(".element");
1720
+ ```
1721
+
1722
+ - **Parameters**:
1723
+ - `selector` _(string)_: The CSS selector for the element.
1724
+
1725
+ ---
1726
+
1727
+ #### `shouldNotBeTruthy(selector)`
1728
+
1729
+ Asserts that the element's text content is not truthy.
1730
+
1731
+ ```javascript
1732
+ await shouldNotBeTruthy(".element");
1733
+ ```
1734
+
1735
+ - **Parameters**:
1736
+ - `selector` _(string)_: The CSS selector for the element.
1737
+
1738
+ ---
1739
+
1740
+ #### `shouldNotBeUndefined(selector)`
1741
+
1742
+ Asserts that the element's text content is not undefined.
1743
+
1744
+ ```javascript
1745
+ await shouldNotBeUndefined(".element");
1746
+ ```
1747
+
1748
+ - **Parameters**:
1749
+ - `selector` _(string)_: The CSS selector for the element.
1750
+
1751
+ ---
1752
+
1753
+ #### `shouldNotContain(selector, substring)`
1754
+
1755
+ Asserts that the element's text content does not contain the specified substring.
1756
+
1757
+ ```javascript
1758
+ await shouldNotContain(".element", "unexpected text");
1759
+ ```
1760
+
1761
+ - **Parameters**:
1762
+ - `selector` _(string)_: The CSS selector for the element.
1763
+ - `substring` _(string)_: The substring that should not be present.
1764
+
1765
+ ---
1766
+
1767
+ #### `shouldNotContainEqual(selector, expected)`
1768
+
1769
+ Asserts that the numeric value of the element's text content does not contain an element equal to the expected value.
1770
+
1771
+ ```javascript
1772
+ await shouldNotContainEqual(".element", 42);
1773
+ ```
1774
+
1775
+ - **Parameters**:
1776
+ - `selector` _(string)_: The CSS selector for the element.
1777
+ - `expected` _(any)_: The value that should not be present.
1778
+
1779
+ ---
1780
+
1781
+ #### `shouldNotEqual(selector, expected)`
1782
+
1783
+ Asserts that the numeric value of the element's text content does not equal the expected value.
1784
+
1785
+ ```javascript
1786
+ await shouldNotEqual(".element", 42);
1787
+ ```
1788
+
1789
+ - **Parameters**:
1790
+ - `selector` _(string)_: The CSS selector for the element.
1791
+ - `expected` _(number)_: The value that should not match.
1792
+
1793
+ ---
1794
+
1795
+ #### `shouldNotHaveLength(selector, length)`
1796
+
1797
+ Asserts that the element's text content does not have the specified length.
1798
+
1799
+ ```javascript
1800
+ await shouldNotHaveLength(".element", 5);
1801
+ ```
1802
+
1803
+ - **Parameters**:
1804
+ - `selector` _(string)_: The CSS selector for the element.
1805
+ - `length` _(number)_: The length that should not match.
1806
+
1807
+ ---
1808
+
1809
+ #### `shouldNotHaveProperty(selector, property)`
1810
+
1811
+ Asserts that the element’s text content does not have the specified property.
1812
+
1813
+ ```javascript
1814
+ await shouldNotHaveProperty("#element", "property-name");
1815
+ ```
1816
+
1817
+ - **Parameters**:
1818
+ - `selector` _(string)_: The target element’s selector.
1819
+ - `property` _(string)_: The property name that should not be present.
1820
+
1821
+ ---
1822
+
1823
+ #### `shouldNotMatch(selector, regex)`
1824
+
1825
+ Asserts that the element’s text content does not match the given regular expression.
1826
+
1827
+ ```javascript
1828
+ await shouldNotMatch("#element", /regex/);
1829
+ ```
1830
+
1831
+ - **Parameters**:
1832
+ - `selector` _(string)_: The target element’s selector.
1833
+ - `regex` _(RegExp)_: The regular expression that the text content should not match.
1834
+
1835
+ ---
1836
+
1837
+ #### `shouldNotMatchObject(selector, object)`
1838
+
1839
+ Asserts that the element’s text content does not match the given object.
1840
+
1841
+ ```javascript
1842
+ await shouldNotMatchObject("#element", { key: "value" });
1843
+ ```
1844
+
1845
+ - **Parameters**:
1846
+ - `selector` _(string)_: The target element’s selector.
1847
+ - `object` _(object)_: The object that the text content should not match.
1848
+
1849
+ ---
1850
+
1851
+ #### `shouldNotStrictEqual(selector, expected)`
1852
+
1853
+ Asserts that the element’s text content, converted to a number, does not strictly equal the expected value.
1854
+
1855
+ ```javascript
1856
+ await shouldNotStrictEqual("#element", 100);
1857
+ ```
1858
+
1859
+ - **Parameters**:
1860
+ - `selector` _(string)_: The target element’s selector.
1861
+ - `expected` _(number)_: The expected value.
1862
+
1863
+ ---
1864
+
1865
+ #### `shouldNotThrow(fn)`
1866
+
1867
+ Asserts that the provided function does not throw an error.
1868
+
1869
+ ```javascript
1870
+ await shouldNotThrow(() => {
1871
+ someFunction();
1872
+ });
1873
+ ```
1874
+
1875
+ - **Parameters**:
1876
+ - `fn` _(function)_: The function that should not throw an error.
1877
+
1878
+ ---
1879
+
1880
+ #### `shouldNotAny(selector, constructor)`
1881
+
1882
+ Asserts that the element’s text content is not an instance of the specified constructor.
1883
+
1884
+ ```javascript
1885
+ await shouldNotAny("#element", Array);
1886
+ ```
1887
+
1888
+ - **Parameters**:
1889
+ - `selector` _(string)_: The target element’s selector.
1890
+ - `constructor` _(function)_: The constructor function (e.g., `Array`, `Date`, etc.).
1891
+
1892
+ ---
1893
+
1894
+ #### `shouldNotAnything(selector)`
1895
+
1896
+ Asserts that the element’s text content is not `anything` (e.g., `null`, `undefined`, `false`).
1897
+
1898
+ ```javascript
1899
+ await shouldNotAnything("#element");
1900
+ ```
1901
+
1902
+ - **Parameters**:
1903
+ - `selector` _(string)_: The target element’s selector.
1904
+
1905
+ ---
1906
+
1907
+ #### `shouldNotArrayContaining(selector, elements)`
1908
+
1909
+ Asserts that the element’s text content is not an array containing the specified elements.
1910
+
1911
+ ```javascript
1912
+ await shouldNotArrayContaining("#element", ["item1", "item2"]);
1913
+ ```
1914
+
1915
+ - **Parameters**:
1916
+ - `selector` _(string)_: The target element’s selector.
1917
+ - `elements` _(array)_: The elements that the array should not contain.
1918
+
1919
+ ---
1920
+
1921
+ #### `shouldNotCloseTo(selector, expected, precision)`
1922
+
1923
+ Asserts that the element’s text content, converted to a number, is not close to the expected value within the specified precision.
1924
+
1925
+ ```javascript
1926
+ await shouldNotCloseTo("#element", 100, 2);
1927
+ ```
1928
+
1929
+ - **Parameters**:
1930
+ - `selector` _(string)_: The target element’s selector.
1931
+ - `expected` _(number)_: The expected value.
1932
+ - `precision` _(number)_: The allowed precision (number of decimal places).
1933
+
1934
+ ---
1935
+
1936
+ #### `shouldNotObjectContaining(selector, properties)`
1937
+
1938
+ Asserts that the element’s text content is not an object containing the specified properties.
1939
+
1940
+ ```javascript
1941
+ await shouldNotObjectContaining("#element", { key: "value" });
1942
+ ```
1943
+
1944
+ - **Parameters**:
1945
+ - `selector` _(string)_: The target element’s selector.
1946
+ - `properties` _(object)_: The properties that the object should not contain.
1947
+
1948
+ ---
1949
+
1950
+ #### `shouldNotStringContaining(selector, substring)`
1951
+
1952
+ Asserts that the element’s text content does not contain the specified substring.
1953
+
1954
+ ```javascript
1955
+ await shouldNotStringContaining("#element", "substring");
1956
+ ```
1957
+
1958
+ - **Parameters**:
1959
+ - `selector` _(string)_: The target element’s selector.
1960
+ - `substring` _(string)_: The substring that should not be contained in the text content.
1961
+
1962
+ ---
1963
+
1964
+ #### `shouldNotStringMatching(selector, regex)`
1965
+
1966
+ Asserts that the element’s text content does not match the specified regular expression.
1967
+
1968
+ ```javascript
1969
+ await shouldNotStringMatching("#element", /regex/);
1970
+ ```
1971
+
1972
+ - **Parameters**:
1973
+ - `selector` _(string)_: The target element’s selector.
1974
+ - `regex` _(RegExp)_: The regular expression that the text content should not match.
1975
+
1976
+ ---
1977
+
1978
+ ### **Frame Functions**
1979
+
1980
+ #### `screenshot(selector)`
1981
+
1982
+ Takes a screenshot of the specified element and saves it to the configured project path.
1983
+
1984
+ ```javascript
1985
+ await screenshot("div#content");
1986
+ ```
1987
+
1988
+ ---
1989
+
1990
+ #### `contentFrame(selector)`
1991
+
1992
+ Returns the `contentFrame` of the specified element (used for working with iframe content).
1993
+
1994
+ ```javascript
1995
+ const frame = await contentFrame("iframe#example");
1996
+ ```
1997
+
1998
+ ---
1999
+
2000
+ #### `frameLocator(selector)`
2001
+
2002
+ Returns the frame locator for the specified element.
2003
+
2004
+ ```javascript
2005
+ const locator = await frameLocator("iframe#example");
2006
+ ```
2007
+
2008
+ ---
2009
+
2010
+ ### **Element Locator Functions**
2011
+
2012
+ #### `nth(selector, index)`
2013
+
2014
+ Returns the nth element matching the selector.
2015
+
2016
+ ```javascript
2017
+ const nthElement = await nth("div.list-item", 2);
2018
+ ```
2019
+
2020
+ ---
2021
+
2022
+ #### `first(selector)`
2023
+
2024
+ Returns the first element matching the selector.
2025
+
2026
+ ```javascript
2027
+ const firstElement = await first("div.list-item");
2028
+ ```
2029
+
2030
+ ---
2031
+
2032
+ #### `last(selector)`
2033
+
2034
+ Returns the last element matching the selector.
2035
+
2036
+ ```javascript
2037
+ const lastElement = await last("div.list-item");
2038
+ ```
2039
+
2040
+ ---
2041
+
2042
+ #### `filter(selector, filter)`
2043
+
2044
+ Returns elements matching the selector and an additional filter.
2045
+
2046
+ ```javascript
2047
+ const filteredElements = await filter("div.list-item", { hasText: "Active" });
2048
+ ```
2049
+
2050
+ ---
2051
+
2052
+ #### `count(selector)`
2053
+
2054
+ Returns the number of elements matching the selector.
2055
+
2056
+ ```javascript
2057
+ const itemCount = await count("div.list-item");
2058
+ ```
2059
+
2060
+ ---
2061
+
2062
+ ### **Attribute-Based Locators**
2063
+
2064
+ #### `getByAltText(text)`
2065
+
2066
+ Returns elements that have the specified `alt` text.
2067
+
2068
+ ```javascript
2069
+ const image = await getByAltText("Profile Picture");
2070
+ ```
2071
+
2072
+ ---
2073
+
2074
+ #### `getByLabel(label)`
2075
+
2076
+ Returns elements with a label matching the specified text.
2077
+
2078
+ ```javascript
2079
+ const input = await getByLabel("Email Address");
2080
+ ```
2081
+
2082
+ ---
2083
+
2084
+ #### `getByPlaceholder(placeholder)`
2085
+
2086
+ Returns elements with a placeholder matching the specified text.
2087
+
2088
+ ```javascript
2089
+ const input = await getByPlaceholder("Enter your name");
2090
+ ```
2091
+
2092
+ ---
2093
+
2094
+ #### `getByRole(role)`
2095
+
2096
+ Returns elements with the specified role attribute.
2097
+
2098
+ ```javascript
2099
+ const button = await getByRole("button");
2100
+ ```
2101
+
2102
+ ---
2103
+
2104
+ #### `getByTestId(testId)`
2105
+
2106
+ Returns elements with the specified `data-testid` attribute.
2107
+
2108
+ ```javascript
2109
+ const element = await getByTestId("submit-button");
2110
+ ```
2111
+
2112
+ ## API Object Methods
2113
+
2114
+ The `api` object provides methods for making HTTP requests with automatic URL resolution, payload processing, and response handling.
2115
+
2116
+ ### `api.get(url, payload)`
2117
+
2118
+ Makes a GET request to the specified URL.
2119
+
2120
+ **Parameters:**
2121
+
2122
+ - `url` (string): The target URL (supports variable resolution)
2123
+ - `payload` (string, optional): JSON string containing headers and other request options
2124
+
2125
+ **Returns:** Promise that resolves when the request completes
2126
+
2127
+ **Example:**
2128
+
2129
+ ```javascript
2130
+ await api.get(
2131
+ "https://api.example.com/users",
2132
+ JSON.stringify({
2133
+ headers: { Authorization: "Bearer {{token}}" },
2134
+ }),
2135
+ );
2136
+ ```
2137
+
2138
+ ### `api.head(url)`
2139
+
2140
+ Makes a HEAD request to the specified URL.
2141
+
2142
+ **Parameters:**
2143
+
2144
+ - `url` (string): The target URL (supports variable resolution)
2145
+
2146
+ **Returns:** Promise that resolves when the request completes
2147
+
2148
+ **Example:**
2149
+
2150
+ ```javascript
2151
+ await api.head("https://api.example.com/status");
2152
+ ```
2153
+
2154
+ ### `api.post(url, payload, requestDataType)`
2155
+
2156
+ Makes a POST request to the specified URL.
2157
+
2158
+ **Parameters:**
2159
+
2160
+ - `url` (string): The target URL (supports variable resolution)
2161
+ - `payload` (string): JSON string containing headers, body, and other request options
2162
+ - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2163
+
2164
+ **Returns:** Promise that resolves when the request completes
2165
+
2166
+ **Example:**
2167
+
2168
+ ```javascript
2169
+ // Regular POST request
2170
+ await api.post(
2171
+ "https://api.example.com/users",
2172
+ JSON.stringify({
2173
+ headers: { "Content-Type": "application/json" },
2174
+ body: { name: "John", email: "john@example.com" },
2175
+ }),
2176
+ );
2177
+
2178
+ // Multipart form data
2179
+ await api.post(
2180
+ "https://api.example.com/upload",
2181
+ JSON.stringify({
2182
+ headers: {},
2183
+ body: { file: "/path/to/file.pdf", description: "Document upload" },
2184
+ }),
2185
+ "multipart",
2186
+ );
2187
+ ```
2188
+
2189
+ ### `api.put(url, payload, requestDataType)`
2190
+
2191
+ Makes a PUT request to the specified URL.
2192
+
2193
+ **Parameters:**
2194
+
2195
+ - `url` (string): The target URL (supports variable resolution)
2196
+ - `payload` (string): JSON string containing headers, body, and other request options
2197
+ - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2198
+
2199
+ **Returns:** Promise that resolves when the request completes
2200
+
2201
+ **Example:**
2202
+
2203
+ ```javascript
2204
+ await api.put(
2205
+ "https://api.example.com/users/{{userId}}",
2206
+ JSON.stringify({
2207
+ headers: { "Content-Type": "application/json" },
2208
+ body: { name: "Updated Name" },
2209
+ }),
2210
+ );
2211
+ ```
2212
+
2213
+ ### `api.patch(url, payload, requestDataType)`
2214
+
2215
+ Makes a PATCH request to the specified URL.
2216
+
2217
+ **Parameters:**
2218
+
2219
+ - `url` (string): The target URL (supports variable resolution)
2220
+ - `payload` (string): JSON string containing headers, body, and other request options
2221
+ - `requestDataType` (string, optional): Request data type ("multipart" for form data, default for JSON)
2222
+
2223
+ **Returns:** Promise that resolves when the request completes
2224
+
2225
+ **Example:**
2226
+
2227
+ ```javascript
2228
+ await api.patch(
2229
+ "https://api.example.com/users/{{userId}}",
2230
+ JSON.stringify({
2231
+ headers: { "Content-Type": "application/json" },
2232
+ body: { email: "newemail@example.com" },
2233
+ }),
2234
+ );
2235
+ ```
2236
+
2237
+ ### `api.delete(url, payload)`
2238
+
2239
+ Makes a DELETE request to the specified URL.
2240
+
2241
+ **Parameters:**
2242
+
2243
+ - `url` (string): The target URL (supports variable resolution)
2244
+ - `payload` (string, optional): JSON string containing headers and other request options
2245
+
2246
+ **Returns:** Promise that resolves when the request completes
2247
+
2248
+ **Example:**
2249
+
2250
+ ```javascript
2251
+ await api.delete(
2252
+ "https://api.example.com/users/{{userId}}",
2253
+ JSON.stringify({
2254
+ headers: { Authorization: "Bearer {{token}}" },
2255
+ }),
2256
+ );
2257
+ ```
2258
+
2259
+ ### `api.vars()`
2260
+
2261
+ Returns the current context variables object.
2262
+
2263
+ **Returns:** Object containing all stored variables
2264
+
2265
+ **Example:**
2266
+
2267
+ ```javascript
2268
+ const currentVars = api.vars();
2269
+ console.log(currentVars); // { token: "abc123", userId: "user456" }
2270
+ ```
2271
+
2272
+ ## Static Methods
2273
+
2274
+ ### `extractVarsFromResponse(object, vars, customVarName)`
2275
+
2276
+ Extracts variables from the response body using dot notation paths.
2277
+
2278
+ **Parameters:**
2279
+
2280
+ - `vars` (string): Comma-separated list of dot notation paths (e.g., "user.id,user.name")
2281
+ - `customVarName` (string, optional): Custom variable name to use instead of auto-generated names
2282
+
2283
+ **Behavior:**
2284
+
2285
+ - Extracts values from `context.response.responseBody` using specified paths
2286
+ - Saves extracted values as variables using `saveVar()`
2287
+ - If `customVarName` is provided, uses it; otherwise generates camelCase names
2288
+
2289
+ **Example:**
2290
+
2291
+ ```javascript
2292
+ // Response body: { user: { id: 123, profile: { name: "John" } } }
2293
+ extractVarsFromResponse(object, "user.id,user.profile.name");
2294
+ // Creates variables: userId = 123, userProfileName = "John"
2295
+
2296
+ extractVarsFromResponse(object, "user.id", "currentUserId");
2297
+ // Creates variable: currentUserId = 123
2298
+ ```
2299
+
2300
+ ### `saveVar(value, customName, path)`
2301
+
2302
+ Saves a variable to the context with either a custom name or auto-generated camelCase name.
2303
+
2304
+ **Parameters:**
2305
+
2306
+ - `value` (any): The value to store
2307
+ - `customName` (string, optional): Custom variable name
2308
+ - `path` (string): Dot notation path used for auto-generating variable name
2309
+
2310
+ **Behavior:**
2311
+
2312
+ - If `customName` is provided, uses it as the variable name
2313
+ - Otherwise, converts dot notation path to camelCase (e.g., "user.profile.name" → "userProfileName")
2314
+
2315
+ ### `resolveVariable(template)`
2316
+
2317
+ Resolves variable placeholders in template strings using the format `{{variableName}}`.
2318
+
2319
+ **Parameters:**
2320
+
2321
+ - `template` (string): Template string containing variable placeholders
2322
+
2323
+ **Returns:** String with variables resolved, or original value if not a string
2324
+
2325
+ **Example:**
2326
+
2327
+ ```javascript
2328
+ // Assuming context.vars = { userId: "123", token: "abc" }
2329
+ resolveVariable("https://api.example.com/users/{{userId}}");
2330
+ // Returns: "https://api.example.com/users/123"
2331
+
2332
+ resolveVariable("Bearer {{token}}");
2333
+ // Returns: "Bearer abc"
2334
+ ```
2335
+
2336
+ ## Usage Examples
2337
+
2338
+ ### Basic API Usage
2339
+
2340
+ ```javascript
2341
+ // Set up variables
2342
+ context.vars.baseUrl = "https://api.example.com";
2343
+ context.vars.token = "your-auth-token";
2344
+
2345
+ // Make a GET request
2346
+ await api.get(
2347
+ "{{baseUrl}}/users",
2348
+ JSON.stringify({
2349
+ headers: { Authorization: "Bearer {{token}}" },
2350
+ }),
2351
+ );
2352
+
2353
+ // Extract user ID from response
2354
+ extractVarsFromResponse("data.0.id", "firstUserId");
2355
+
2356
+ // Use extracted variable in subsequent request
2357
+ await api.get("{{baseUrl}}/users/{{firstUserId}}/profile");
2358
+ ```
2359
+
2360
+ ### File Upload Example
2361
+
2362
+ ```javascript
2363
+ await api.post(
2364
+ "{{baseUrl}}/upload",
2365
+ JSON.stringify({
2366
+ headers: { Authorization: "Bearer {{token}}" },
2367
+ body: {
2368
+ file: "/path/to/document.pdf",
2369
+ description: "Important document",
2370
+ metadata: { type: "legal", priority: "high" },
2371
+ },
2372
+ }),
2373
+ "multipart",
2374
+ );
2375
+ ```
2376
+
2377
+ ### Variable Extraction and Chaining
2378
+
2379
+ ```javascript
2380
+ // Login request
2381
+ await api.post(
2382
+ "{{baseUrl}}/auth/login",
2383
+ JSON.stringify({
2384
+ body: { username: "user@example.com", password: "password" },
2385
+ }),
2386
+ );
2387
+
2388
+ // Extract token from login response
2389
+ extractVarsFromResponse("access_token", "authToken");
2390
+
2391
+ // Use token in protected endpoint
2392
+ await api.get(
2393
+ "{{baseUrl}}/protected-data",
2394
+ JSON.stringify({
2395
+ headers: { Authorization: "Bearer {{authToken}}" },
2396
+ }),
2397
+ );
2398
+ ```