codeceptjs 3.5.4 → 3.5.6
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/docs/build/Appium.js +40 -1
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +4 -0
- package/docs/build/Playwright.js +59 -41
- package/docs/build/Protractor.js +4 -0
- package/docs/build/Puppeteer.js +21 -10
- package/docs/build/TestCafe.js +2 -0
- package/docs/build/WebDriver.js +8 -4
- package/docs/changelog.md +1 -170
- package/docs/community-helpers.md +4 -8
- package/docs/examples.md +2 -8
- package/docs/helpers/Appium.md +37 -0
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +26 -24
- package/docs/helpers/Playwright.md +1 -1
- package/docs/helpers/Protractor.md +4 -2
- package/docs/helpers/Puppeteer.md +29 -27
- package/docs/helpers/TestCafe.md +16 -15
- package/docs/helpers/WebDriver.md +32 -30
- package/docs/webapi/executeAsyncScript.mustache +2 -0
- package/docs/webapi/executeScript.mustache +2 -0
- package/lib/codecept.js +4 -0
- package/lib/command/info.js +24 -0
- package/lib/command/init.js +40 -4
- package/lib/command/run-workers.js +5 -0
- package/lib/command/run.js +7 -0
- package/lib/data/context.js +14 -6
- package/lib/helper/Appium.js +40 -1
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Playwright.js +58 -40
- package/lib/helper/Puppeteer.js +17 -10
- package/lib/helper/WebDriver.js +4 -4
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/pause.js +1 -2
- package/lib/plugin/autoLogin.js +0 -5
- package/lib/plugin/retryTo.js +0 -2
- package/lib/plugin/tryTo.js +0 -3
- package/lib/session.js +1 -1
- package/package.json +88 -88
- package/translations/fr-FR.js +13 -1
- package/typings/promiseBasedTypes.d.ts +19 -1
- package/typings/types.d.ts +36 -16
|
@@ -56,7 +56,7 @@ Type: [object][4]
|
|
|
56
56
|
- `manualStart` **[boolean][20]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
57
57
|
- `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
58
58
|
- `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
|
|
59
|
-
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false
|
|
59
|
+
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -712,9 +712,10 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
712
712
|
#### Parameters
|
|
713
713
|
|
|
714
714
|
- `args` **...any** to be passed to function.
|
|
715
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderAsynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
716
715
|
- `fn` **([string][6] | [function][12])** function to be executed in browser context.
|
|
717
716
|
|
|
717
|
+
Returns **[Promise][13]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderAsynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
718
|
+
|
|
718
719
|
### executeScript
|
|
719
720
|
|
|
720
721
|
Executes sync script on a page.
|
|
@@ -744,9 +745,10 @@ let date = await I.executeScript(function(el) {
|
|
|
744
745
|
#### Parameters
|
|
745
746
|
|
|
746
747
|
- `args` **...any** to be passed to function.
|
|
747
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for it resolution.
|
|
748
748
|
- `fn` **([string][6] | [function][12])** function to be executed in browser context.
|
|
749
749
|
|
|
750
|
+
Returns **[Promise][13]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for it resolution.
|
|
751
|
+
|
|
750
752
|
### fillField
|
|
751
753
|
|
|
752
754
|
Fills a text field or textarea, after clearing its value, with the given string.
|
|
@@ -788,7 +790,7 @@ I.see('#add-to-cart-bnt');
|
|
|
788
790
|
#### Parameters
|
|
789
791
|
|
|
790
792
|
- `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
791
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
793
|
+
- `options` **any?** Playwright only: [Additional options][14] for available options object as 2nd argument.
|
|
792
794
|
|
|
793
795
|
### forceClick
|
|
794
796
|
|
|
@@ -842,7 +844,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
842
844
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
843
845
|
- `attr` **[string][6]** attribute name.
|
|
844
846
|
|
|
845
|
-
Returns **[Promise][
|
|
847
|
+
Returns **[Promise][13]<[string][6]>** attribute value
|
|
846
848
|
|
|
847
849
|
|
|
848
850
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -862,7 +864,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
862
864
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
863
865
|
- `attr` **[string][6]** attribute name.
|
|
864
866
|
|
|
865
|
-
Returns **[Promise][
|
|
867
|
+
Returns **[Promise][13]<[Array][15]<[string][6]>>** attribute value
|
|
866
868
|
|
|
867
869
|
|
|
868
870
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -877,7 +879,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
877
879
|
console.log(JSON.stringify(logs))
|
|
878
880
|
```
|
|
879
881
|
|
|
880
|
-
Returns **[Promise][
|
|
882
|
+
Returns **[Promise][13]<[Array][15]<any>>**
|
|
881
883
|
|
|
882
884
|
### grabCookie
|
|
883
885
|
|
|
@@ -894,7 +896,7 @@ assert(cookie.value, '123456');
|
|
|
894
896
|
|
|
895
897
|
- `name` **[string][6]?** cookie name.
|
|
896
898
|
|
|
897
|
-
Returns **([Promise][
|
|
899
|
+
Returns **([Promise][13]<[string][6]> | [Promise][13]<[Array][15]<[string][6]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
898
900
|
|
|
899
901
|
### grabCssPropertyFrom
|
|
900
902
|
|
|
@@ -911,7 +913,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
911
913
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
912
914
|
- `cssProperty` **[string][6]** CSS property name.
|
|
913
915
|
|
|
914
|
-
Returns **[Promise][
|
|
916
|
+
Returns **[Promise][13]<[string][6]>** CSS value
|
|
915
917
|
|
|
916
918
|
|
|
917
919
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -931,7 +933,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
931
933
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
932
934
|
- `cssProperty` **[string][6]** CSS property name.
|
|
933
935
|
|
|
934
|
-
Returns **[Promise][
|
|
936
|
+
Returns **[Promise][13]<[Array][15]<[string][6]>>** CSS value
|
|
935
937
|
|
|
936
938
|
|
|
937
939
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -947,7 +949,7 @@ let url = await I.grabCurrentUrl();
|
|
|
947
949
|
console.log(`Current URL is [${url}]`);
|
|
948
950
|
```
|
|
949
951
|
|
|
950
|
-
Returns **[Promise][
|
|
952
|
+
Returns **[Promise][13]<[string][6]>** current URL
|
|
951
953
|
|
|
952
954
|
### grabDataFromPerformanceTiming
|
|
953
955
|
|
|
@@ -972,7 +974,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
972
974
|
}
|
|
973
975
|
```
|
|
974
976
|
|
|
975
|
-
Returns **[Promise][
|
|
977
|
+
Returns **[Promise][13]<any>** automatically synchronized promise through #recorder
|
|
976
978
|
|
|
977
979
|
### grabElementBoundingRect
|
|
978
980
|
|
|
@@ -1000,7 +1002,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1000
1002
|
- `prop`
|
|
1001
1003
|
- `elementSize` **[string][6]?** x, y, width or height of the given element.
|
|
1002
1004
|
|
|
1003
|
-
Returns **([Promise][
|
|
1005
|
+
Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][10]>)** Element bounding rectangle
|
|
1004
1006
|
|
|
1005
1007
|
### grabHTMLFrom
|
|
1006
1008
|
|
|
@@ -1017,7 +1019,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1017
1019
|
- `locator`
|
|
1018
1020
|
- `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1019
1021
|
|
|
1020
|
-
Returns **[Promise][
|
|
1022
|
+
Returns **[Promise][13]<[string][6]>** HTML code for an element
|
|
1021
1023
|
|
|
1022
1024
|
### grabHTMLFromAll
|
|
1023
1025
|
|
|
@@ -1033,7 +1035,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1033
1035
|
- `locator`
|
|
1034
1036
|
- `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1035
1037
|
|
|
1036
|
-
Returns **[Promise][
|
|
1038
|
+
Returns **[Promise][13]<[Array][15]<[string][6]>>** HTML code for an element
|
|
1037
1039
|
|
|
1038
1040
|
### grabNumberOfOpenTabs
|
|
1039
1041
|
|
|
@@ -1044,7 +1046,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1044
1046
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1045
1047
|
```
|
|
1046
1048
|
|
|
1047
|
-
Returns **[Promise][
|
|
1049
|
+
Returns **[Promise][13]<[number][10]>** number of open tabs
|
|
1048
1050
|
|
|
1049
1051
|
### grabNumberOfVisibleElements
|
|
1050
1052
|
|
|
@@ -1059,7 +1061,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1059
1061
|
|
|
1060
1062
|
- `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1061
1063
|
|
|
1062
|
-
Returns **[Promise][
|
|
1064
|
+
Returns **[Promise][13]<[number][10]>** number of visible elements
|
|
1063
1065
|
|
|
1064
1066
|
|
|
1065
1067
|
|
|
@@ -1075,7 +1077,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1075
1077
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1076
1078
|
```
|
|
1077
1079
|
|
|
1078
|
-
Returns **[Promise][
|
|
1080
|
+
Returns **[Promise][13]<PageScrollPosition>** scroll position
|
|
1079
1081
|
|
|
1080
1082
|
### grabPopupText
|
|
1081
1083
|
|
|
@@ -1085,7 +1087,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1085
1087
|
await I.grabPopupText();
|
|
1086
1088
|
```
|
|
1087
1089
|
|
|
1088
|
-
Returns **[Promise][
|
|
1090
|
+
Returns **[Promise][13]<([string][6] | null)>**
|
|
1089
1091
|
|
|
1090
1092
|
### grabSource
|
|
1091
1093
|
|
|
@@ -1096,7 +1098,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1096
1098
|
let pageSource = await I.grabSource();
|
|
1097
1099
|
```
|
|
1098
1100
|
|
|
1099
|
-
Returns **[Promise][
|
|
1101
|
+
Returns **[Promise][13]<[string][6]>** source code
|
|
1100
1102
|
|
|
1101
1103
|
### grabTextFrom
|
|
1102
1104
|
|
|
@@ -1113,7 +1115,7 @@ If multiple elements found returns first element.
|
|
|
1113
1115
|
|
|
1114
1116
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1115
1117
|
|
|
1116
|
-
Returns **[Promise][
|
|
1118
|
+
Returns **[Promise][13]<[string][6]>** attribute value
|
|
1117
1119
|
|
|
1118
1120
|
|
|
1119
1121
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1132,7 +1134,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1132
1134
|
|
|
1133
1135
|
- `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1134
1136
|
|
|
1135
|
-
Returns **[Promise][
|
|
1137
|
+
Returns **[Promise][13]<[Array][15]<[string][6]>>** attribute value
|
|
1136
1138
|
|
|
1137
1139
|
|
|
1138
1140
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1147,7 +1149,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1147
1149
|
let title = await I.grabTitle();
|
|
1148
1150
|
```
|
|
1149
1151
|
|
|
1150
|
-
Returns **[Promise][
|
|
1152
|
+
Returns **[Promise][13]<[string][6]>** title
|
|
1151
1153
|
|
|
1152
1154
|
### grabValueFrom
|
|
1153
1155
|
|
|
@@ -1163,7 +1165,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1163
1165
|
|
|
1164
1166
|
- `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1165
1167
|
|
|
1166
|
-
Returns **[Promise][
|
|
1168
|
+
Returns **[Promise][13]<[string][6]>** attribute value
|
|
1167
1169
|
|
|
1168
1170
|
### grabValueFromAll
|
|
1169
1171
|
|
|
@@ -1178,7 +1180,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1178
1180
|
|
|
1179
1181
|
- `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1180
1182
|
|
|
1181
|
-
Returns **[Promise][
|
|
1183
|
+
Returns **[Promise][13]<[Array][15]<[string][6]>>** attribute value
|
|
1182
1184
|
|
|
1183
1185
|
### handleDownloads
|
|
1184
1186
|
|
|
@@ -2166,9 +2168,9 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2166
2168
|
|
|
2167
2169
|
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2168
2170
|
|
|
2169
|
-
[13]: https://
|
|
2171
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2170
2172
|
|
|
2171
|
-
[14]: https://
|
|
2173
|
+
[14]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2172
2174
|
|
|
2173
2175
|
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2174
2176
|
|
package/docs/helpers/TestCafe.md
CHANGED
|
@@ -420,7 +420,8 @@ let date = await I.executeScript(function(el) {
|
|
|
420
420
|
|
|
421
421
|
- `fn` **([string][4] | [function][8])** function to be executed in browser context.
|
|
422
422
|
- `args` **...any** to be passed to function.
|
|
423
|
-
|
|
423
|
+
|
|
424
|
+
Returns **[Promise][9]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for its resolution.
|
|
424
425
|
|
|
425
426
|
### fillField
|
|
426
427
|
|
|
@@ -459,7 +460,7 @@ I.see('#add-to-cart-bnt');
|
|
|
459
460
|
#### Parameters
|
|
460
461
|
|
|
461
462
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
462
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
463
|
+
- `options` **any?** Playwright only: [Additional options][10] for available options object as 2nd argument.
|
|
463
464
|
|
|
464
465
|
### grabAttributeFrom
|
|
465
466
|
|
|
@@ -476,7 +477,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
476
477
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
477
478
|
- `attr` **[string][4]** attribute name.
|
|
478
479
|
|
|
479
|
-
Returns **[Promise][
|
|
480
|
+
Returns **[Promise][9]<[string][4]>** attribute value
|
|
480
481
|
|
|
481
482
|
### grabAttributeFromAll
|
|
482
483
|
|
|
@@ -493,7 +494,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
493
494
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
494
495
|
- `attr` **[string][4]** attribute name.
|
|
495
496
|
|
|
496
|
-
Returns **[Promise][
|
|
497
|
+
Returns **[Promise][9]<[string][4]>** attribute value
|
|
497
498
|
|
|
498
499
|
### grabBrowserLogs
|
|
499
500
|
|
|
@@ -519,7 +520,7 @@ assert(cookie.value, '123456');
|
|
|
519
520
|
|
|
520
521
|
- `name` **[string][4]?** cookie name.
|
|
521
522
|
|
|
522
|
-
Returns **([Promise][
|
|
523
|
+
Returns **([Promise][9]<[string][4]> | [Promise][9]<[Array][11]<[string][4]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
523
524
|
|
|
524
525
|
### grabCurrentUrl
|
|
525
526
|
|
|
@@ -531,7 +532,7 @@ let url = await I.grabCurrentUrl();
|
|
|
531
532
|
console.log(`Current URL is [${url}]`);
|
|
532
533
|
```
|
|
533
534
|
|
|
534
|
-
Returns **[Promise][
|
|
535
|
+
Returns **[Promise][9]<[string][4]>** current URL
|
|
535
536
|
|
|
536
537
|
### grabNumberOfVisibleElements
|
|
537
538
|
|
|
@@ -546,7 +547,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
546
547
|
|
|
547
548
|
- `locator` **([string][4] | [object][5])** located by CSS|XPath|strict locator.
|
|
548
549
|
|
|
549
|
-
Returns **[Promise][
|
|
550
|
+
Returns **[Promise][9]<[number][12]>** number of visible elements
|
|
550
551
|
|
|
551
552
|
### grabPageScrollPosition
|
|
552
553
|
|
|
@@ -557,7 +558,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
557
558
|
let { x, y } = await I.grabPageScrollPosition();
|
|
558
559
|
```
|
|
559
560
|
|
|
560
|
-
Returns **[Promise][
|
|
561
|
+
Returns **[Promise][9]<PageScrollPosition>** scroll position
|
|
561
562
|
|
|
562
563
|
### grabSource
|
|
563
564
|
|
|
@@ -568,7 +569,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
568
569
|
let pageSource = await I.grabSource();
|
|
569
570
|
```
|
|
570
571
|
|
|
571
|
-
Returns **[Promise][
|
|
572
|
+
Returns **[Promise][9]<[string][4]>** source code
|
|
572
573
|
|
|
573
574
|
### grabTextFrom
|
|
574
575
|
|
|
@@ -585,7 +586,7 @@ If multiple elements found returns first element.
|
|
|
585
586
|
|
|
586
587
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
587
588
|
|
|
588
|
-
Returns **[Promise][
|
|
589
|
+
Returns **[Promise][9]<[string][4]>** attribute value
|
|
589
590
|
|
|
590
591
|
### grabTextFromAll
|
|
591
592
|
|
|
@@ -600,7 +601,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
600
601
|
|
|
601
602
|
- `locator` **([string][4] | [object][5])** element located by CSS|XPath|strict locator.
|
|
602
603
|
|
|
603
|
-
Returns **[Promise][
|
|
604
|
+
Returns **[Promise][9]<[Array][11]<[string][4]>>** attribute value
|
|
604
605
|
|
|
605
606
|
### grabValueFrom
|
|
606
607
|
|
|
@@ -616,7 +617,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
616
617
|
|
|
617
618
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
618
619
|
|
|
619
|
-
Returns **[Promise][
|
|
620
|
+
Returns **[Promise][9]<[string][4]>** attribute value
|
|
620
621
|
|
|
621
622
|
### grabValueFromAll
|
|
622
623
|
|
|
@@ -631,7 +632,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
631
632
|
|
|
632
633
|
- `locator` **([string][4] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
633
634
|
|
|
634
|
-
Returns **[Promise][
|
|
635
|
+
Returns **[Promise][9]<[Array][11]<[string][4]>>** attribute value
|
|
635
636
|
|
|
636
637
|
### moveCursorTo
|
|
637
638
|
|
|
@@ -1253,9 +1254,9 @@ Client Functions
|
|
|
1253
1254
|
|
|
1254
1255
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1255
1256
|
|
|
1256
|
-
[9]: https://
|
|
1257
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1257
1258
|
|
|
1258
|
-
[10]: https://
|
|
1259
|
+
[10]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
1259
1260
|
|
|
1260
1261
|
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1261
1262
|
|
|
@@ -45,7 +45,7 @@ Type: [object][16]
|
|
|
45
45
|
- `desiredCapabilities` **[object][16]?** Selenium's [desired capabilities][6].
|
|
46
46
|
- `manualStart` **[boolean][32]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
47
47
|
- `timeouts` **[object][16]?** [WebDriver timeouts][37] defined as hash.
|
|
48
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
48
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
@@ -865,9 +865,10 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
865
865
|
#### Parameters
|
|
866
866
|
|
|
867
867
|
- `args` **...any** to be passed to function.
|
|
868
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
869
868
|
- `fn` **([string][17] | [function][24])** function to be executed in browser context.
|
|
870
869
|
|
|
870
|
+
Returns **[Promise][25]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
871
|
+
|
|
871
872
|
### executeScript
|
|
872
873
|
|
|
873
874
|
Executes sync script on a page.
|
|
@@ -897,9 +898,10 @@ let date = await I.executeScript(function(el) {
|
|
|
897
898
|
#### Parameters
|
|
898
899
|
|
|
899
900
|
- `args` **...any** to be passed to function.
|
|
900
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderWraps [execute][25] command.
|
|
901
901
|
- `fn` **([string][17] | [function][24])** function to be executed in browser context.
|
|
902
902
|
|
|
903
|
+
Returns **[Promise][25]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderWraps [execute][26] command.
|
|
904
|
+
|
|
903
905
|
### fillField
|
|
904
906
|
|
|
905
907
|
Fills a text field or textarea, after clearing its value, with the given string.
|
|
@@ -942,7 +944,7 @@ I.see('#add-to-cart-bnt');
|
|
|
942
944
|
#### Parameters
|
|
943
945
|
|
|
944
946
|
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
945
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
947
|
+
- `options` **any?** Playwright only: [Additional options][27] for available options object as 2nd argument.
|
|
946
948
|
|
|
947
949
|
### forceClick
|
|
948
950
|
|
|
@@ -1017,7 +1019,7 @@ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
|
1017
1019
|
const windows = await I.grabAllWindowHandles();
|
|
1018
1020
|
```
|
|
1019
1021
|
|
|
1020
|
-
Returns **[Promise][
|
|
1022
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>**
|
|
1021
1023
|
|
|
1022
1024
|
### grabAttributeFrom
|
|
1023
1025
|
|
|
@@ -1034,7 +1036,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
1034
1036
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1035
1037
|
- `attr` **[string][17]** attribute name.
|
|
1036
1038
|
|
|
1037
|
-
Returns **[Promise][
|
|
1039
|
+
Returns **[Promise][25]<[string][17]>** attribute value
|
|
1038
1040
|
|
|
1039
1041
|
### grabAttributeFromAll
|
|
1040
1042
|
|
|
@@ -1050,7 +1052,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1050
1052
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1051
1053
|
- `attr` **[string][17]** attribute name.
|
|
1052
1054
|
|
|
1053
|
-
Returns **[Promise][
|
|
1055
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>** attribute value
|
|
1054
1056
|
|
|
1055
1057
|
### grabBrowserLogs
|
|
1056
1058
|
|
|
@@ -1062,7 +1064,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1062
1064
|
console.log(JSON.stringify(logs))
|
|
1063
1065
|
```
|
|
1064
1066
|
|
|
1065
|
-
Returns **([Promise][
|
|
1067
|
+
Returns **([Promise][25]<[Array][28]<[object][16]>> | [undefined][29])** all browser logs
|
|
1066
1068
|
|
|
1067
1069
|
### grabCookie
|
|
1068
1070
|
|
|
@@ -1079,7 +1081,7 @@ assert(cookie.value, '123456');
|
|
|
1079
1081
|
|
|
1080
1082
|
- `name` **[string][17]?** cookie name.
|
|
1081
1083
|
|
|
1082
|
-
Returns **([Promise][
|
|
1084
|
+
Returns **([Promise][25]<[string][17]> | [Promise][25]<[Array][28]<[string][17]>>)** attribute value
|
|
1083
1085
|
|
|
1084
1086
|
### grabCssPropertyFrom
|
|
1085
1087
|
|
|
@@ -1096,7 +1098,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1096
1098
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1097
1099
|
- `cssProperty` **[string][17]** CSS property name.
|
|
1098
1100
|
|
|
1099
|
-
Returns **[Promise][
|
|
1101
|
+
Returns **[Promise][25]<[string][17]>** CSS value
|
|
1100
1102
|
|
|
1101
1103
|
### grabCssPropertyFromAll
|
|
1102
1104
|
|
|
@@ -1112,7 +1114,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1112
1114
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1113
1115
|
- `cssProperty` **[string][17]** CSS property name.
|
|
1114
1116
|
|
|
1115
|
-
Returns **[Promise][
|
|
1117
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>** CSS value
|
|
1116
1118
|
|
|
1117
1119
|
### grabCurrentUrl
|
|
1118
1120
|
|
|
@@ -1124,7 +1126,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1124
1126
|
console.log(`Current URL is [${url}]`);
|
|
1125
1127
|
```
|
|
1126
1128
|
|
|
1127
|
-
Returns **[Promise][
|
|
1129
|
+
Returns **[Promise][25]<[string][17]>** current URL
|
|
1128
1130
|
|
|
1129
1131
|
### grabCurrentWindowHandle
|
|
1130
1132
|
|
|
@@ -1135,7 +1137,7 @@ Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
|
1135
1137
|
const window = await I.grabCurrentWindowHandle();
|
|
1136
1138
|
```
|
|
1137
1139
|
|
|
1138
|
-
Returns **[Promise][
|
|
1140
|
+
Returns **[Promise][25]<[string][17]>**
|
|
1139
1141
|
|
|
1140
1142
|
### grabElementBoundingRect
|
|
1141
1143
|
|
|
@@ -1163,7 +1165,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1163
1165
|
- `prop`
|
|
1164
1166
|
- `elementSize` **[string][17]?** x, y, width or height of the given element.
|
|
1165
1167
|
|
|
1166
|
-
Returns **([Promise][
|
|
1168
|
+
Returns **([Promise][25]<DOMRect> | [Promise][25]<[number][22]>)** Element bounding rectangle
|
|
1167
1169
|
|
|
1168
1170
|
### grabGeoLocation
|
|
1169
1171
|
|
|
@@ -1174,7 +1176,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1174
1176
|
let geoLocation = await I.grabGeoLocation();
|
|
1175
1177
|
```
|
|
1176
1178
|
|
|
1177
|
-
Returns **[Promise][
|
|
1179
|
+
Returns **[Promise][25]<{latitude: [number][22], longitude: [number][22], altitude: [number][22]}>**
|
|
1178
1180
|
|
|
1179
1181
|
### grabHTMLFrom
|
|
1180
1182
|
|
|
@@ -1191,7 +1193,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1191
1193
|
- `locator`
|
|
1192
1194
|
- `element` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1193
1195
|
|
|
1194
|
-
Returns **[Promise][
|
|
1196
|
+
Returns **[Promise][25]<[string][17]>** HTML code for an element
|
|
1195
1197
|
|
|
1196
1198
|
### grabHTMLFromAll
|
|
1197
1199
|
|
|
@@ -1207,7 +1209,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1207
1209
|
- `locator`
|
|
1208
1210
|
- `element` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1209
1211
|
|
|
1210
|
-
Returns **[Promise][
|
|
1212
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>** HTML code for an element
|
|
1211
1213
|
|
|
1212
1214
|
### grabNumberOfOpenTabs
|
|
1213
1215
|
|
|
@@ -1218,7 +1220,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1218
1220
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1219
1221
|
```
|
|
1220
1222
|
|
|
1221
|
-
Returns **[Promise][
|
|
1223
|
+
Returns **[Promise][25]<[number][22]>** number of open tabs
|
|
1222
1224
|
|
|
1223
1225
|
### grabNumberOfVisibleElements
|
|
1224
1226
|
|
|
@@ -1233,7 +1235,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1233
1235
|
|
|
1234
1236
|
- `locator` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1235
1237
|
|
|
1236
|
-
Returns **[Promise][
|
|
1238
|
+
Returns **[Promise][25]<[number][22]>** number of visible elements
|
|
1237
1239
|
|
|
1238
1240
|
### grabPageScrollPosition
|
|
1239
1241
|
|
|
@@ -1244,7 +1246,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1244
1246
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1245
1247
|
```
|
|
1246
1248
|
|
|
1247
|
-
Returns **[Promise][
|
|
1249
|
+
Returns **[Promise][25]<PageScrollPosition>** scroll position
|
|
1248
1250
|
|
|
1249
1251
|
### grabPopupText
|
|
1250
1252
|
|
|
@@ -1254,7 +1256,7 @@ Grab the text within the popup. If no popup is visible then it will return null.
|
|
|
1254
1256
|
await I.grabPopupText();
|
|
1255
1257
|
```
|
|
1256
1258
|
|
|
1257
|
-
Returns **[Promise][
|
|
1259
|
+
Returns **[Promise][25]<[string][17]>**
|
|
1258
1260
|
|
|
1259
1261
|
### grabSource
|
|
1260
1262
|
|
|
@@ -1265,7 +1267,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1265
1267
|
let pageSource = await I.grabSource();
|
|
1266
1268
|
```
|
|
1267
1269
|
|
|
1268
|
-
Returns **[Promise][
|
|
1270
|
+
Returns **[Promise][25]<[string][17]>** source code
|
|
1269
1271
|
|
|
1270
1272
|
### grabTextFrom
|
|
1271
1273
|
|
|
@@ -1282,7 +1284,7 @@ If multiple elements found returns first element.
|
|
|
1282
1284
|
|
|
1283
1285
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1284
1286
|
|
|
1285
|
-
Returns **[Promise][
|
|
1287
|
+
Returns **[Promise][25]<[string][17]>** attribute value
|
|
1286
1288
|
|
|
1287
1289
|
### grabTextFromAll
|
|
1288
1290
|
|
|
@@ -1297,7 +1299,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1297
1299
|
|
|
1298
1300
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1299
1301
|
|
|
1300
|
-
Returns **[Promise][
|
|
1302
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>** attribute value
|
|
1301
1303
|
|
|
1302
1304
|
### grabTitle
|
|
1303
1305
|
|
|
@@ -1308,7 +1310,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1308
1310
|
let title = await I.grabTitle();
|
|
1309
1311
|
```
|
|
1310
1312
|
|
|
1311
|
-
Returns **[Promise][
|
|
1313
|
+
Returns **[Promise][25]<[string][17]>** title
|
|
1312
1314
|
|
|
1313
1315
|
### grabValueFrom
|
|
1314
1316
|
|
|
@@ -1324,7 +1326,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1324
1326
|
|
|
1325
1327
|
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
1326
1328
|
|
|
1327
|
-
Returns **[Promise][
|
|
1329
|
+
Returns **[Promise][25]<[string][17]>** attribute value
|
|
1328
1330
|
|
|
1329
1331
|
### grabValueFromAll
|
|
1330
1332
|
|
|
@@ -1339,7 +1341,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1339
1341
|
|
|
1340
1342
|
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
1341
1343
|
|
|
1342
|
-
Returns **[Promise][
|
|
1344
|
+
Returns **[Promise][25]<[Array][28]<[string][17]>>** attribute value
|
|
1343
1345
|
|
|
1344
1346
|
### moveCursorTo
|
|
1345
1347
|
|
|
@@ -2344,11 +2346,11 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2344
2346
|
|
|
2345
2347
|
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2346
2348
|
|
|
2347
|
-
[25]:
|
|
2349
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2348
2350
|
|
|
2349
|
-
[26]:
|
|
2351
|
+
[26]: http://webdriver.io/api/protocol/execute.html
|
|
2350
2352
|
|
|
2351
|
-
[27]: https://
|
|
2353
|
+
[27]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2352
2354
|
|
|
2353
2355
|
[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2354
2356
|
|
|
@@ -21,4 +21,6 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
21
21
|
|
|
22
22
|
@param {string|function} fn function to be executed in browser context.
|
|
23
23
|
@param {...any} args to be passed to function.
|
|
24
|
+
@returns {Promise<any>} script return value
|
|
25
|
+
|
|
24
26
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
@@ -23,4 +23,6 @@ let date = await I.executeScript(function(el) {
|
|
|
23
23
|
|
|
24
24
|
@param {string|function} fn function to be executed in browser context.
|
|
25
25
|
@param {...any} args to be passed to function.
|
|
26
|
+
@returns {Promise<any>} script return value
|
|
27
|
+
|
|
26
28
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
package/lib/codecept.js
CHANGED
|
@@ -89,6 +89,9 @@ class Codecept {
|
|
|
89
89
|
global.When = stepDefinitions.When;
|
|
90
90
|
global.Then = stepDefinitions.Then;
|
|
91
91
|
global.DefineParameterType = stepDefinitions.defineParameterType;
|
|
92
|
+
|
|
93
|
+
// debug mode
|
|
94
|
+
global.debugMode = false;
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -176,6 +179,7 @@ class Codecept {
|
|
|
176
179
|
* Run a specific test or all loaded tests.
|
|
177
180
|
*
|
|
178
181
|
* @param {string} [test]
|
|
182
|
+
* @returns {Promise<void>}
|
|
179
183
|
*/
|
|
180
184
|
async run(test) {
|
|
181
185
|
return new Promise((resolve, reject) => {
|