codeceptjs 3.1.0 → 3.2.0
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 +129 -3
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +94 -60
- package/docs/basics.md +1 -1
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +106 -34
- package/docs/build/FileSystem.js +1 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +97 -94
- package/docs/build/Protractor.js +68 -81
- package/docs/build/Puppeteer.js +91 -93
- package/docs/build/REST.js +1 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +71 -95
- package/docs/changelog.md +144 -2
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/custom-helpers.md +1 -36
- package/docs/helpers/Appium.md +97 -95
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Playwright.md +16 -18
- package/docs/helpers/Puppeteer.md +18 -18
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +3 -19
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/playwright.md +40 -0
- package/docs/plugins.md +185 -68
- package/docs/reports.md +23 -5
- package/lib/actor.js +20 -2
- package/lib/codecept.js +15 -2
- package/lib/command/info.js +1 -1
- package/lib/config.js +13 -1
- package/lib/container.js +3 -1
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +49 -4
- package/lib/helper/FileSystem.js +1 -0
- package/lib/helper/Playwright.js +35 -22
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +20 -19
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -16
- package/lib/index.js +2 -0
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/gherkin.js +7 -1
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/helpers.js +1 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +71 -0
- package/lib/locator.js +3 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +90 -0
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +21 -8
- package/lib/step.js +7 -2
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +6 -7
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +198 -82
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
package/docs/build/Protractor.js
CHANGED
|
@@ -124,6 +124,8 @@ class Protractor extends Helper {
|
|
|
124
124
|
|
|
125
125
|
this.isRunning = false;
|
|
126
126
|
this._setConfig(config);
|
|
127
|
+
|
|
128
|
+
console.log('Protractor helper is deprecated as well as Protractor itself.\nThis helper will be removed in next major release');
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
_validateConfig(config) {
|
|
@@ -487,8 +489,8 @@ class Protractor extends Helper {
|
|
|
487
489
|
* I.click({css: 'nav a.login'});
|
|
488
490
|
* ```
|
|
489
491
|
*
|
|
490
|
-
* @param {
|
|
491
|
-
* @param {?
|
|
492
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
493
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
492
494
|
*
|
|
493
495
|
*/
|
|
494
496
|
async click(locator, context = null) {
|
|
@@ -513,8 +515,8 @@ class Protractor extends Helper {
|
|
|
513
515
|
* I.doubleClick('.btn.edit');
|
|
514
516
|
* ```
|
|
515
517
|
*
|
|
516
|
-
* @param {
|
|
517
|
-
* @param {?
|
|
518
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
519
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
518
520
|
*
|
|
519
521
|
*/
|
|
520
522
|
async doubleClick(locator, context = null) {
|
|
@@ -540,8 +542,8 @@ class Protractor extends Helper {
|
|
|
540
542
|
* I.rightClick('Click me', '.context');
|
|
541
543
|
* ```
|
|
542
544
|
*
|
|
543
|
-
* @param {
|
|
544
|
-
* @param {?
|
|
545
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
546
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
545
547
|
*
|
|
546
548
|
*/
|
|
547
549
|
async rightClick(locator, context = null) {
|
|
@@ -572,7 +574,7 @@ class Protractor extends Helper {
|
|
|
572
574
|
* I.moveCursorTo('#submit', 5,5);
|
|
573
575
|
* ```
|
|
574
576
|
*
|
|
575
|
-
* @param {
|
|
577
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
576
578
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
577
579
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
578
580
|
*
|
|
@@ -597,7 +599,7 @@ class Protractor extends Helper {
|
|
|
597
599
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
598
600
|
* ```
|
|
599
601
|
* @param {string} text expected on page.
|
|
600
|
-
* @param {?
|
|
602
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
601
603
|
*/
|
|
602
604
|
async see(text, context = null) {
|
|
603
605
|
return proceedSee.call(this, 'assert', text, context);
|
|
@@ -611,7 +613,7 @@ class Protractor extends Helper {
|
|
|
611
613
|
* ```
|
|
612
614
|
*
|
|
613
615
|
* @param {string} text element value to check.
|
|
614
|
-
* @param {
|
|
616
|
+
* @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
615
617
|
*/
|
|
616
618
|
async seeTextEquals(text, context = null) {
|
|
617
619
|
return proceedSee.call(this, 'assert', text, context, true);
|
|
@@ -627,7 +629,7 @@ class Protractor extends Helper {
|
|
|
627
629
|
* ```
|
|
628
630
|
*
|
|
629
631
|
* @param {string} text which is not present.
|
|
630
|
-
* @param {
|
|
632
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
631
633
|
*
|
|
632
634
|
*/
|
|
633
635
|
dontSee(text, context = null) {
|
|
@@ -684,7 +686,7 @@ class Protractor extends Helper {
|
|
|
684
686
|
* ```js
|
|
685
687
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
686
688
|
* ```
|
|
687
|
-
* @param {
|
|
689
|
+
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
688
690
|
* @param {string|Array<*>} option visible text or value of option.
|
|
689
691
|
*
|
|
690
692
|
*/
|
|
@@ -722,8 +724,8 @@ class Protractor extends Helper {
|
|
|
722
724
|
* // or by strict locator
|
|
723
725
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
724
726
|
* ```
|
|
725
|
-
* @param {
|
|
726
|
-
* @param {
|
|
727
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
728
|
+
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
727
729
|
*
|
|
728
730
|
*/
|
|
729
731
|
async fillField(field, value) {
|
|
@@ -775,7 +777,7 @@ class Protractor extends Helper {
|
|
|
775
777
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
776
778
|
* ```
|
|
777
779
|
*
|
|
778
|
-
* @param {
|
|
780
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
779
781
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
780
782
|
*/
|
|
781
783
|
async attachFile(locator, pathToFile) {
|
|
@@ -802,7 +804,7 @@ class Protractor extends Helper {
|
|
|
802
804
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
803
805
|
* I.seeInField('#searchform input','Search');
|
|
804
806
|
* ```
|
|
805
|
-
* @param {
|
|
807
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
806
808
|
* @param {string} value value to check.
|
|
807
809
|
*
|
|
808
810
|
*/
|
|
@@ -819,7 +821,7 @@ class Protractor extends Helper {
|
|
|
819
821
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
820
822
|
* ```
|
|
821
823
|
*
|
|
822
|
-
* @param {
|
|
824
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
823
825
|
* @param {string} value value to check.
|
|
824
826
|
*/
|
|
825
827
|
async dontSeeInField(field, value) {
|
|
@@ -833,7 +835,7 @@ class Protractor extends Helper {
|
|
|
833
835
|
* ```js
|
|
834
836
|
* I.appendField('#myTextField', 'appended');
|
|
835
837
|
* ```
|
|
836
|
-
* @param {
|
|
838
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
837
839
|
* @param {string} value text value to append.
|
|
838
840
|
*/
|
|
839
841
|
async appendField(field, value) {
|
|
@@ -850,7 +852,7 @@ class Protractor extends Helper {
|
|
|
850
852
|
* I.clearField('user[email]');
|
|
851
853
|
* I.clearField('#email');
|
|
852
854
|
* ```
|
|
853
|
-
* @param {
|
|
855
|
+
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
854
856
|
*
|
|
855
857
|
*/
|
|
856
858
|
async clearField(field) {
|
|
@@ -870,8 +872,8 @@ class Protractor extends Helper {
|
|
|
870
872
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
871
873
|
* I.checkOption('agree', '//form');
|
|
872
874
|
* ```
|
|
873
|
-
* @param {
|
|
874
|
-
* @param {?
|
|
875
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
876
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
875
877
|
*/
|
|
876
878
|
async checkOption(field, context = null) {
|
|
877
879
|
let matcher = this.browser;
|
|
@@ -897,8 +899,8 @@ class Protractor extends Helper {
|
|
|
897
899
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
898
900
|
* I.uncheckOption('agree', '//form');
|
|
899
901
|
* ```
|
|
900
|
-
* @param {
|
|
901
|
-
* @param {?
|
|
902
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
903
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
902
904
|
*/
|
|
903
905
|
async uncheckOption(field, context = null) {
|
|
904
906
|
let matcher = this.browser;
|
|
@@ -922,7 +924,7 @@ class Protractor extends Helper {
|
|
|
922
924
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
923
925
|
* ```
|
|
924
926
|
*
|
|
925
|
-
* @param {
|
|
927
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
926
928
|
*
|
|
927
929
|
*/
|
|
928
930
|
async seeCheckboxIsChecked(field) {
|
|
@@ -938,7 +940,7 @@ class Protractor extends Helper {
|
|
|
938
940
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
939
941
|
* ```
|
|
940
942
|
*
|
|
941
|
-
* @param {
|
|
943
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
942
944
|
*
|
|
943
945
|
*/
|
|
944
946
|
async dontSeeCheckboxIsChecked(field) {
|
|
@@ -953,7 +955,7 @@ class Protractor extends Helper {
|
|
|
953
955
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
954
956
|
* ```
|
|
955
957
|
*
|
|
956
|
-
* @param {
|
|
958
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
957
959
|
* @returns {Promise<string[]>} attribute value
|
|
958
960
|
*
|
|
959
961
|
*/
|
|
@@ -975,7 +977,7 @@ class Protractor extends Helper {
|
|
|
975
977
|
* ```
|
|
976
978
|
* If multiple elements found returns first element.
|
|
977
979
|
*
|
|
978
|
-
* @param {
|
|
980
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
979
981
|
* @returns {Promise<string>} attribute value
|
|
980
982
|
*
|
|
981
983
|
*/
|
|
@@ -997,7 +999,7 @@ class Protractor extends Helper {
|
|
|
997
999
|
* let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
998
1000
|
* ```
|
|
999
1001
|
*
|
|
1000
|
-
* @param {
|
|
1002
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
1001
1003
|
* @returns {Promise<string[]>} HTML code for an element
|
|
1002
1004
|
*
|
|
1003
1005
|
*/
|
|
@@ -1020,7 +1022,7 @@ class Protractor extends Helper {
|
|
|
1020
1022
|
* let postHTML = await I.grabHTMLFrom('#post');
|
|
1021
1023
|
* ```
|
|
1022
1024
|
*
|
|
1023
|
-
* @param {
|
|
1025
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
1024
1026
|
* @returns {Promise<string>} HTML code for an element
|
|
1025
1027
|
*
|
|
1026
1028
|
*/
|
|
@@ -1041,7 +1043,7 @@ class Protractor extends Helper {
|
|
|
1041
1043
|
* ```js
|
|
1042
1044
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
1043
1045
|
* ```
|
|
1044
|
-
* @param {
|
|
1046
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1045
1047
|
* @returns {Promise<string[]>} attribute value
|
|
1046
1048
|
*
|
|
1047
1049
|
*/
|
|
@@ -1060,7 +1062,7 @@ class Protractor extends Helper {
|
|
|
1060
1062
|
* ```js
|
|
1061
1063
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
1062
1064
|
* ```
|
|
1063
|
-
* @param {
|
|
1065
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1064
1066
|
* @returns {Promise<string>} attribute value
|
|
1065
1067
|
*
|
|
1066
1068
|
*/
|
|
@@ -1082,7 +1084,7 @@ class Protractor extends Helper {
|
|
|
1082
1084
|
* const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
1083
1085
|
* ```
|
|
1084
1086
|
*
|
|
1085
|
-
* @param {
|
|
1087
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1086
1088
|
* @param {string} cssProperty CSS property name.
|
|
1087
1089
|
* @returns {Promise<string[]>} CSS value
|
|
1088
1090
|
*
|
|
@@ -1103,7 +1105,7 @@ class Protractor extends Helper {
|
|
|
1103
1105
|
* const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
1104
1106
|
* ```
|
|
1105
1107
|
*
|
|
1106
|
-
* @param {
|
|
1108
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1107
1109
|
* @param {string} cssProperty CSS property name.
|
|
1108
1110
|
* @returns {Promise<string>} CSS value
|
|
1109
1111
|
*
|
|
@@ -1126,7 +1128,7 @@ class Protractor extends Helper {
|
|
|
1126
1128
|
* ```js
|
|
1127
1129
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1128
1130
|
* ```
|
|
1129
|
-
* @param {
|
|
1131
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1130
1132
|
* @param {string} attr attribute name.
|
|
1131
1133
|
* @returns {Promise<string[]>} attribute value
|
|
1132
1134
|
*
|
|
@@ -1150,7 +1152,7 @@ class Protractor extends Helper {
|
|
|
1150
1152
|
* ```js
|
|
1151
1153
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1152
1154
|
* ```
|
|
1153
|
-
* @param {
|
|
1155
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1154
1156
|
* @param {string} attr attribute name.
|
|
1155
1157
|
* @returns {Promise<string>} attribute value
|
|
1156
1158
|
*
|
|
@@ -1179,11 +1181,14 @@ class Protractor extends Helper {
|
|
|
1179
1181
|
}
|
|
1180
1182
|
|
|
1181
1183
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1184
|
+
* Checks that title is equal to provided one.
|
|
1185
|
+
*
|
|
1186
|
+
* ```js
|
|
1187
|
+
* I.seeTitleEquals('Test title.');
|
|
1188
|
+
* ```
|
|
1189
|
+
*
|
|
1190
|
+
* @param {string} text value to check.
|
|
1191
|
+
*
|
|
1187
1192
|
*/
|
|
1188
1193
|
async seeTitleEquals(text) {
|
|
1189
1194
|
const title = await this.browser.getTitle();
|
|
@@ -1227,7 +1232,7 @@ class Protractor extends Helper {
|
|
|
1227
1232
|
* ```js
|
|
1228
1233
|
* I.seeElement('#modal');
|
|
1229
1234
|
* ```
|
|
1230
|
-
* @param {
|
|
1235
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1231
1236
|
*/
|
|
1232
1237
|
async seeElement(locator) {
|
|
1233
1238
|
let els = await this._locate(locator, true);
|
|
@@ -1242,7 +1247,7 @@ class Protractor extends Helper {
|
|
|
1242
1247
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1243
1248
|
* ```
|
|
1244
1249
|
*
|
|
1245
|
-
* @param {
|
|
1250
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1246
1251
|
*/
|
|
1247
1252
|
async dontSeeElement(locator) {
|
|
1248
1253
|
let els = await this._locate(locator, false);
|
|
@@ -1257,7 +1262,7 @@ class Protractor extends Helper {
|
|
|
1257
1262
|
* ```js
|
|
1258
1263
|
* I.seeElementInDOM('#modal');
|
|
1259
1264
|
* ```
|
|
1260
|
-
* @param {
|
|
1265
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1261
1266
|
*
|
|
1262
1267
|
*/
|
|
1263
1268
|
async seeElementInDOM(locator) {
|
|
@@ -1271,7 +1276,7 @@ class Protractor extends Helper {
|
|
|
1271
1276
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
1272
1277
|
* ```
|
|
1273
1278
|
*
|
|
1274
|
-
* @param {
|
|
1279
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1275
1280
|
*/
|
|
1276
1281
|
async dontSeeElementInDOM(locator) {
|
|
1277
1282
|
return this.browser.findElements(guessLocator(locator) || global.by.css(locator)).then(els => empty('elements').assert(els.fill('ELEMENT')));
|
|
@@ -1326,7 +1331,7 @@ class Protractor extends Helper {
|
|
|
1326
1331
|
* I.seeNumberOfElements('#submitBtn', 1);
|
|
1327
1332
|
* ```
|
|
1328
1333
|
*
|
|
1329
|
-
* @param {
|
|
1334
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1330
1335
|
* @param {number} num number of elements.
|
|
1331
1336
|
*
|
|
1332
1337
|
*/
|
|
@@ -1343,7 +1348,7 @@ class Protractor extends Helper {
|
|
|
1343
1348
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
1344
1349
|
* ```
|
|
1345
1350
|
*
|
|
1346
|
-
* @param {
|
|
1351
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1347
1352
|
* @param {number} num number of elements.
|
|
1348
1353
|
*
|
|
1349
1354
|
*/
|
|
@@ -1360,7 +1365,7 @@ class Protractor extends Helper {
|
|
|
1360
1365
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1361
1366
|
* ```
|
|
1362
1367
|
*
|
|
1363
|
-
* @param {
|
|
1368
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1364
1369
|
* @returns {Promise<number>} number of visible elements
|
|
1365
1370
|
*/
|
|
1366
1371
|
async grabNumberOfVisibleElements(locator) {
|
|
@@ -1376,7 +1381,7 @@ class Protractor extends Helper {
|
|
|
1376
1381
|
* I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
1377
1382
|
* ```
|
|
1378
1383
|
*
|
|
1379
|
-
* @param {
|
|
1384
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1380
1385
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
1381
1386
|
*/
|
|
1382
1387
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
@@ -1414,7 +1419,7 @@ class Protractor extends Helper {
|
|
|
1414
1419
|
* I.seeAttributesOnElements('//form', { method: "post"});
|
|
1415
1420
|
* ```
|
|
1416
1421
|
*
|
|
1417
|
-
* @param {
|
|
1422
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1418
1423
|
* @param {object} attributes attributes and their values to check.
|
|
1419
1424
|
*/
|
|
1420
1425
|
async seeAttributesOnElements(locator, attributes) {
|
|
@@ -1507,7 +1512,7 @@ class Protractor extends Helper {
|
|
|
1507
1512
|
}
|
|
1508
1513
|
|
|
1509
1514
|
/**
|
|
1510
|
-
|
|
1515
|
+
* Checks that current url contains a provided fragment.
|
|
1511
1516
|
*
|
|
1512
1517
|
* ```js
|
|
1513
1518
|
* I.seeInCurrentUrl('/register'); // we are on registration page
|
|
@@ -1567,7 +1572,7 @@ class Protractor extends Helper {
|
|
|
1567
1572
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
1568
1573
|
* ```
|
|
1569
1574
|
*
|
|
1570
|
-
* @param {
|
|
1575
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1571
1576
|
* @param {string} fileName file name to save.
|
|
1572
1577
|
*
|
|
1573
1578
|
*
|
|
@@ -1781,8 +1786,8 @@ class Protractor extends Helper {
|
|
|
1781
1786
|
* I.dragAndDrop('#dragHandle', '#container');
|
|
1782
1787
|
* ```
|
|
1783
1788
|
*
|
|
1784
|
-
* @param {
|
|
1785
|
-
* @param {
|
|
1789
|
+
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
1790
|
+
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
1786
1791
|
*
|
|
1787
1792
|
*/
|
|
1788
1793
|
async dragAndDrop(srcElement, destElement) {
|
|
@@ -1925,7 +1930,7 @@ class Protractor extends Helper {
|
|
|
1925
1930
|
* I.switchTo(); // switch back to main page
|
|
1926
1931
|
* ```
|
|
1927
1932
|
*
|
|
1928
|
-
* @param {?
|
|
1933
|
+
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1929
1934
|
*/
|
|
1930
1935
|
async switchTo(locator) {
|
|
1931
1936
|
if (Number.isInteger(locator)) {
|
|
@@ -1962,7 +1967,7 @@ class Protractor extends Helper {
|
|
|
1962
1967
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
1963
1968
|
* ```
|
|
1964
1969
|
*
|
|
1965
|
-
* @param {
|
|
1970
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1966
1971
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1967
1972
|
*/
|
|
1968
1973
|
async waitForElement(locator, sec = null) {
|
|
@@ -1986,7 +1991,7 @@ class Protractor extends Helper {
|
|
|
1986
1991
|
* I.waitForDetached('#popup');
|
|
1987
1992
|
* ```
|
|
1988
1993
|
*
|
|
1989
|
-
* @param {
|
|
1994
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1990
1995
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1991
1996
|
*/
|
|
1992
1997
|
async waitForDetached(locator, sec = null) {
|
|
@@ -2020,7 +2025,7 @@ class Protractor extends Helper {
|
|
|
2020
2025
|
* I.waitForVisible('#popup');
|
|
2021
2026
|
* ```
|
|
2022
2027
|
*
|
|
2023
|
-
* @param {
|
|
2028
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2024
2029
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2025
2030
|
*
|
|
2026
2031
|
*/
|
|
@@ -2038,7 +2043,7 @@ class Protractor extends Helper {
|
|
|
2038
2043
|
* I.waitToHide('#popup');
|
|
2039
2044
|
* ```
|
|
2040
2045
|
*
|
|
2041
|
-
* @param {
|
|
2046
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2042
2047
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2043
2048
|
*/
|
|
2044
2049
|
async waitToHide(locator, sec = null) {
|
|
@@ -2053,7 +2058,7 @@ class Protractor extends Helper {
|
|
|
2053
2058
|
* I.waitForInvisible('#popup');
|
|
2054
2059
|
* ```
|
|
2055
2060
|
*
|
|
2056
|
-
* @param {
|
|
2061
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2057
2062
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2058
2063
|
*/
|
|
2059
2064
|
async waitForInvisible(locator, sec = null) {
|
|
@@ -2076,7 +2081,7 @@ class Protractor extends Helper {
|
|
|
2076
2081
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
2077
2082
|
* ```
|
|
2078
2083
|
*
|
|
2079
|
-
* @param {
|
|
2084
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2080
2085
|
* @param {number} num number of elements.
|
|
2081
2086
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2082
2087
|
*/
|
|
@@ -2103,7 +2108,7 @@ class Protractor extends Helper {
|
|
|
2103
2108
|
* Waits for element to become enabled (by default waits for 1sec).
|
|
2104
2109
|
* Element can be located by CSS or XPath.
|
|
2105
2110
|
*
|
|
2106
|
-
* @param {
|
|
2111
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2107
2112
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2108
2113
|
*/
|
|
2109
2114
|
async waitForEnabled(locator, sec = null) {
|
|
@@ -2123,7 +2128,7 @@ class Protractor extends Helper {
|
|
|
2123
2128
|
* I.waitForValue('//input', "GoodValue");
|
|
2124
2129
|
* ```
|
|
2125
2130
|
*
|
|
2126
|
-
* @param {
|
|
2131
|
+
* @param {LocatorOrString} field input field.
|
|
2127
2132
|
* @param {string }value expected value.
|
|
2128
2133
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2129
2134
|
*
|
|
@@ -2182,24 +2187,6 @@ class Protractor extends Helper {
|
|
|
2182
2187
|
return this.browser.wait(() => this.browser.executeScript.call(this.browser, fn, ...args), aSec * 1000);
|
|
2183
2188
|
}
|
|
2184
2189
|
|
|
2185
|
-
/**
|
|
2186
|
-
* Waits for a function to return true (waits for 1sec by default).
|
|
2187
|
-
*
|
|
2188
|
-
* ```js
|
|
2189
|
-
* I.waitUntil(() => window.requests == 0);
|
|
2190
|
-
* I.waitUntil(() => window.requests == 0, 5);
|
|
2191
|
-
* ```
|
|
2192
|
-
*
|
|
2193
|
-
* @param {function|string} fn function which is executed in browser context.
|
|
2194
|
-
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2195
|
-
* @param {string} [timeoutMsg=''] message to show in case of timeout fail.
|
|
2196
|
-
* @param {?number} [interval=null]
|
|
2197
|
-
*/
|
|
2198
|
-
async waitUntil(fn, sec = null, timeoutMsg = null) {
|
|
2199
|
-
const aSec = sec || this.options.waitForTimeout;
|
|
2200
|
-
return this.browser.wait(fn, aSec * 1000, timeoutMsg);
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
2190
|
/**
|
|
2204
2191
|
* Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
2205
2192
|
*
|
|
@@ -2267,7 +2254,7 @@ class Protractor extends Helper {
|
|
|
2267
2254
|
*
|
|
2268
2255
|
* @param {string }text to wait for.
|
|
2269
2256
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2270
|
-
* @param {
|
|
2257
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
2271
2258
|
*/
|
|
2272
2259
|
async waitForText(text, sec = null, context = null) {
|
|
2273
2260
|
if (!context) {
|
|
@@ -2316,7 +2303,7 @@ class Protractor extends Helper {
|
|
|
2316
2303
|
* I.scrollTo('#submit', 5, 5);
|
|
2317
2304
|
* ```
|
|
2318
2305
|
*
|
|
2319
|
-
* @param {
|
|
2306
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2320
2307
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
2321
2308
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
2322
2309
|
*/
|