artes 1.0.60 → 1.0.62

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