codeceptjs 3.4.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +11 -9
- package/bin/codecept.js +1 -1
- package/docs/ai.md +248 -0
- package/docs/build/Appium.js +47 -7
- package/docs/build/JSONResponse.js +4 -4
- package/docs/build/Nightmare.js +3 -1
- package/docs/build/OpenAI.js +122 -0
- package/docs/build/Playwright.js +234 -54
- package/docs/build/Protractor.js +3 -1
- package/docs/build/Puppeteer.js +101 -12
- package/docs/build/REST.js +15 -5
- package/docs/build/TestCafe.js +61 -2
- package/docs/build/WebDriver.js +85 -5
- package/docs/changelog.md +85 -0
- package/docs/helpers/Appium.md +152 -147
- package/docs/helpers/JSONResponse.md +4 -4
- package/docs/helpers/Nightmare.md +2 -0
- package/docs/helpers/OpenAI.md +70 -0
- package/docs/helpers/Playwright.md +228 -151
- package/docs/helpers/Puppeteer.md +153 -101
- package/docs/helpers/REST.md +6 -5
- package/docs/helpers/TestCafe.md +97 -49
- package/docs/helpers/WebDriver.md +159 -107
- package/docs/mobile.md +49 -2
- package/docs/parallel.md +56 -0
- package/docs/plugins.md +87 -33
- package/docs/secrets.md +6 -0
- package/docs/tutorial.md +2 -2
- package/docs/webapi/appendField.mustache +2 -0
- package/docs/webapi/blur.mustache +17 -0
- package/docs/webapi/focus.mustache +12 -0
- package/docs/webapi/type.mustache +3 -0
- package/lib/ai.js +171 -0
- package/lib/cli.js +10 -2
- package/lib/codecept.js +4 -0
- package/lib/command/dryRun.js +9 -1
- package/lib/command/generate.js +46 -3
- package/lib/command/init.js +23 -1
- package/lib/command/interactive.js +15 -1
- package/lib/command/run-workers.js +2 -1
- package/lib/container.js +13 -3
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +45 -7
- package/lib/helper/JSONResponse.js +4 -4
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/OpenAI.js +122 -0
- package/lib/helper/Playwright.js +200 -45
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/Puppeteer.js +67 -12
- package/lib/helper/REST.js +15 -5
- package/lib/helper/TestCafe.js +30 -2
- package/lib/helper/WebDriver.js +51 -5
- package/lib/helper/scripts/blurElement.js +17 -0
- package/lib/helper/scripts/focusElement.js +17 -0
- package/lib/helper/scripts/highlightElement.js +20 -0
- package/lib/html.js +258 -0
- package/lib/interfaces/gherkin.js +8 -0
- package/lib/listener/retry.js +2 -1
- package/lib/pause.js +73 -17
- package/lib/plugin/debugErrors.js +67 -0
- package/lib/plugin/fakerTransform.js +4 -6
- package/lib/plugin/heal.js +177 -0
- package/lib/plugin/screenshotOnFail.js +11 -2
- package/lib/recorder.js +11 -8
- package/lib/secret.js +5 -4
- package/lib/step.js +6 -1
- package/lib/ui.js +4 -3
- package/lib/utils.js +17 -0
- package/lib/workers.js +57 -9
- package/package.json +25 -16
- package/translations/ja-JP.js +9 -9
- package/typings/index.d.ts +43 -9
- package/typings/promiseBasedTypes.d.ts +242 -25
- package/typings/types.d.ts +260 -35
package/docs/helpers/REST.md
CHANGED
|
@@ -41,7 +41,8 @@ Type: [object][4]
|
|
|
41
41
|
endpoint: 'http://site.com/api',
|
|
42
42
|
prettyPrintJson: true,
|
|
43
43
|
onRequest: (request) => {
|
|
44
|
-
|
|
44
|
+
request.headers.auth = '123';
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -114,7 +115,7 @@ I.sendDeleteRequest('/api/users/1');
|
|
|
114
115
|
#### Parameters
|
|
115
116
|
|
|
116
117
|
- `url` **any**
|
|
117
|
-
- `headers` **[object][4]** the headers object to be sent. By default it is sent as an empty object
|
|
118
|
+
- `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
|
|
118
119
|
|
|
119
120
|
Returns **[Promise][2]<any>** response
|
|
120
121
|
|
|
@@ -129,7 +130,7 @@ I.sendGetRequest('/api/users.json');
|
|
|
129
130
|
#### Parameters
|
|
130
131
|
|
|
131
132
|
- `url` **any**
|
|
132
|
-
- `headers` **[object][4]** the headers object to be sent. By default it is sent as an empty object
|
|
133
|
+
- `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
|
|
133
134
|
|
|
134
135
|
Returns **[Promise][2]<any>** response
|
|
135
136
|
|
|
@@ -166,8 +167,8 @@ I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" }));
|
|
|
166
167
|
#### Parameters
|
|
167
168
|
|
|
168
169
|
- `url` **any**
|
|
169
|
-
- `payload` **any** the payload to be sent. By default it is sent as an empty object
|
|
170
|
-
- `headers` **[object][4]** the headers object to be sent. By default it is sent as an empty object
|
|
170
|
+
- `payload` **any** the payload to be sent. By default, it is sent as an empty object
|
|
171
|
+
- `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
|
|
171
172
|
|
|
172
173
|
Returns **[Promise][2]<any>** response
|
|
173
174
|
|
package/docs/helpers/TestCafe.md
CHANGED
|
@@ -116,6 +116,8 @@ Field is located by name, label, CSS or XPath
|
|
|
116
116
|
|
|
117
117
|
```js
|
|
118
118
|
I.appendField('#myTextField', 'appended');
|
|
119
|
+
// typing secret
|
|
120
|
+
I.appendField('password', secret('123456'));
|
|
119
121
|
```
|
|
120
122
|
|
|
121
123
|
#### Parameters
|
|
@@ -142,6 +144,29 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
142
144
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
143
145
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
144
146
|
|
|
147
|
+
### blur
|
|
148
|
+
|
|
149
|
+
Remove focus from a text input, button, etc.
|
|
150
|
+
Calls [blur][6] on the element.
|
|
151
|
+
|
|
152
|
+
Examples:
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
I.blur('.text-area')
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
//element `#product-tile` is focused
|
|
160
|
+
I.see('#add-to-cart-btn');
|
|
161
|
+
I.blur('#product-tile')
|
|
162
|
+
I.dontSee('#add-to-cart-btn');
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
168
|
+
- `options` **any?** Playwright only: [Additional options][7] for available options object as 2nd argument.
|
|
169
|
+
|
|
145
170
|
### checkOption
|
|
146
171
|
|
|
147
172
|
Selects a checkbox or radio button.
|
|
@@ -393,9 +418,9 @@ let date = await I.executeScript(function(el) {
|
|
|
393
418
|
|
|
394
419
|
#### Parameters
|
|
395
420
|
|
|
396
|
-
- `fn` **([string][4] | [function][
|
|
421
|
+
- `fn` **([string][4] | [function][8])** function to be executed in browser context.
|
|
397
422
|
- `args` **...any** to be passed to function.
|
|
398
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for
|
|
423
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for its resolution.
|
|
399
424
|
|
|
400
425
|
### fillField
|
|
401
426
|
|
|
@@ -419,6 +444,23 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
419
444
|
- `value` **([string][4] | [object][5])** text value to fill.
|
|
420
445
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
421
446
|
|
|
447
|
+
### focus
|
|
448
|
+
|
|
449
|
+
Calls [focus][6] on the matching element.
|
|
450
|
+
|
|
451
|
+
Examples:
|
|
452
|
+
|
|
453
|
+
```js
|
|
454
|
+
I.dontSee('#add-to-cart-btn');
|
|
455
|
+
I.focus('#product-tile')
|
|
456
|
+
I.see('#add-to-cart-bnt');
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
#### Parameters
|
|
460
|
+
|
|
461
|
+
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
462
|
+
- `options` **any?** Playwright only: [Additional options][9] for available options object as 2nd argument.
|
|
463
|
+
|
|
422
464
|
### grabAttributeFrom
|
|
423
465
|
|
|
424
466
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
@@ -434,7 +476,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
434
476
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
435
477
|
- `attr` **[string][4]** attribute name.
|
|
436
478
|
|
|
437
|
-
Returns **[Promise][
|
|
479
|
+
Returns **[Promise][10]<[string][4]>** attribute value
|
|
438
480
|
|
|
439
481
|
### grabAttributeFromAll
|
|
440
482
|
|
|
@@ -451,7 +493,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
451
493
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
452
494
|
- `attr` **[string][4]** attribute name.
|
|
453
495
|
|
|
454
|
-
Returns **[Promise][
|
|
496
|
+
Returns **[Promise][10]<[string][4]>** attribute value
|
|
455
497
|
|
|
456
498
|
### grabBrowserLogs
|
|
457
499
|
|
|
@@ -477,7 +519,7 @@ assert(cookie.value, '123456');
|
|
|
477
519
|
|
|
478
520
|
- `name` **[string][4]?** cookie name.
|
|
479
521
|
|
|
480
|
-
Returns **([Promise][
|
|
522
|
+
Returns **([Promise][10]<[string][4]> | [Promise][10]<[Array][11]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
481
523
|
|
|
482
524
|
### grabCurrentUrl
|
|
483
525
|
|
|
@@ -489,7 +531,7 @@ let url = await I.grabCurrentUrl();
|
|
|
489
531
|
console.log(`Current URL is [${url}]`);
|
|
490
532
|
```
|
|
491
533
|
|
|
492
|
-
Returns **[Promise][
|
|
534
|
+
Returns **[Promise][10]<[string][4]>** current URL
|
|
493
535
|
|
|
494
536
|
### grabNumberOfVisibleElements
|
|
495
537
|
|
|
@@ -504,7 +546,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
504
546
|
|
|
505
547
|
- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
|
|
506
548
|
|
|
507
|
-
Returns **[Promise][
|
|
549
|
+
Returns **[Promise][10]<[number][12]>** number of visible elements
|
|
508
550
|
|
|
509
551
|
### grabPageScrollPosition
|
|
510
552
|
|
|
@@ -515,7 +557,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
515
557
|
let { x, y } = await I.grabPageScrollPosition();
|
|
516
558
|
```
|
|
517
559
|
|
|
518
|
-
Returns **[Promise][
|
|
560
|
+
Returns **[Promise][10]<PageScrollPosition>** scroll position
|
|
519
561
|
|
|
520
562
|
### grabSource
|
|
521
563
|
|
|
@@ -526,7 +568,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
526
568
|
let pageSource = await I.grabSource();
|
|
527
569
|
```
|
|
528
570
|
|
|
529
|
-
Returns **[Promise][
|
|
571
|
+
Returns **[Promise][10]<[string][4]>** source code
|
|
530
572
|
|
|
531
573
|
### grabTextFrom
|
|
532
574
|
|
|
@@ -543,7 +585,7 @@ If multiple elements found returns first element.
|
|
|
543
585
|
|
|
544
586
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
545
587
|
|
|
546
|
-
Returns **[Promise][
|
|
588
|
+
Returns **[Promise][10]<[string][4]>** attribute value
|
|
547
589
|
|
|
548
590
|
### grabTextFromAll
|
|
549
591
|
|
|
@@ -558,7 +600,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
558
600
|
|
|
559
601
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
560
602
|
|
|
561
|
-
Returns **[Promise][
|
|
603
|
+
Returns **[Promise][10]<[Array][11]<[string][4]>>** attribute value
|
|
562
604
|
|
|
563
605
|
### grabValueFrom
|
|
564
606
|
|
|
@@ -574,7 +616,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
574
616
|
|
|
575
617
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
576
618
|
|
|
577
|
-
Returns **[Promise][
|
|
619
|
+
Returns **[Promise][10]<[string][4]>** attribute value
|
|
578
620
|
|
|
579
621
|
### grabValueFromAll
|
|
580
622
|
|
|
@@ -589,7 +631,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
589
631
|
|
|
590
632
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
591
633
|
|
|
592
|
-
Returns **[Promise][
|
|
634
|
+
Returns **[Promise][10]<[Array][11]<[string][4]>>** attribute value
|
|
593
635
|
|
|
594
636
|
### moveCursorTo
|
|
595
637
|
|
|
@@ -604,14 +646,14 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
604
646
|
#### Parameters
|
|
605
647
|
|
|
606
648
|
- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
|
|
607
|
-
- `offsetX` **[number][
|
|
608
|
-
- `offsetY` **[number][
|
|
649
|
+
- `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
|
|
650
|
+
- `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
|
|
609
651
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
610
652
|
|
|
611
653
|
### pressKey
|
|
612
654
|
|
|
613
655
|
Presses a key on a focused element.
|
|
614
|
-
Special keys like 'Enter', 'Control', [etc][
|
|
656
|
+
Special keys like 'Enter', 'Control', [etc][13]
|
|
615
657
|
will be replaced with corresponding unicode.
|
|
616
658
|
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
|
|
617
659
|
|
|
@@ -622,7 +664,7 @@ I.pressKey(['Control','a']);
|
|
|
622
664
|
|
|
623
665
|
#### Parameters
|
|
624
666
|
|
|
625
|
-
- `key` **([string][4] | [Array][
|
|
667
|
+
- `key` **([string][4] | [Array][11]<[string][4]>)** key or array of keys to press.
|
|
626
668
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
627
669
|
|
|
628
670
|
|
|
@@ -675,8 +717,8 @@ First parameter can be set to `maximize`.
|
|
|
675
717
|
|
|
676
718
|
#### Parameters
|
|
677
719
|
|
|
678
|
-
- `width` **[number][
|
|
679
|
-
- `height` **[number][
|
|
720
|
+
- `width` **[number][12]** width in pixels or `maximize`.
|
|
721
|
+
- `height` **[number][12]** height in pixels.
|
|
680
722
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
681
723
|
|
|
682
724
|
### rightClick
|
|
@@ -727,7 +769,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
727
769
|
#### Parameters
|
|
728
770
|
|
|
729
771
|
- `fileName` **[string][4]** file name to save.
|
|
730
|
-
- `fullPage` **[boolean][
|
|
772
|
+
- `fullPage` **[boolean][14]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
731
773
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
732
774
|
|
|
733
775
|
### scrollPageToBottom
|
|
@@ -763,8 +805,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
763
805
|
#### Parameters
|
|
764
806
|
|
|
765
807
|
- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
|
|
766
|
-
- `offsetX` **[number][
|
|
767
|
-
- `offsetY` **[number][
|
|
808
|
+
- `offsetX` **[number][12]** (optional, `0` by default) X-axis offset.
|
|
809
|
+
- `offsetY` **[number][12]** (optional, `0` by default) Y-axis offset.
|
|
768
810
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
769
811
|
|
|
770
812
|
### see
|
|
@@ -912,7 +954,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
912
954
|
#### Parameters
|
|
913
955
|
|
|
914
956
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
915
|
-
- `num` **[number][
|
|
957
|
+
- `num` **[number][12]** number of elements.
|
|
916
958
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
917
959
|
|
|
918
960
|
### seeTextEquals
|
|
@@ -952,7 +994,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
952
994
|
#### Parameters
|
|
953
995
|
|
|
954
996
|
- `select` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
955
|
-
- `option` **([string][4] | [Array][
|
|
997
|
+
- `option` **([string][4] | [Array][11]<any>)** visible text or value of option.
|
|
956
998
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
957
999
|
|
|
958
1000
|
### setCookie
|
|
@@ -973,7 +1015,7 @@ I.setCookie([
|
|
|
973
1015
|
|
|
974
1016
|
#### Parameters
|
|
975
1017
|
|
|
976
|
-
- `cookie` **(Cookie | [Array][
|
|
1018
|
+
- `cookie` **(Cookie | [Array][11]<Cookie>)** a cookie object or array of cookie objects.
|
|
977
1019
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
978
1020
|
|
|
979
1021
|
### switchTo
|
|
@@ -1011,12 +1053,12 @@ I.uncheckOption('agree', '//form');
|
|
|
1011
1053
|
|
|
1012
1054
|
### useTestCafeTo
|
|
1013
1055
|
|
|
1014
|
-
Use [TestCafe][
|
|
1056
|
+
Use [TestCafe][15] API inside a test.
|
|
1015
1057
|
|
|
1016
1058
|
First argument is a description of an action.
|
|
1017
1059
|
Second argument is async function that gets this helper as parameter.
|
|
1018
1060
|
|
|
1019
|
-
{ [`t`][
|
|
1061
|
+
{ [`t`][16]) } object from TestCafe API is available.
|
|
1020
1062
|
|
|
1021
1063
|
```js
|
|
1022
1064
|
I.useTestCafeTo('handle browser dialog', async ({ t }) {
|
|
@@ -1027,7 +1069,7 @@ I.useTestCafeTo('handle browser dialog', async ({ t }) {
|
|
|
1027
1069
|
#### Parameters
|
|
1028
1070
|
|
|
1029
1071
|
- `description` **[string][4]** used to show in logs.
|
|
1030
|
-
- `fn` **[function][
|
|
1072
|
+
- `fn` **[function][8]** async functuion that executed with TestCafe helper as argument
|
|
1031
1073
|
|
|
1032
1074
|
### wait
|
|
1033
1075
|
|
|
@@ -1039,7 +1081,7 @@ I.wait(2); // wait 2 secs
|
|
|
1039
1081
|
|
|
1040
1082
|
#### Parameters
|
|
1041
1083
|
|
|
1042
|
-
- `sec` **[number][
|
|
1084
|
+
- `sec` **[number][12]** number of second to wait.
|
|
1043
1085
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1044
1086
|
|
|
1045
1087
|
### waitForElement
|
|
@@ -1055,7 +1097,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1055
1097
|
#### Parameters
|
|
1056
1098
|
|
|
1057
1099
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1058
|
-
- `sec` **[number][
|
|
1100
|
+
- `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
|
|
1059
1101
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1060
1102
|
|
|
1061
1103
|
### waitForFunction
|
|
@@ -1075,9 +1117,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1075
1117
|
|
|
1076
1118
|
#### Parameters
|
|
1077
1119
|
|
|
1078
|
-
- `fn` **([string][4] | [function][
|
|
1079
|
-
- `argsOrSec` **([Array][
|
|
1080
|
-
- `sec` **[number][
|
|
1120
|
+
- `fn` **([string][4] | [function][8])** to be executed in browser context.
|
|
1121
|
+
- `argsOrSec` **([Array][11]<any> | [number][12])?** (optional, `1` by default) arguments for function or seconds.
|
|
1122
|
+
- `sec` **[number][12]?** (optional, `1` by default) time in seconds to wait
|
|
1081
1123
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1082
1124
|
|
|
1083
1125
|
### waitForInvisible
|
|
@@ -1092,7 +1134,7 @@ I.waitForInvisible('#popup');
|
|
|
1092
1134
|
#### Parameters
|
|
1093
1135
|
|
|
1094
1136
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1095
|
-
- `sec` **[number][
|
|
1137
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1096
1138
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1097
1139
|
|
|
1098
1140
|
### waitForText
|
|
@@ -1109,7 +1151,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1109
1151
|
#### Parameters
|
|
1110
1152
|
|
|
1111
1153
|
- `text` **[string][4]** to wait for.
|
|
1112
|
-
- `sec` **[number][
|
|
1154
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1113
1155
|
- `context` **([string][4] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
1114
1156
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1115
1157
|
|
|
@@ -1125,7 +1167,7 @@ I.waitForVisible('#popup');
|
|
|
1125
1167
|
#### Parameters
|
|
1126
1168
|
|
|
1127
1169
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1128
|
-
- `sec` **[number][
|
|
1170
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1129
1171
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1130
1172
|
|
|
1131
1173
|
### waitInUrl
|
|
@@ -1139,7 +1181,7 @@ I.waitInUrl('/info', 2);
|
|
|
1139
1181
|
#### Parameters
|
|
1140
1182
|
|
|
1141
1183
|
- `urlPart` **[string][4]** value to check.
|
|
1142
|
-
- `sec` **[number][
|
|
1184
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1143
1185
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1144
1186
|
|
|
1145
1187
|
### waitNumberOfVisibleElements
|
|
@@ -1153,8 +1195,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1153
1195
|
#### Parameters
|
|
1154
1196
|
|
|
1155
1197
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1156
|
-
- `num` **[number][
|
|
1157
|
-
- `sec` **[number][
|
|
1198
|
+
- `num` **[number][12]** number of elements.
|
|
1199
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1158
1200
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1159
1201
|
|
|
1160
1202
|
### waitToHide
|
|
@@ -1169,7 +1211,7 @@ I.waitToHide('#popup');
|
|
|
1169
1211
|
#### Parameters
|
|
1170
1212
|
|
|
1171
1213
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1172
|
-
- `sec` **[number][
|
|
1214
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1173
1215
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1174
1216
|
|
|
1175
1217
|
### waitUrlEquals
|
|
@@ -1184,7 +1226,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1184
1226
|
#### Parameters
|
|
1185
1227
|
|
|
1186
1228
|
- `urlPart` **[string][4]** value to check.
|
|
1187
|
-
- `sec` **[number][
|
|
1229
|
+
- `sec` **[number][12]** (optional, `1` by default) time in seconds to wait
|
|
1188
1230
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1189
1231
|
|
|
1190
1232
|
## getPageUrl
|
|
@@ -1205,18 +1247,24 @@ Client Functions
|
|
|
1205
1247
|
|
|
1206
1248
|
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1207
1249
|
|
|
1208
|
-
[6]: https://developer.mozilla.org/docs/Web/
|
|
1250
|
+
[6]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
1251
|
+
|
|
1252
|
+
[7]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
1253
|
+
|
|
1254
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1255
|
+
|
|
1256
|
+
[9]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
1209
1257
|
|
|
1210
|
-
[
|
|
1258
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1211
1259
|
|
|
1212
|
-
[
|
|
1260
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1213
1261
|
|
|
1214
|
-
[
|
|
1262
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1215
1263
|
|
|
1216
|
-
[
|
|
1264
|
+
[13]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
|
|
1217
1265
|
|
|
1218
|
-
[
|
|
1266
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1219
1267
|
|
|
1220
|
-
[
|
|
1268
|
+
[15]: https://devexpress.github.io/testcafe/documentation/test-api/
|
|
1221
1269
|
|
|
1222
|
-
[
|
|
1270
|
+
[16]: https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#test-controller
|