codeceptjs 3.2.1 → 3.3.0-beta.2
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 +67 -0
- package/docs/advanced.md +3 -3
- package/docs/api.md +227 -188
- package/docs/basics.md +26 -1
- package/docs/bdd.md +2 -2
- package/docs/build/ApiDataFactory.js +13 -6
- package/docs/build/Appium.js +98 -36
- package/docs/build/FileSystem.js +11 -1
- package/docs/build/GraphQL.js +11 -0
- package/docs/build/JSONResponse.js +297 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +282 -151
- package/docs/build/Puppeteer.js +76 -67
- package/docs/build/REST.js +36 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +70 -70
- package/docs/changelog.md +17 -0
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +9 -9
- package/docs/helpers/ApiDataFactory.md +7 -0
- package/docs/helpers/Appium.md +240 -198
- package/docs/helpers/FileSystem.md +11 -1
- package/docs/helpers/JSONResponse.md +230 -0
- package/docs/helpers/Playwright.md +283 -216
- package/docs/helpers/Puppeteer.md +9 -1
- package/docs/helpers/REST.md +30 -9
- package/docs/installation.md +3 -1
- package/docs/internal-api.md +265 -0
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/pageobjects.md +2 -0
- package/docs/playwright.md +73 -18
- package/docs/plugins.md +138 -38
- package/docs/puppeteer.md +28 -12
- package/docs/quickstart.md +2 -3
- package/docs/reports.md +44 -3
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +2 -2
- package/docs/videos.md +2 -2
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +92 -4
- package/lib/actor.js +2 -2
- package/lib/cli.js +25 -20
- package/lib/command/init.js +5 -15
- package/lib/command/workers/runTests.js +25 -7
- package/lib/config.js +17 -13
- package/lib/helper/ApiDataFactory.js +13 -6
- package/lib/helper/Appium.js +65 -3
- package/lib/helper/FileSystem.js +11 -1
- package/lib/helper/GraphQL.js +11 -0
- package/lib/helper/JSONResponse.js +297 -0
- package/lib/helper/Playwright.js +220 -89
- package/lib/helper/Puppeteer.js +12 -3
- package/lib/helper/REST.js +36 -0
- package/lib/helper/WebDriver.js +1 -1
- package/lib/helper/extras/Console.js +8 -0
- package/lib/helper/extras/PlaywrightRestartOpts.js +35 -0
- package/lib/interfaces/bdd.js +3 -1
- package/lib/listener/timeout.js +4 -3
- package/lib/plugin/allure.js +12 -0
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/eachElement.js +127 -0
- package/lib/plugin/stepTimeout.js +5 -4
- package/lib/plugin/tryTo.js +6 -0
- package/lib/recorder.js +2 -1
- package/lib/step.js +57 -2
- package/lib/utils.js +20 -0
- package/package.json +24 -22
- package/translations/pt-BR.js +8 -0
- package/typings/index.d.ts +4 -0
- package/typings/types.d.ts +345 -110
package/docs/build/WebDriver.js
CHANGED
|
@@ -582,7 +582,7 @@ class WebDriver extends Helper {
|
|
|
582
582
|
this.context = this.root;
|
|
583
583
|
if (this.options.restart && !this.options.manualStart) return this._startBrowser();
|
|
584
584
|
if (!this.isRunning && !this.options.manualStart) return this._startBrowser();
|
|
585
|
-
this.$$ = this.browser.$$.bind(this.browser);
|
|
585
|
+
if (this.browser) this.$$ = this.browser.$$.bind(this.browser);
|
|
586
586
|
return this.browser;
|
|
587
587
|
}
|
|
588
588
|
|
|
@@ -772,7 +772,7 @@ class WebDriver extends Helper {
|
|
|
772
772
|
* ```
|
|
773
773
|
*
|
|
774
774
|
*
|
|
775
|
-
* @param {
|
|
775
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
776
776
|
*/
|
|
777
777
|
async _locate(locator, smartWait = false) {
|
|
778
778
|
if (require('../store').debugMode) smartWait = false;
|
|
@@ -831,7 +831,7 @@ class WebDriver extends Helper {
|
|
|
831
831
|
* this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').then // ...
|
|
832
832
|
* ```
|
|
833
833
|
*
|
|
834
|
-
* @param {
|
|
834
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
835
835
|
*/
|
|
836
836
|
async _locateCheckable(locator) {
|
|
837
837
|
return findCheckable.call(this, locator, this.$$.bind(this)).then(res => res);
|
|
@@ -845,7 +845,7 @@ class WebDriver extends Helper {
|
|
|
845
845
|
* const els = await this.helpers.WebDriver._locateClickable('Next page', '.pages');
|
|
846
846
|
* ```
|
|
847
847
|
*
|
|
848
|
-
* @param {
|
|
848
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
849
849
|
*/
|
|
850
850
|
async _locateClickable(locator, context) {
|
|
851
851
|
const locateFn = prepareLocateFn.call(this, context);
|
|
@@ -859,7 +859,7 @@ class WebDriver extends Helper {
|
|
|
859
859
|
* this.helpers['WebDriver']._locateFields('Your email').then // ...
|
|
860
860
|
* ```
|
|
861
861
|
*
|
|
862
|
-
* @param {
|
|
862
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
863
863
|
*/
|
|
864
864
|
async _locateFields(locator) {
|
|
865
865
|
return findFields.call(this, locator).then(res => res);
|
|
@@ -933,8 +933,8 @@ class WebDriver extends Helper {
|
|
|
933
933
|
* I.click({css: 'nav a.login'});
|
|
934
934
|
* ```
|
|
935
935
|
*
|
|
936
|
-
* @param {
|
|
937
|
-
* @param {?
|
|
936
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
937
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
938
938
|
*
|
|
939
939
|
*
|
|
940
940
|
* {{ react }}
|
|
@@ -979,8 +979,8 @@ class WebDriver extends Helper {
|
|
|
979
979
|
* I.forceClick({css: 'nav a.login'});
|
|
980
980
|
* ```
|
|
981
981
|
*
|
|
982
|
-
* @param {
|
|
983
|
-
* @param {?
|
|
982
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
983
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
984
984
|
*
|
|
985
985
|
*
|
|
986
986
|
* {{ react }}
|
|
@@ -1017,8 +1017,8 @@ class WebDriver extends Helper {
|
|
|
1017
1017
|
* I.doubleClick('.btn.edit');
|
|
1018
1018
|
* ```
|
|
1019
1019
|
*
|
|
1020
|
-
* @param {
|
|
1021
|
-
* @param {?
|
|
1020
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1021
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1022
1022
|
*
|
|
1023
1023
|
*
|
|
1024
1024
|
* {{ react }}
|
|
@@ -1049,8 +1049,8 @@ class WebDriver extends Helper {
|
|
|
1049
1049
|
* I.rightClick('Click me', '.context');
|
|
1050
1050
|
* ```
|
|
1051
1051
|
*
|
|
1052
|
-
* @param {
|
|
1053
|
-
* @param {?
|
|
1052
|
+
* @param {string | object} locator clickable element located by CSS|XPath|strict locator.
|
|
1053
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1054
1054
|
*
|
|
1055
1055
|
*
|
|
1056
1056
|
* {{ react }}
|
|
@@ -1092,8 +1092,8 @@ class WebDriver extends Helper {
|
|
|
1092
1092
|
* I.forceRightClick('Menu');
|
|
1093
1093
|
* ```
|
|
1094
1094
|
*
|
|
1095
|
-
* @param {
|
|
1096
|
-
* @param {?
|
|
1095
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1096
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1097
1097
|
*
|
|
1098
1098
|
*
|
|
1099
1099
|
* {{ react }}
|
|
@@ -1133,8 +1133,8 @@ class WebDriver extends Helper {
|
|
|
1133
1133
|
* // or by strict locator
|
|
1134
1134
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
1135
1135
|
* ```
|
|
1136
|
-
* @param {
|
|
1137
|
-
* @param {
|
|
1136
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1137
|
+
* @param {string | object} value text value to fill.
|
|
1138
1138
|
*
|
|
1139
1139
|
* {{ react }}
|
|
1140
1140
|
* {{ custom }}
|
|
@@ -1154,7 +1154,7 @@ class WebDriver extends Helper {
|
|
|
1154
1154
|
* ```js
|
|
1155
1155
|
* I.appendField('#myTextField', 'appended');
|
|
1156
1156
|
* ```
|
|
1157
|
-
* @param {
|
|
1157
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator
|
|
1158
1158
|
* @param {string} value text value to append.
|
|
1159
1159
|
* {{ react }}
|
|
1160
1160
|
*/
|
|
@@ -1173,7 +1173,7 @@ class WebDriver extends Helper {
|
|
|
1173
1173
|
* I.clearField('user[email]');
|
|
1174
1174
|
* I.clearField('#email');
|
|
1175
1175
|
* ```
|
|
1176
|
-
* @param {
|
|
1176
|
+
* @param {string | object} editable field located by label|name|CSS|XPath|strict locator.
|
|
1177
1177
|
*
|
|
1178
1178
|
*
|
|
1179
1179
|
*/
|
|
@@ -1203,7 +1203,7 @@ class WebDriver extends Helper {
|
|
|
1203
1203
|
* ```js
|
|
1204
1204
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1205
1205
|
* ```
|
|
1206
|
-
* @param {
|
|
1206
|
+
* @param {string | object} select field located by label|name|CSS|XPath|strict locator.
|
|
1207
1207
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1208
1208
|
*
|
|
1209
1209
|
*/
|
|
@@ -1246,7 +1246,7 @@ class WebDriver extends Helper {
|
|
|
1246
1246
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
1247
1247
|
* ```
|
|
1248
1248
|
*
|
|
1249
|
-
* @param {
|
|
1249
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1250
1250
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
1251
1251
|
* Appium: not tested
|
|
1252
1252
|
*/
|
|
@@ -1285,8 +1285,8 @@ class WebDriver extends Helper {
|
|
|
1285
1285
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
1286
1286
|
* I.checkOption('agree', '//form');
|
|
1287
1287
|
* ```
|
|
1288
|
-
* @param {
|
|
1289
|
-
* @param {?
|
|
1288
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1289
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1290
1290
|
* Appium: not tested
|
|
1291
1291
|
*/
|
|
1292
1292
|
async checkOption(field, context = null) {
|
|
@@ -1315,8 +1315,8 @@ class WebDriver extends Helper {
|
|
|
1315
1315
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
1316
1316
|
* I.uncheckOption('agree', '//form');
|
|
1317
1317
|
* ```
|
|
1318
|
-
* @param {
|
|
1319
|
-
* @param {?
|
|
1318
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1319
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1320
1320
|
* Appium: not tested
|
|
1321
1321
|
*/
|
|
1322
1322
|
async uncheckOption(field, context = null) {
|
|
@@ -1342,7 +1342,7 @@ class WebDriver extends Helper {
|
|
|
1342
1342
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
1343
1343
|
* ```
|
|
1344
1344
|
*
|
|
1345
|
-
* @param {
|
|
1345
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1346
1346
|
* @returns {Promise<string[]>} attribute value
|
|
1347
1347
|
*
|
|
1348
1348
|
*
|
|
@@ -1363,7 +1363,7 @@ class WebDriver extends Helper {
|
|
|
1363
1363
|
* ```
|
|
1364
1364
|
* If multiple elements found returns first element.
|
|
1365
1365
|
*
|
|
1366
|
-
* @param {
|
|
1366
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1367
1367
|
* @returns {Promise<string>} attribute value
|
|
1368
1368
|
*
|
|
1369
1369
|
*
|
|
@@ -1386,7 +1386,7 @@ class WebDriver extends Helper {
|
|
|
1386
1386
|
* let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
1387
1387
|
* ```
|
|
1388
1388
|
*
|
|
1389
|
-
* @param {
|
|
1389
|
+
* @param {string | object} element located by CSS|XPath|strict locator.
|
|
1390
1390
|
* @returns {Promise<string[]>} HTML code for an element
|
|
1391
1391
|
*
|
|
1392
1392
|
*
|
|
@@ -1407,7 +1407,7 @@ class WebDriver extends Helper {
|
|
|
1407
1407
|
* let postHTML = await I.grabHTMLFrom('#post');
|
|
1408
1408
|
* ```
|
|
1409
1409
|
*
|
|
1410
|
-
* @param {
|
|
1410
|
+
* @param {string | object} element located by CSS|XPath|strict locator.
|
|
1411
1411
|
* @returns {Promise<string>} HTML code for an element
|
|
1412
1412
|
*
|
|
1413
1413
|
*
|
|
@@ -1429,7 +1429,7 @@ class WebDriver extends Helper {
|
|
|
1429
1429
|
* ```js
|
|
1430
1430
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
1431
1431
|
* ```
|
|
1432
|
-
* @param {
|
|
1432
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1433
1433
|
* @returns {Promise<string[]>} attribute value
|
|
1434
1434
|
*
|
|
1435
1435
|
*
|
|
@@ -1450,7 +1450,7 @@ class WebDriver extends Helper {
|
|
|
1450
1450
|
* ```js
|
|
1451
1451
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
1452
1452
|
* ```
|
|
1453
|
-
* @param {
|
|
1453
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1454
1454
|
* @returns {Promise<string>} attribute value
|
|
1455
1455
|
*
|
|
1456
1456
|
*
|
|
@@ -1473,7 +1473,7 @@ class WebDriver extends Helper {
|
|
|
1473
1473
|
* const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
1474
1474
|
* ```
|
|
1475
1475
|
*
|
|
1476
|
-
* @param {
|
|
1476
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1477
1477
|
* @param {string} cssProperty CSS property name.
|
|
1478
1478
|
* @returns {Promise<string[]>} CSS value
|
|
1479
1479
|
*
|
|
@@ -1494,7 +1494,7 @@ class WebDriver extends Helper {
|
|
|
1494
1494
|
* const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
1495
1495
|
* ```
|
|
1496
1496
|
*
|
|
1497
|
-
* @param {
|
|
1497
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1498
1498
|
* @param {string} cssProperty CSS property name.
|
|
1499
1499
|
* @returns {Promise<string>} CSS value
|
|
1500
1500
|
*
|
|
@@ -1517,7 +1517,7 @@ class WebDriver extends Helper {
|
|
|
1517
1517
|
* ```js
|
|
1518
1518
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1519
1519
|
* ```
|
|
1520
|
-
* @param {
|
|
1520
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1521
1521
|
* @param {string} attr attribute name.
|
|
1522
1522
|
* @returns {Promise<string[]>} attribute value
|
|
1523
1523
|
*
|
|
@@ -1537,7 +1537,7 @@ class WebDriver extends Helper {
|
|
|
1537
1537
|
* ```js
|
|
1538
1538
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1539
1539
|
* ```
|
|
1540
|
-
* @param {
|
|
1540
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1541
1541
|
* @param {string} attr attribute name.
|
|
1542
1542
|
* @returns {Promise<string>} attribute value
|
|
1543
1543
|
*
|
|
@@ -1620,7 +1620,7 @@ class WebDriver extends Helper {
|
|
|
1620
1620
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1621
1621
|
* ```
|
|
1622
1622
|
* @param {string} text expected on page.
|
|
1623
|
-
* @param {?
|
|
1623
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1624
1624
|
*
|
|
1625
1625
|
* {{ react }}
|
|
1626
1626
|
*/
|
|
@@ -1636,7 +1636,7 @@ class WebDriver extends Helper {
|
|
|
1636
1636
|
* ```
|
|
1637
1637
|
*
|
|
1638
1638
|
* @param {string} text element value to check.
|
|
1639
|
-
* @param {
|
|
1639
|
+
* @param {(string | object)?} [context=null] element located by CSS|XPath|strict locator.
|
|
1640
1640
|
*/
|
|
1641
1641
|
async seeTextEquals(text, context = null) {
|
|
1642
1642
|
return proceedSee.call(this, 'assert', text, context, true);
|
|
@@ -1652,7 +1652,7 @@ class WebDriver extends Helper {
|
|
|
1652
1652
|
* ```
|
|
1653
1653
|
*
|
|
1654
1654
|
* @param {string} text which is not present.
|
|
1655
|
-
* @param {
|
|
1655
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
1656
1656
|
*
|
|
1657
1657
|
*
|
|
1658
1658
|
* {{ react }}
|
|
@@ -1671,7 +1671,7 @@ class WebDriver extends Helper {
|
|
|
1671
1671
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
1672
1672
|
* I.seeInField('#searchform input','Search');
|
|
1673
1673
|
* ```
|
|
1674
|
-
* @param {
|
|
1674
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1675
1675
|
* @param {string} value value to check.
|
|
1676
1676
|
*
|
|
1677
1677
|
*
|
|
@@ -1689,7 +1689,7 @@ class WebDriver extends Helper {
|
|
|
1689
1689
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1690
1690
|
* ```
|
|
1691
1691
|
*
|
|
1692
|
-
* @param {
|
|
1692
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1693
1693
|
* @param {string} value value to check.
|
|
1694
1694
|
*
|
|
1695
1695
|
*/
|
|
@@ -1706,7 +1706,7 @@ class WebDriver extends Helper {
|
|
|
1706
1706
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1707
1707
|
* ```
|
|
1708
1708
|
*
|
|
1709
|
-
* @param {
|
|
1709
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1710
1710
|
*
|
|
1711
1711
|
* Appium: not tested
|
|
1712
1712
|
*/
|
|
@@ -1723,7 +1723,7 @@ class WebDriver extends Helper {
|
|
|
1723
1723
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
1724
1724
|
* ```
|
|
1725
1725
|
*
|
|
1726
|
-
* @param {
|
|
1726
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1727
1727
|
*
|
|
1728
1728
|
* Appium: not tested
|
|
1729
1729
|
*/
|
|
@@ -1738,7 +1738,7 @@ class WebDriver extends Helper {
|
|
|
1738
1738
|
* ```js
|
|
1739
1739
|
* I.seeElement('#modal');
|
|
1740
1740
|
* ```
|
|
1741
|
-
* @param {
|
|
1741
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1742
1742
|
* {{ react }}
|
|
1743
1743
|
*
|
|
1744
1744
|
*/
|
|
@@ -1756,7 +1756,7 @@ class WebDriver extends Helper {
|
|
|
1756
1756
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1757
1757
|
* ```
|
|
1758
1758
|
*
|
|
1759
|
-
* @param {
|
|
1759
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
1760
1760
|
* {{ react }}
|
|
1761
1761
|
*/
|
|
1762
1762
|
async dontSeeElement(locator) {
|
|
@@ -1775,7 +1775,7 @@ class WebDriver extends Helper {
|
|
|
1775
1775
|
* ```js
|
|
1776
1776
|
* I.seeElementInDOM('#modal');
|
|
1777
1777
|
* ```
|
|
1778
|
-
* @param {
|
|
1778
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1779
1779
|
*
|
|
1780
1780
|
*
|
|
1781
1781
|
*/
|
|
@@ -1791,7 +1791,7 @@ class WebDriver extends Helper {
|
|
|
1791
1791
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
1792
1792
|
* ```
|
|
1793
1793
|
*
|
|
1794
|
-
* @param {
|
|
1794
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
1795
1795
|
*
|
|
1796
1796
|
*/
|
|
1797
1797
|
async dontSeeElementInDOM(locator) {
|
|
@@ -1889,7 +1889,7 @@ class WebDriver extends Helper {
|
|
|
1889
1889
|
* I.seeNumberOfElements('#submitBtn', 1);
|
|
1890
1890
|
* ```
|
|
1891
1891
|
*
|
|
1892
|
-
* @param {
|
|
1892
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1893
1893
|
* @param {number} num number of elements.
|
|
1894
1894
|
*
|
|
1895
1895
|
* {{ react }}
|
|
@@ -1907,7 +1907,7 @@ class WebDriver extends Helper {
|
|
|
1907
1907
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
1908
1908
|
* ```
|
|
1909
1909
|
*
|
|
1910
|
-
* @param {
|
|
1910
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1911
1911
|
* @param {number} num number of elements.
|
|
1912
1912
|
*
|
|
1913
1913
|
* {{ react }}
|
|
@@ -1924,7 +1924,7 @@ class WebDriver extends Helper {
|
|
|
1924
1924
|
* I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
1925
1925
|
* ```
|
|
1926
1926
|
*
|
|
1927
|
-
* @param {
|
|
1927
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1928
1928
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
1929
1929
|
*/
|
|
1930
1930
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
@@ -1966,7 +1966,7 @@ class WebDriver extends Helper {
|
|
|
1966
1966
|
* I.seeAttributesOnElements('//form', { method: "post"});
|
|
1967
1967
|
* ```
|
|
1968
1968
|
*
|
|
1969
|
-
* @param {
|
|
1969
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1970
1970
|
* @param {object} attributes attributes and their values to check.
|
|
1971
1971
|
*/
|
|
1972
1972
|
async seeAttributesOnElements(locator, attributes) {
|
|
@@ -2001,7 +2001,7 @@ class WebDriver extends Helper {
|
|
|
2001
2001
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
2002
2002
|
* ```
|
|
2003
2003
|
*
|
|
2004
|
-
* @param {
|
|
2004
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2005
2005
|
* @returns {Promise<number>} number of visible elements
|
|
2006
2006
|
*/
|
|
2007
2007
|
async grabNumberOfVisibleElements(locator) {
|
|
@@ -2151,7 +2151,7 @@ class WebDriver extends Helper {
|
|
|
2151
2151
|
* I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
2152
2152
|
* ```
|
|
2153
2153
|
*
|
|
2154
|
-
* @param {
|
|
2154
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2155
2155
|
* @param {ScrollIntoViewOptions} scrollIntoViewOptions see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
|
|
2156
2156
|
*
|
|
2157
2157
|
*
|
|
@@ -2172,7 +2172,7 @@ class WebDriver extends Helper {
|
|
|
2172
2172
|
* I.scrollTo('#submit', 5, 5);
|
|
2173
2173
|
* ```
|
|
2174
2174
|
*
|
|
2175
|
-
* @param {
|
|
2175
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2176
2176
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
2177
2177
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
2178
2178
|
*
|
|
@@ -2213,7 +2213,7 @@ class WebDriver extends Helper {
|
|
|
2213
2213
|
* I.moveCursorTo('#submit', 5,5);
|
|
2214
2214
|
* ```
|
|
2215
2215
|
*
|
|
2216
|
-
* @param {
|
|
2216
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2217
2217
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
2218
2218
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
2219
2219
|
*
|
|
@@ -2234,7 +2234,7 @@ class WebDriver extends Helper {
|
|
|
2234
2234
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
2235
2235
|
* ```
|
|
2236
2236
|
*
|
|
2237
|
-
* @param {
|
|
2237
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2238
2238
|
* @param {string} fileName file name to save.
|
|
2239
2239
|
*
|
|
2240
2240
|
*
|
|
@@ -2681,8 +2681,8 @@ class WebDriver extends Helper {
|
|
|
2681
2681
|
* I.dragAndDrop('#dragHandle', '#container');
|
|
2682
2682
|
* ```
|
|
2683
2683
|
*
|
|
2684
|
-
* @param {
|
|
2685
|
-
* @param {
|
|
2684
|
+
* @param {string | object} srcElement located by CSS|XPath|strict locator.
|
|
2685
|
+
* @param {string | object} destElement located by CSS|XPath|strict locator.
|
|
2686
2686
|
*
|
|
2687
2687
|
* Appium: not tested
|
|
2688
2688
|
*/
|
|
@@ -2707,7 +2707,7 @@ class WebDriver extends Helper {
|
|
|
2707
2707
|
* I.dragSlider('#slider', -70);
|
|
2708
2708
|
* ```
|
|
2709
2709
|
*
|
|
2710
|
-
* @param {
|
|
2710
|
+
* @param {string | object} locator located by label|name|CSS|XPath|strict locator.
|
|
2711
2711
|
* @param {number} offsetX position to drag.
|
|
2712
2712
|
*/
|
|
2713
2713
|
async dragSlider(locator, offsetX = 0) {
|
|
@@ -2825,7 +2825,7 @@ class WebDriver extends Helper {
|
|
|
2825
2825
|
* Waits for element to become enabled (by default waits for 1sec).
|
|
2826
2826
|
* Element can be located by CSS or XPath.
|
|
2827
2827
|
*
|
|
2828
|
-
* @param {
|
|
2828
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2829
2829
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2830
2830
|
*/
|
|
2831
2831
|
async waitForEnabled(locator, sec = null) {
|
|
@@ -2868,7 +2868,7 @@ class WebDriver extends Helper {
|
|
|
2868
2868
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
2869
2869
|
* ```
|
|
2870
2870
|
*
|
|
2871
|
-
* @param {
|
|
2871
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2872
2872
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2873
2873
|
*/
|
|
2874
2874
|
async waitForElement(locator, sec = null) {
|
|
@@ -2894,7 +2894,7 @@ class WebDriver extends Helper {
|
|
|
2894
2894
|
* I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2895
2895
|
* ```
|
|
2896
2896
|
*
|
|
2897
|
-
* @param {
|
|
2897
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2898
2898
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2899
2899
|
*/
|
|
2900
2900
|
async waitForClickable(locator, waitTimeout) {
|
|
@@ -2994,7 +2994,7 @@ class WebDriver extends Helper {
|
|
|
2994
2994
|
*
|
|
2995
2995
|
* @param {string }text to wait for.
|
|
2996
2996
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2997
|
-
* @param {
|
|
2997
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
|
|
2998
2998
|
*
|
|
2999
2999
|
*/
|
|
3000
3000
|
async waitForText(text, sec = null, context = null) {
|
|
@@ -3038,7 +3038,7 @@ class WebDriver extends Helper {
|
|
|
3038
3038
|
* I.waitForValue('//input', "GoodValue");
|
|
3039
3039
|
* ```
|
|
3040
3040
|
*
|
|
3041
|
-
* @param {
|
|
3041
|
+
* @param {string | object} field input field.
|
|
3042
3042
|
* @param {string }value expected value.
|
|
3043
3043
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3044
3044
|
*
|
|
@@ -3084,7 +3084,7 @@ class WebDriver extends Helper {
|
|
|
3084
3084
|
* I.waitForVisible('#popup');
|
|
3085
3085
|
* ```
|
|
3086
3086
|
*
|
|
3087
|
-
* @param {
|
|
3087
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3088
3088
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3089
3089
|
*
|
|
3090
3090
|
*
|
|
@@ -3120,7 +3120,7 @@ class WebDriver extends Helper {
|
|
|
3120
3120
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
3121
3121
|
* ```
|
|
3122
3122
|
*
|
|
3123
|
-
* @param {
|
|
3123
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3124
3124
|
* @param {number} num number of elements.
|
|
3125
3125
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3126
3126
|
*/
|
|
@@ -3156,7 +3156,7 @@ class WebDriver extends Helper {
|
|
|
3156
3156
|
* I.waitForInvisible('#popup');
|
|
3157
3157
|
* ```
|
|
3158
3158
|
*
|
|
3159
|
-
* @param {
|
|
3159
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3160
3160
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3161
3161
|
*/
|
|
3162
3162
|
async waitForInvisible(locator, sec = null) {
|
|
@@ -3185,7 +3185,7 @@ class WebDriver extends Helper {
|
|
|
3185
3185
|
* I.waitToHide('#popup');
|
|
3186
3186
|
* ```
|
|
3187
3187
|
*
|
|
3188
|
-
* @param {
|
|
3188
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3189
3189
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3190
3190
|
*/
|
|
3191
3191
|
async waitToHide(locator, sec = null) {
|
|
@@ -3200,7 +3200,7 @@ class WebDriver extends Helper {
|
|
|
3200
3200
|
* I.waitForDetached('#popup');
|
|
3201
3201
|
* ```
|
|
3202
3202
|
*
|
|
3203
|
-
* @param {
|
|
3203
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3204
3204
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3205
3205
|
*/
|
|
3206
3206
|
async waitForDetached(locator, sec = null) {
|
|
@@ -3267,7 +3267,7 @@ class WebDriver extends Helper {
|
|
|
3267
3267
|
* I.switchTo(); // switch back to main page
|
|
3268
3268
|
* ```
|
|
3269
3269
|
*
|
|
3270
|
-
* @param {?
|
|
3270
|
+
* @param {?string | object} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3271
3271
|
*/
|
|
3272
3272
|
async switchTo(locator) {
|
|
3273
3273
|
this.browser.isInsideFrame = true;
|
|
@@ -3541,7 +3541,7 @@ class WebDriver extends Helper {
|
|
|
3541
3541
|
* const width = await I.grabElementBoundingRect('h3', 'width');
|
|
3542
3542
|
* // width == 527
|
|
3543
3543
|
* ```
|
|
3544
|
-
* @param {
|
|
3544
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3545
3545
|
* @param {string=} elementSize x, y, width or height of the given element.
|
|
3546
3546
|
* @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
|
|
3547
3547
|
*
|
package/docs/changelog.md
CHANGED
|
@@ -7,6 +7,23 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.2.3
|
|
11
|
+
|
|
12
|
+
* Documentation improvements by **[maojunxyz](https://github.com/maojunxyz)**
|
|
13
|
+
* Guard mocha cli reporter from registering step logger multiple times [#3180](https://github.com/codeceptjs/CodeceptJS/issues/3180) by **[nikocanvacom](https://github.com/nikocanvacom)**
|
|
14
|
+
* **[Playwright]** Fixed "tracing.stop: tracing.stop: ENAMETOOLONG: name too long" by **[hatufacci](https://github.com/hatufacci)**
|
|
15
|
+
* Fixed [#2889](https://github.com/codeceptjs/CodeceptJS/issues/2889): return always the same error contract from simplifyTest. See [#3168](https://github.com/codeceptjs/CodeceptJS/issues/3168) by **[andremoah](https://github.com/andremoah)**
|
|
16
|
+
|
|
17
|
+
## 3.2.2
|
|
18
|
+
|
|
19
|
+
* **[Playwright]** Reverted removal of retry on context errors. Fixes [#3130](https://github.com/codeceptjs/CodeceptJS/issues/3130)
|
|
20
|
+
* Timeout improvements by **[nikocanvacom](https://github.com/nikocanvacom)**:
|
|
21
|
+
* Added priorites to timeouts
|
|
22
|
+
* Added `overrideStepLimits` to [stepTimeout plugin](https://codecept.io/plugins/#steptimeout) to override steps timeouts set by `limitTime`.
|
|
23
|
+
* Fixed step timeout not working due to override by NaN by test timeout [#3126](https://github.com/codeceptjs/CodeceptJS/issues/3126)
|
|
24
|
+
* **[Appium]** Fixed logging error when `manualStart` is true. See [#3140](https://github.com/codeceptjs/CodeceptJS/issues/3140) by **[nikocanvacom](https://github.com/nikocanvacom)**
|
|
25
|
+
|
|
26
|
+
|
|
10
27
|
## 3.2.1
|
|
11
28
|
|
|
12
29
|
> ♻️ This release fixes hanging of tests by reducing timeouts for automatic retries on failures.
|
package/docs/configuration.md
CHANGED
|
@@ -17,15 +17,15 @@ Here is an overview of available options with their defaults:
|
|
|
17
17
|
* **timeout**: `10000` - default tests timeout
|
|
18
18
|
* **output**: `"./output"` - where to store failure screenshots, etc
|
|
19
19
|
* **helpers**: `{}` - list of enabled helpers
|
|
20
|
-
* **mocha**: `{}` - mocha options, [reporters](
|
|
21
|
-
* **multiple**: `{}` - multiple options, see [Multiple Execution](
|
|
22
|
-
* **bootstrap**: `"./bootstrap.js"` - an option to run code _before_ tests are run. See [Hooks](
|
|
23
|
-
* **bootstrapAll**: `"./bootstrap.js"` - an option to run code _before_ all test suites are run when using the run-multiple mode. See [Hooks](
|
|
24
|
-
* **teardown**: - an option to run code _after_ all test suites are run when using the run-multiple mode. See [Hooks](
|
|
25
|
-
* **teardownAll**: - an option to run code _after_ tests are run. See [Hooks](
|
|
20
|
+
* **mocha**: `{}` - mocha options, [reporters](https://codecept.io/reports/) can be configured here
|
|
21
|
+
* **multiple**: `{}` - multiple options, see [Multiple Execution](https://codecept.io/parallel#multiple-browsers-execution)
|
|
22
|
+
* **bootstrap**: `"./bootstrap.js"` - an option to run code _before_ tests are run. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown)).
|
|
23
|
+
* **bootstrapAll**: `"./bootstrap.js"` - an option to run code _before_ all test suites are run when using the run-multiple mode. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown)).
|
|
24
|
+
* **teardown**: - an option to run code _after_ all test suites are run when using the run-multiple mode. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown).
|
|
25
|
+
* **teardownAll**: - an option to run code _after_ tests are run. See [Hooks](https://codecept.io/hooks/#bootstrap-teardown).
|
|
26
26
|
* **noGlobals**: `false` - disable registering global variables like `Actor`, `Helper`, `pause`, `within`, `DataTable`
|
|
27
|
-
* **hooks**: - include custom listeners to plug into execution workflow. See [Custom Hooks](
|
|
28
|
-
* **translation**: - [locale](
|
|
27
|
+
* **hooks**: - include custom listeners to plug into execution workflow. See [Custom Hooks](https://codecept.io/hooks/#custom-hooks)
|
|
28
|
+
* **translation**: - [locale](https://codecept.io/translation/) to be used to print s teps output, as well as used in source code.
|
|
29
29
|
* **require**: `[]` - array of module names to be required before codecept starts. See [Require](#require)
|
|
30
30
|
|
|
31
31
|
|
package/docs/custom-helpers.md
CHANGED
|
@@ -264,7 +264,7 @@ class MyHelper extends Helper {
|
|
|
264
264
|
const { WebDriver } = this.helpers
|
|
265
265
|
const { browser } = WebDriver;
|
|
266
266
|
|
|
267
|
-
// get all cookies according to
|
|
267
|
+
// get all cookies according to https://webdriver.io/api/protocol/cookie.html
|
|
268
268
|
// any helper method should return a value in order to be added to promise chain
|
|
269
269
|
const res = await browser.cookie();
|
|
270
270
|
// get values
|