codeceptjs 3.2.3 → 3.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/docs/advanced.md +0 -4
- package/docs/api.md +227 -188
- package/docs/build/ApiDataFactory.js +13 -6
- package/docs/build/Appium.js +36 -36
- 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 +261 -146
- 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 +69 -69
- package/docs/helpers/ApiDataFactory.md +7 -0
- package/docs/helpers/Appium.md +3 -3
- package/docs/helpers/JSONResponse.md +230 -0
- package/docs/helpers/Playwright.md +282 -218
- package/docs/helpers/Puppeteer.md +9 -1
- package/docs/helpers/REST.md +30 -9
- package/docs/installation.md +2 -0
- package/docs/internal-api.md +265 -0
- package/docs/playwright.md +70 -15
- package/docs/plugins.md +125 -29
- package/docs/puppeteer.md +24 -8
- package/docs/quickstart.md +2 -3
- package/docs/reports.md +43 -2
- package/docs/translation.md +1 -1
- package/docs/videos.md +2 -2
- package/docs/webdriver.md +90 -2
- package/lib/command/init.js +5 -15
- package/lib/config.js +17 -13
- package/lib/helper/ApiDataFactory.js +13 -6
- package/lib/helper/Appium.js +3 -3
- package/lib/helper/GraphQL.js +11 -0
- package/lib/helper/JSONResponse.js +297 -0
- package/lib/helper/Playwright.js +199 -84
- package/lib/helper/Puppeteer.js +12 -3
- package/lib/helper/REST.js +36 -0
- 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/plugin/allure.js +12 -0
- package/lib/plugin/eachElement.js +127 -0
- package/lib/utils.js +20 -0
- package/package.json +6 -4
- package/translations/pt-BR.js +8 -0
- package/typings/index.d.ts +2 -0
- package/typings/types.d.ts +237 -11
package/docs/build/TestCafe.js
CHANGED
|
@@ -382,8 +382,8 @@ class TestCafe extends Helper {
|
|
|
382
382
|
* I.click({css: 'nav a.login'});
|
|
383
383
|
* ```
|
|
384
384
|
*
|
|
385
|
-
* @param {
|
|
386
|
-
* @param {?
|
|
385
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
386
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
387
387
|
*
|
|
388
388
|
*
|
|
389
389
|
*/
|
|
@@ -412,7 +412,7 @@ class TestCafe extends Helper {
|
|
|
412
412
|
* I.waitForVisible('#popup');
|
|
413
413
|
* ```
|
|
414
414
|
*
|
|
415
|
-
* @param {
|
|
415
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
416
416
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
417
417
|
*
|
|
418
418
|
*
|
|
@@ -439,8 +439,8 @@ class TestCafe extends Helper {
|
|
|
439
439
|
* // or by strict locator
|
|
440
440
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
441
441
|
* ```
|
|
442
|
-
* @param {
|
|
443
|
-
* @param {
|
|
442
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
443
|
+
* @param {string | object} value text value to fill.
|
|
444
444
|
*
|
|
445
445
|
*/
|
|
446
446
|
async fillField(field, value) {
|
|
@@ -460,7 +460,7 @@ class TestCafe extends Helper {
|
|
|
460
460
|
* I.clearField('user[email]');
|
|
461
461
|
* I.clearField('#email');
|
|
462
462
|
* ```
|
|
463
|
-
* @param {
|
|
463
|
+
* @param {string | object} editable field located by label|name|CSS|XPath|strict locator.
|
|
464
464
|
*
|
|
465
465
|
*/
|
|
466
466
|
async clearField(field) {
|
|
@@ -481,7 +481,7 @@ class TestCafe extends Helper {
|
|
|
481
481
|
* ```js
|
|
482
482
|
* I.appendField('#myTextField', 'appended');
|
|
483
483
|
* ```
|
|
484
|
-
* @param {
|
|
484
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator
|
|
485
485
|
* @param {string} value text value to append.
|
|
486
486
|
*
|
|
487
487
|
*/
|
|
@@ -505,7 +505,7 @@ class TestCafe extends Helper {
|
|
|
505
505
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
506
506
|
* ```
|
|
507
507
|
*
|
|
508
|
-
* @param {
|
|
508
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
509
509
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
510
510
|
*
|
|
511
511
|
*/
|
|
@@ -552,7 +552,7 @@ class TestCafe extends Helper {
|
|
|
552
552
|
* I.moveCursorTo('#submit', 5,5);
|
|
553
553
|
* ```
|
|
554
554
|
*
|
|
555
|
-
* @param {
|
|
555
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
556
556
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
557
557
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
558
558
|
*
|
|
@@ -578,8 +578,8 @@ class TestCafe extends Helper {
|
|
|
578
578
|
* I.doubleClick('.btn.edit');
|
|
579
579
|
* ```
|
|
580
580
|
*
|
|
581
|
-
* @param {
|
|
582
|
-
* @param {?
|
|
581
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
582
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
583
583
|
*
|
|
584
584
|
*
|
|
585
585
|
*/
|
|
@@ -609,8 +609,8 @@ class TestCafe extends Helper {
|
|
|
609
609
|
* I.rightClick('Click me', '.context');
|
|
610
610
|
* ```
|
|
611
611
|
*
|
|
612
|
-
* @param {
|
|
613
|
-
* @param {?
|
|
612
|
+
* @param {string | object} locator clickable element located by CSS|XPath|strict locator.
|
|
613
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
614
614
|
*
|
|
615
615
|
*
|
|
616
616
|
*/
|
|
@@ -639,8 +639,8 @@ class TestCafe extends Helper {
|
|
|
639
639
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
640
640
|
* I.checkOption('agree', '//form');
|
|
641
641
|
* ```
|
|
642
|
-
* @param {
|
|
643
|
-
* @param {?
|
|
642
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
643
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
644
644
|
*/
|
|
645
645
|
async checkOption(field, context = null) {
|
|
646
646
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -661,8 +661,8 @@ class TestCafe extends Helper {
|
|
|
661
661
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
662
662
|
* I.uncheckOption('agree', '//form');
|
|
663
663
|
* ```
|
|
664
|
-
* @param {
|
|
665
|
-
* @param {?
|
|
664
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
665
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
666
666
|
*/
|
|
667
667
|
async uncheckOption(field, context = null) {
|
|
668
668
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -683,7 +683,7 @@ class TestCafe extends Helper {
|
|
|
683
683
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
684
684
|
* ```
|
|
685
685
|
*
|
|
686
|
-
* @param {
|
|
686
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
687
687
|
*
|
|
688
688
|
*/
|
|
689
689
|
async seeCheckboxIsChecked(field) {
|
|
@@ -699,7 +699,7 @@ class TestCafe extends Helper {
|
|
|
699
699
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
700
700
|
* ```
|
|
701
701
|
*
|
|
702
|
-
* @param {
|
|
702
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
703
703
|
*
|
|
704
704
|
*/
|
|
705
705
|
async dontSeeCheckboxIsChecked(field) {
|
|
@@ -725,7 +725,7 @@ class TestCafe extends Helper {
|
|
|
725
725
|
* ```js
|
|
726
726
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
727
727
|
* ```
|
|
728
|
-
* @param {
|
|
728
|
+
* @param {string | object} select field located by label|name|CSS|XPath|strict locator.
|
|
729
729
|
* @param {string|Array<*>} option visible text or value of option.
|
|
730
730
|
*
|
|
731
731
|
*/
|
|
@@ -834,7 +834,7 @@ class TestCafe extends Helper {
|
|
|
834
834
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
835
835
|
* ```
|
|
836
836
|
* @param {string} text expected on page.
|
|
837
|
-
* @param {?
|
|
837
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
838
838
|
*
|
|
839
839
|
*/
|
|
840
840
|
async see(text, context = null) {
|
|
@@ -860,7 +860,7 @@ class TestCafe extends Helper {
|
|
|
860
860
|
* ```
|
|
861
861
|
*
|
|
862
862
|
* @param {string} text which is not present.
|
|
863
|
-
* @param {
|
|
863
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
864
864
|
*
|
|
865
865
|
*
|
|
866
866
|
*/
|
|
@@ -884,7 +884,7 @@ class TestCafe extends Helper {
|
|
|
884
884
|
* ```js
|
|
885
885
|
* I.seeElement('#modal');
|
|
886
886
|
* ```
|
|
887
|
-
* @param {
|
|
887
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
888
888
|
*/
|
|
889
889
|
async seeElement(locator) {
|
|
890
890
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -900,7 +900,7 @@ class TestCafe extends Helper {
|
|
|
900
900
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
901
901
|
* ```
|
|
902
902
|
*
|
|
903
|
-
* @param {
|
|
903
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
904
904
|
*/
|
|
905
905
|
async dontSeeElement(locator) {
|
|
906
906
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -916,7 +916,7 @@ class TestCafe extends Helper {
|
|
|
916
916
|
* ```js
|
|
917
917
|
* I.seeElementInDOM('#modal');
|
|
918
918
|
* ```
|
|
919
|
-
* @param {
|
|
919
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
920
920
|
*
|
|
921
921
|
*/
|
|
922
922
|
async seeElementInDOM(locator) {
|
|
@@ -933,7 +933,7 @@ class TestCafe extends Helper {
|
|
|
933
933
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
934
934
|
* ```
|
|
935
935
|
*
|
|
936
|
-
* @param {
|
|
936
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
937
937
|
*/
|
|
938
938
|
async dontSeeElementInDOM(locator) {
|
|
939
939
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -950,7 +950,7 @@ class TestCafe extends Helper {
|
|
|
950
950
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
951
951
|
* ```
|
|
952
952
|
*
|
|
953
|
-
* @param {
|
|
953
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
954
954
|
* @param {number} num number of elements.
|
|
955
955
|
*
|
|
956
956
|
*
|
|
@@ -970,7 +970,7 @@ class TestCafe extends Helper {
|
|
|
970
970
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
971
971
|
* ```
|
|
972
972
|
*
|
|
973
|
-
* @param {
|
|
973
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
974
974
|
* @returns {Promise<number>} number of visible elements
|
|
975
975
|
*/
|
|
976
976
|
async grabNumberOfVisibleElements(locator) {
|
|
@@ -988,7 +988,7 @@ class TestCafe extends Helper {
|
|
|
988
988
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
989
989
|
* I.seeInField('#searchform input','Search');
|
|
990
990
|
* ```
|
|
991
|
-
* @param {
|
|
991
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
992
992
|
* @param {string} value value to check.
|
|
993
993
|
*
|
|
994
994
|
*/
|
|
@@ -1012,7 +1012,7 @@ class TestCafe extends Helper {
|
|
|
1012
1012
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1013
1013
|
* ```
|
|
1014
1014
|
*
|
|
1015
|
-
* @param {
|
|
1015
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1016
1016
|
* @param {string} value value to check.
|
|
1017
1017
|
*/
|
|
1018
1018
|
async dontSeeInField(field, value) {
|
|
@@ -1076,7 +1076,7 @@ class TestCafe extends Helper {
|
|
|
1076
1076
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
1077
1077
|
* ```
|
|
1078
1078
|
*
|
|
1079
|
-
* @param {
|
|
1079
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1080
1080
|
* @param {string} fileName file name to save.
|
|
1081
1081
|
*
|
|
1082
1082
|
*
|
|
@@ -1173,7 +1173,7 @@ class TestCafe extends Helper {
|
|
|
1173
1173
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
1174
1174
|
* ```
|
|
1175
1175
|
*
|
|
1176
|
-
* @param {
|
|
1176
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1177
1177
|
* @returns {Promise<string[]>} attribute value
|
|
1178
1178
|
*
|
|
1179
1179
|
*/
|
|
@@ -1197,7 +1197,7 @@ class TestCafe extends Helper {
|
|
|
1197
1197
|
* ```
|
|
1198
1198
|
* If multiple elements found returns first element.
|
|
1199
1199
|
*
|
|
1200
|
-
* @param {
|
|
1200
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1201
1201
|
* @returns {Promise<string>} attribute value
|
|
1202
1202
|
*
|
|
1203
1203
|
*/
|
|
@@ -1220,7 +1220,7 @@ class TestCafe extends Helper {
|
|
|
1220
1220
|
* ```js
|
|
1221
1221
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1222
1222
|
* ```
|
|
1223
|
-
* @param {
|
|
1223
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1224
1224
|
* @param {string} attr attribute name.
|
|
1225
1225
|
* @returns {Promise<string>} attribute value
|
|
1226
1226
|
*
|
|
@@ -1244,7 +1244,7 @@ class TestCafe extends Helper {
|
|
|
1244
1244
|
* ```js
|
|
1245
1245
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1246
1246
|
* ```
|
|
1247
|
-
* @param {
|
|
1247
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1248
1248
|
* @param {string} attr attribute name.
|
|
1249
1249
|
* @returns {Promise<string>} attribute value
|
|
1250
1250
|
*
|
|
@@ -1267,7 +1267,7 @@ class TestCafe extends Helper {
|
|
|
1267
1267
|
* ```js
|
|
1268
1268
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
1269
1269
|
* ```
|
|
1270
|
-
* @param {
|
|
1270
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1271
1271
|
* @returns {Promise<string[]>} attribute value
|
|
1272
1272
|
*
|
|
1273
1273
|
*/
|
|
@@ -1290,7 +1290,7 @@ class TestCafe extends Helper {
|
|
|
1290
1290
|
* ```js
|
|
1291
1291
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
1292
1292
|
* ```
|
|
1293
|
-
* @param {
|
|
1293
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1294
1294
|
* @returns {Promise<string>} attribute value
|
|
1295
1295
|
*
|
|
1296
1296
|
*/
|
|
@@ -1402,7 +1402,7 @@ class TestCafe extends Helper {
|
|
|
1402
1402
|
* I.scrollTo('#submit', 5, 5);
|
|
1403
1403
|
* ```
|
|
1404
1404
|
*
|
|
1405
|
-
* @param {
|
|
1405
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1406
1406
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1407
1407
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1408
1408
|
*/
|
|
@@ -1442,7 +1442,7 @@ class TestCafe extends Helper {
|
|
|
1442
1442
|
* I.switchTo(); // switch back to main page
|
|
1443
1443
|
* ```
|
|
1444
1444
|
*
|
|
1445
|
-
* @param {?
|
|
1445
|
+
* @param {?string | object} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1446
1446
|
*/
|
|
1447
1447
|
async switchTo(locator) {
|
|
1448
1448
|
if (Number.isInteger(locator)) {
|
|
@@ -1679,7 +1679,7 @@ class TestCafe extends Helper {
|
|
|
1679
1679
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
1680
1680
|
* ```
|
|
1681
1681
|
*
|
|
1682
|
-
* @param {
|
|
1682
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1683
1683
|
* @param {number} num number of elements.
|
|
1684
1684
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1685
1685
|
*/
|
|
@@ -1701,7 +1701,7 @@ class TestCafe extends Helper {
|
|
|
1701
1701
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
1702
1702
|
* ```
|
|
1703
1703
|
*
|
|
1704
|
-
* @param {
|
|
1704
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1705
1705
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1706
1706
|
*/
|
|
1707
1707
|
async waitForElement(locator, sec) {
|
|
@@ -1720,7 +1720,7 @@ class TestCafe extends Helper {
|
|
|
1720
1720
|
* I.waitToHide('#popup');
|
|
1721
1721
|
* ```
|
|
1722
1722
|
*
|
|
1723
|
-
* @param {
|
|
1723
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1724
1724
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1725
1725
|
*/
|
|
1726
1726
|
async waitToHide(locator, sec) {
|
|
@@ -1739,7 +1739,7 @@ class TestCafe extends Helper {
|
|
|
1739
1739
|
* I.waitForInvisible('#popup');
|
|
1740
1740
|
* ```
|
|
1741
1741
|
*
|
|
1742
|
-
* @param {
|
|
1742
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1743
1743
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1744
1744
|
*/
|
|
1745
1745
|
async waitForInvisible(locator, sec) {
|
|
@@ -1762,7 +1762,7 @@ class TestCafe extends Helper {
|
|
|
1762
1762
|
*
|
|
1763
1763
|
* @param {string }text to wait for.
|
|
1764
1764
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1765
|
-
* @param {
|
|
1765
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1766
1766
|
*
|
|
1767
1767
|
*/
|
|
1768
1768
|
async waitForText(text, sec = null, context = null) {
|