artes 1.2.14 → 1.2.16

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 +533 -533
  2. package/cucumber.config.js +171 -171
  3. package/docs/functionDefinitions.md +2401 -2401
  4. package/docs/stepDefinitions.md +352 -352
  5. package/executer.js +161 -161
  6. package/index.js +48 -48
  7. package/package.json +51 -54
  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 +95 -95
  15. package/src/helper/executers/projectCreator.js +198 -198
  16. package/src/helper/executers/reportGenerator.js +58 -57
  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 +56 -56
  20. package/src/helper/stepFunctions/APIActions.js +362 -362
  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 +299 -299
  32. package/src/stepDefinitions/assertions.steps.js +861 -861
  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 +226 -226
  36. package/src/stepDefinitions/mouseActions.steps.js +275 -275
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +158 -158
@@ -1,2401 +1,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
-
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
+
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
+ ```