codeceptjs 3.3.0-beta.5 → 3.3.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 +50 -1
- package/README.md +6 -1
- package/docs/api.md +45 -30
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +53 -48
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +101 -72
- package/docs/build/Playwright.js +166 -113
- package/docs/build/Protractor.js +72 -34
- package/docs/build/Puppeteer.js +143 -100
- package/docs/build/REST.js +5 -2
- package/docs/build/TestCafe.js +97 -66
- package/docs/build/WebDriver.js +183 -135
- package/docs/changelog.md +99 -0
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/email.md +5 -0
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +217 -175
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/MockRequest.md +8 -6
- package/docs/helpers/Nightmare.md +98 -45
- package/docs/helpers/Playwright.md +151 -59
- package/docs/helpers/Puppeteer.md +103 -26
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +77 -22
- package/docs/helpers/WebDriver.md +150 -62
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/videos.md +2 -2
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +2 -7
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +28 -17
- package/lib/helper/REST.js +5 -2
- package/lib/helper/WebDriver.js +4 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +3 -3
- package/typings/types.d.ts +578 -109
package/docs/build/REST.js
CHANGED
|
@@ -87,7 +87,7 @@ class REST extends Helper {
|
|
|
87
87
|
* @param {object} headers headers list
|
|
88
88
|
*/
|
|
89
89
|
haveRequestHeaders(headers) {
|
|
90
|
-
this.headers = { ...headers, ...
|
|
90
|
+
this.headers = { ...this.headers, ...headers };
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -98,7 +98,7 @@ class REST extends Helper {
|
|
|
98
98
|
* I.amBearerAuthenticated(secret('heregoestoken'))
|
|
99
99
|
* ```
|
|
100
100
|
*
|
|
101
|
-
* @param {string} accessToken Bearer access token
|
|
101
|
+
* @param {string | CodeceptJS.Secret} accessToken Bearer access token
|
|
102
102
|
*/
|
|
103
103
|
amBearerAuthenticated(accessToken) {
|
|
104
104
|
this.haveRequestHeaders({ Authorization: `Bearer ${accessToken}` });
|
|
@@ -112,6 +112,9 @@ class REST extends Helper {
|
|
|
112
112
|
* @returns {Promise<*>} response
|
|
113
113
|
*/
|
|
114
114
|
async _executeRequest(request) {
|
|
115
|
+
// Add custom headers. They can be set by amBearerAuthenticated() or haveRequestHeaders()
|
|
116
|
+
request.headers = { ...this.headers, ...request.headers };
|
|
117
|
+
|
|
115
118
|
const _debugRequest = { ...request };
|
|
116
119
|
this.axios.defaults.timeout = request.timeout || this.options.timeout;
|
|
117
120
|
|
package/docs/build/TestCafe.js
CHANGED
|
@@ -334,6 +334,7 @@ class TestCafe extends Helper {
|
|
|
334
334
|
* ```
|
|
335
335
|
*
|
|
336
336
|
* @param {string} url url path or global url.
|
|
337
|
+
* @return {void} automatically synchronized promise with recorder #!
|
|
337
338
|
*/
|
|
338
339
|
async amOnPage(url) {
|
|
339
340
|
if (!(/^\w+\:\/\//.test(url))) {
|
|
@@ -350,6 +351,7 @@ class TestCafe extends Helper {
|
|
|
350
351
|
*
|
|
351
352
|
* @param {number} width width in pixels or `maximize`.
|
|
352
353
|
* @param {number} height height in pixels.
|
|
354
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
353
355
|
*/
|
|
354
356
|
async resizeWindow(width, height) {
|
|
355
357
|
if (width === 'maximize') {
|
|
@@ -382,8 +384,9 @@ class TestCafe extends Helper {
|
|
|
382
384
|
* I.click({css: 'nav a.login'});
|
|
383
385
|
* ```
|
|
384
386
|
*
|
|
385
|
-
* @param {
|
|
386
|
-
* @param {?
|
|
387
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
388
|
+
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
389
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
387
390
|
*
|
|
388
391
|
*
|
|
389
392
|
*/
|
|
@@ -397,7 +400,7 @@ class TestCafe extends Helper {
|
|
|
397
400
|
* ```js
|
|
398
401
|
* I.refreshPage();
|
|
399
402
|
* ```
|
|
400
|
-
*
|
|
403
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
401
404
|
*/
|
|
402
405
|
async refreshPage() {
|
|
403
406
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -412,9 +415,9 @@ class TestCafe extends Helper {
|
|
|
412
415
|
* I.waitForVisible('#popup');
|
|
413
416
|
* ```
|
|
414
417
|
*
|
|
415
|
-
* @param {
|
|
418
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
416
419
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
417
|
-
*
|
|
420
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
418
421
|
*
|
|
419
422
|
*/
|
|
420
423
|
async waitForVisible(locator, sec) {
|
|
@@ -439,9 +442,9 @@ class TestCafe extends Helper {
|
|
|
439
442
|
* // or by strict locator
|
|
440
443
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
441
444
|
* ```
|
|
442
|
-
* @param {
|
|
443
|
-
* @param {
|
|
444
|
-
*
|
|
445
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
446
|
+
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
447
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
445
448
|
*/
|
|
446
449
|
async fillField(field, value) {
|
|
447
450
|
const els = await findFields.call(this, field);
|
|
@@ -460,8 +463,8 @@ class TestCafe extends Helper {
|
|
|
460
463
|
* I.clearField('user[email]');
|
|
461
464
|
* I.clearField('#email');
|
|
462
465
|
* ```
|
|
463
|
-
* @param {
|
|
464
|
-
*
|
|
466
|
+
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
467
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
465
468
|
*/
|
|
466
469
|
async clearField(field) {
|
|
467
470
|
const els = await findFields.call(this, field);
|
|
@@ -481,8 +484,9 @@ class TestCafe extends Helper {
|
|
|
481
484
|
* ```js
|
|
482
485
|
* I.appendField('#myTextField', 'appended');
|
|
483
486
|
* ```
|
|
484
|
-
* @param {
|
|
487
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
485
488
|
* @param {string} value text value to append.
|
|
489
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
486
490
|
*
|
|
487
491
|
*/
|
|
488
492
|
async appendField(field, value) {
|
|
@@ -505,8 +509,9 @@ class TestCafe extends Helper {
|
|
|
505
509
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
506
510
|
* ```
|
|
507
511
|
*
|
|
508
|
-
* @param {
|
|
512
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
509
513
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
514
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
510
515
|
*
|
|
511
516
|
*/
|
|
512
517
|
async attachFile(field, pathToFile) {
|
|
@@ -532,6 +537,7 @@ class TestCafe extends Helper {
|
|
|
532
537
|
* ```
|
|
533
538
|
*
|
|
534
539
|
* @param {string|string[]} key key or array of keys to press.
|
|
540
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
535
541
|
*
|
|
536
542
|
* {{ keys }}
|
|
537
543
|
*/
|
|
@@ -552,10 +558,10 @@ class TestCafe extends Helper {
|
|
|
552
558
|
* I.moveCursorTo('#submit', 5,5);
|
|
553
559
|
* ```
|
|
554
560
|
*
|
|
555
|
-
* @param {
|
|
561
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
556
562
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
557
563
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
558
|
-
*
|
|
564
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
559
565
|
*
|
|
560
566
|
*/
|
|
561
567
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -578,9 +584,9 @@ class TestCafe extends Helper {
|
|
|
578
584
|
* I.doubleClick('.btn.edit');
|
|
579
585
|
* ```
|
|
580
586
|
*
|
|
581
|
-
* @param {
|
|
582
|
-
* @param {?
|
|
583
|
-
*
|
|
587
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
588
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
589
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
584
590
|
*
|
|
585
591
|
*/
|
|
586
592
|
async doubleClick(locator, context = null) {
|
|
@@ -609,9 +615,9 @@ class TestCafe extends Helper {
|
|
|
609
615
|
* I.rightClick('Click me', '.context');
|
|
610
616
|
* ```
|
|
611
617
|
*
|
|
612
|
-
* @param {
|
|
613
|
-
* @param {?
|
|
614
|
-
*
|
|
618
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
619
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
620
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
615
621
|
*
|
|
616
622
|
*/
|
|
617
623
|
async rightClick(locator, context = null) {
|
|
@@ -639,8 +645,9 @@ class TestCafe extends Helper {
|
|
|
639
645
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
640
646
|
* I.checkOption('agree', '//form');
|
|
641
647
|
* ```
|
|
642
|
-
* @param {
|
|
643
|
-
* @param {?
|
|
648
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
649
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
650
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
644
651
|
*/
|
|
645
652
|
async checkOption(field, context = null) {
|
|
646
653
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -661,8 +668,9 @@ class TestCafe extends Helper {
|
|
|
661
668
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
662
669
|
* I.uncheckOption('agree', '//form');
|
|
663
670
|
* ```
|
|
664
|
-
* @param {
|
|
665
|
-
* @param {?
|
|
671
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
672
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
673
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
666
674
|
*/
|
|
667
675
|
async uncheckOption(field, context = null) {
|
|
668
676
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -683,8 +691,8 @@ class TestCafe extends Helper {
|
|
|
683
691
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
684
692
|
* ```
|
|
685
693
|
*
|
|
686
|
-
* @param {
|
|
687
|
-
*
|
|
694
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
695
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
688
696
|
*/
|
|
689
697
|
async seeCheckboxIsChecked(field) {
|
|
690
698
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -699,8 +707,8 @@ class TestCafe extends Helper {
|
|
|
699
707
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
700
708
|
* ```
|
|
701
709
|
*
|
|
702
|
-
* @param {
|
|
703
|
-
*
|
|
710
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
711
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
704
712
|
*/
|
|
705
713
|
async dontSeeCheckboxIsChecked(field) {
|
|
706
714
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -725,9 +733,9 @@ class TestCafe extends Helper {
|
|
|
725
733
|
* ```js
|
|
726
734
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
727
735
|
* ```
|
|
728
|
-
* @param {
|
|
736
|
+
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
729
737
|
* @param {string|Array<*>} option visible text or value of option.
|
|
730
|
-
*
|
|
738
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
731
739
|
*/
|
|
732
740
|
async selectOption(select, option) {
|
|
733
741
|
const els = await findFields.call(this, select);
|
|
@@ -779,6 +787,7 @@ class TestCafe extends Helper {
|
|
|
779
787
|
* ```
|
|
780
788
|
*
|
|
781
789
|
* @param {string} url a fragment to check
|
|
790
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
782
791
|
*/
|
|
783
792
|
async seeInCurrentUrl(url) {
|
|
784
793
|
stringIncludes('url').assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -788,6 +797,7 @@ class TestCafe extends Helper {
|
|
|
788
797
|
* Checks that current url does not contain a provided fragment.
|
|
789
798
|
*
|
|
790
799
|
* @param {string} url value to check.
|
|
800
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
791
801
|
*/
|
|
792
802
|
async dontSeeInCurrentUrl(url) {
|
|
793
803
|
stringIncludes('url').negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -804,6 +814,7 @@ class TestCafe extends Helper {
|
|
|
804
814
|
* ```
|
|
805
815
|
*
|
|
806
816
|
* @param {string} url value to check.
|
|
817
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
807
818
|
*/
|
|
808
819
|
async seeCurrentUrlEquals(url) {
|
|
809
820
|
urlEquals(this.options.url).assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -819,6 +830,7 @@ class TestCafe extends Helper {
|
|
|
819
830
|
* ```
|
|
820
831
|
*
|
|
821
832
|
* @param {string} url value to check.
|
|
833
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
822
834
|
*/
|
|
823
835
|
async dontSeeCurrentUrlEquals(url) {
|
|
824
836
|
urlEquals(this.options.url).negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -834,7 +846,8 @@ class TestCafe extends Helper {
|
|
|
834
846
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
835
847
|
* ```
|
|
836
848
|
* @param {string} text expected on page.
|
|
837
|
-
* @param {?
|
|
849
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
850
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
838
851
|
*
|
|
839
852
|
*/
|
|
840
853
|
async see(text, context = null) {
|
|
@@ -860,8 +873,8 @@ class TestCafe extends Helper {
|
|
|
860
873
|
* ```
|
|
861
874
|
*
|
|
862
875
|
* @param {string} text which is not present.
|
|
863
|
-
* @param {
|
|
864
|
-
*
|
|
876
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
877
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
865
878
|
*
|
|
866
879
|
*/
|
|
867
880
|
async dontSee(text, context = null) {
|
|
@@ -884,7 +897,8 @@ class TestCafe extends Helper {
|
|
|
884
897
|
* ```js
|
|
885
898
|
* I.seeElement('#modal');
|
|
886
899
|
* ```
|
|
887
|
-
* @param {
|
|
900
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
901
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
888
902
|
*/
|
|
889
903
|
async seeElement(locator) {
|
|
890
904
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -900,7 +914,8 @@ class TestCafe extends Helper {
|
|
|
900
914
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
901
915
|
* ```
|
|
902
916
|
*
|
|
903
|
-
* @param {
|
|
917
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
918
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
904
919
|
*/
|
|
905
920
|
async dontSeeElement(locator) {
|
|
906
921
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -916,8 +931,8 @@ class TestCafe extends Helper {
|
|
|
916
931
|
* ```js
|
|
917
932
|
* I.seeElementInDOM('#modal');
|
|
918
933
|
* ```
|
|
919
|
-
* @param {
|
|
920
|
-
*
|
|
934
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
935
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
921
936
|
*/
|
|
922
937
|
async seeElementInDOM(locator) {
|
|
923
938
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -933,7 +948,8 @@ class TestCafe extends Helper {
|
|
|
933
948
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
934
949
|
* ```
|
|
935
950
|
*
|
|
936
|
-
* @param {
|
|
951
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
952
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
937
953
|
*/
|
|
938
954
|
async dontSeeElementInDOM(locator) {
|
|
939
955
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -950,9 +966,9 @@ class TestCafe extends Helper {
|
|
|
950
966
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
951
967
|
* ```
|
|
952
968
|
*
|
|
953
|
-
* @param {
|
|
969
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
954
970
|
* @param {number} num number of elements.
|
|
955
|
-
*
|
|
971
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
956
972
|
*
|
|
957
973
|
*/
|
|
958
974
|
async seeNumberOfVisibleElements(locator, num) {
|
|
@@ -970,7 +986,7 @@ class TestCafe extends Helper {
|
|
|
970
986
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
971
987
|
* ```
|
|
972
988
|
*
|
|
973
|
-
* @param {
|
|
989
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
974
990
|
* @returns {Promise<number>} number of visible elements
|
|
975
991
|
*/
|
|
976
992
|
async grabNumberOfVisibleElements(locator) {
|
|
@@ -988,9 +1004,9 @@ class TestCafe extends Helper {
|
|
|
988
1004
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
989
1005
|
* I.seeInField('#searchform input','Search');
|
|
990
1006
|
* ```
|
|
991
|
-
* @param {
|
|
1007
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
992
1008
|
* @param {string} value value to check.
|
|
993
|
-
*
|
|
1009
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
994
1010
|
*/
|
|
995
1011
|
async seeInField(field, value) {
|
|
996
1012
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1012,8 +1028,9 @@ class TestCafe extends Helper {
|
|
|
1012
1028
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1013
1029
|
* ```
|
|
1014
1030
|
*
|
|
1015
|
-
* @param {
|
|
1031
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1016
1032
|
* @param {string} value value to check.
|
|
1033
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1017
1034
|
*/
|
|
1018
1035
|
async dontSeeInField(field, value) {
|
|
1019
1036
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1047,6 +1064,7 @@ class TestCafe extends Helper {
|
|
|
1047
1064
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1048
1065
|
* ```
|
|
1049
1066
|
* @param {string} text value to check.
|
|
1067
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1050
1068
|
*/
|
|
1051
1069
|
async seeInSource(text) {
|
|
1052
1070
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1061,7 +1079,7 @@ class TestCafe extends Helper {
|
|
|
1061
1079
|
* ```
|
|
1062
1080
|
*
|
|
1063
1081
|
* @param {string} value to check.
|
|
1064
|
-
*
|
|
1082
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1065
1083
|
*/
|
|
1066
1084
|
async dontSeeInSource(text) {
|
|
1067
1085
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1076,9 +1094,9 @@ class TestCafe extends Helper {
|
|
|
1076
1094
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
1077
1095
|
* ```
|
|
1078
1096
|
*
|
|
1079
|
-
* @param {
|
|
1097
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1080
1098
|
* @param {string} fileName file name to save.
|
|
1081
|
-
*
|
|
1099
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1082
1100
|
*
|
|
1083
1101
|
*/
|
|
1084
1102
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -1104,6 +1122,7 @@ class TestCafe extends Helper {
|
|
|
1104
1122
|
*
|
|
1105
1123
|
* @param {string} fileName file name to save.
|
|
1106
1124
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1125
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1107
1126
|
*/
|
|
1108
1127
|
// TODO Implement full page screenshots
|
|
1109
1128
|
async saveScreenshot(fileName) {
|
|
@@ -1122,6 +1141,7 @@ class TestCafe extends Helper {
|
|
|
1122
1141
|
* ```
|
|
1123
1142
|
*
|
|
1124
1143
|
* @param {number} sec number of second to wait.
|
|
1144
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1125
1145
|
*/
|
|
1126
1146
|
async wait(sec) {
|
|
1127
1147
|
return new Promise(((done) => {
|
|
@@ -1155,7 +1175,7 @@ class TestCafe extends Helper {
|
|
|
1155
1175
|
*
|
|
1156
1176
|
* @param {string|function} fn function to be executed in browser context.
|
|
1157
1177
|
* @param {...any} args to be passed to function.
|
|
1158
|
-
*
|
|
1178
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1159
1179
|
*
|
|
1160
1180
|
*
|
|
1161
1181
|
* If a function returns a Promise It will wait for it resolution.
|
|
@@ -1173,7 +1193,7 @@ class TestCafe extends Helper {
|
|
|
1173
1193
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
1174
1194
|
* ```
|
|
1175
1195
|
*
|
|
1176
|
-
* @param {
|
|
1196
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1177
1197
|
* @returns {Promise<string[]>} attribute value
|
|
1178
1198
|
*
|
|
1179
1199
|
*/
|
|
@@ -1197,7 +1217,7 @@ class TestCafe extends Helper {
|
|
|
1197
1217
|
* ```
|
|
1198
1218
|
* If multiple elements found returns first element.
|
|
1199
1219
|
*
|
|
1200
|
-
* @param {
|
|
1220
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1201
1221
|
* @returns {Promise<string>} attribute value
|
|
1202
1222
|
*
|
|
1203
1223
|
*/
|
|
@@ -1220,7 +1240,7 @@ class TestCafe extends Helper {
|
|
|
1220
1240
|
* ```js
|
|
1221
1241
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1222
1242
|
* ```
|
|
1223
|
-
* @param {
|
|
1243
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1224
1244
|
* @param {string} attr attribute name.
|
|
1225
1245
|
* @returns {Promise<string>} attribute value
|
|
1226
1246
|
*
|
|
@@ -1244,7 +1264,7 @@ class TestCafe extends Helper {
|
|
|
1244
1264
|
* ```js
|
|
1245
1265
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1246
1266
|
* ```
|
|
1247
|
-
* @param {
|
|
1267
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1248
1268
|
* @param {string} attr attribute name.
|
|
1249
1269
|
* @returns {Promise<string>} attribute value
|
|
1250
1270
|
*
|
|
@@ -1267,7 +1287,7 @@ class TestCafe extends Helper {
|
|
|
1267
1287
|
* ```js
|
|
1268
1288
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
1269
1289
|
* ```
|
|
1270
|
-
* @param {
|
|
1290
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1271
1291
|
* @returns {Promise<string[]>} attribute value
|
|
1272
1292
|
*
|
|
1273
1293
|
*/
|
|
@@ -1290,7 +1310,7 @@ class TestCafe extends Helper {
|
|
|
1290
1310
|
* ```js
|
|
1291
1311
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
1292
1312
|
* ```
|
|
1293
|
-
* @param {
|
|
1313
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1294
1314
|
* @returns {Promise<string>} attribute value
|
|
1295
1315
|
*
|
|
1296
1316
|
*/
|
|
@@ -1368,7 +1388,7 @@ class TestCafe extends Helper {
|
|
|
1368
1388
|
* ```js
|
|
1369
1389
|
* I.scrollPageToTop();
|
|
1370
1390
|
* ```
|
|
1371
|
-
*
|
|
1391
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1372
1392
|
*/
|
|
1373
1393
|
scrollPageToTop() {
|
|
1374
1394
|
return ClientFunction(() => window.scrollTo(0, 0)).with({ boundTestRun: this.t })().catch(mapError);
|
|
@@ -1380,7 +1400,7 @@ class TestCafe extends Helper {
|
|
|
1380
1400
|
* ```js
|
|
1381
1401
|
* I.scrollPageToBottom();
|
|
1382
1402
|
* ```
|
|
1383
|
-
*
|
|
1403
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1384
1404
|
*/
|
|
1385
1405
|
scrollPageToBottom() {
|
|
1386
1406
|
return ClientFunction(() => {
|
|
@@ -1402,9 +1422,10 @@ class TestCafe extends Helper {
|
|
|
1402
1422
|
* I.scrollTo('#submit', 5, 5);
|
|
1403
1423
|
* ```
|
|
1404
1424
|
*
|
|
1405
|
-
* @param {
|
|
1425
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1406
1426
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1407
1427
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1428
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1408
1429
|
*/
|
|
1409
1430
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1410
1431
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1442,7 +1463,8 @@ class TestCafe extends Helper {
|
|
|
1442
1463
|
* I.switchTo(); // switch back to main page
|
|
1443
1464
|
* ```
|
|
1444
1465
|
*
|
|
1445
|
-
* @param {?
|
|
1466
|
+
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1467
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1446
1468
|
*/
|
|
1447
1469
|
async switchTo(locator) {
|
|
1448
1470
|
if (Number.isInteger(locator)) {
|
|
@@ -1475,7 +1497,7 @@ class TestCafe extends Helper {
|
|
|
1475
1497
|
* ```
|
|
1476
1498
|
*
|
|
1477
1499
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
1478
|
-
*
|
|
1500
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1479
1501
|
*/
|
|
1480
1502
|
async setCookie(cookie) {
|
|
1481
1503
|
if (Array.isArray(cookie)) {
|
|
@@ -1500,7 +1522,7 @@ class TestCafe extends Helper {
|
|
|
1500
1522
|
* ```
|
|
1501
1523
|
*
|
|
1502
1524
|
* @param {string} name cookie name.
|
|
1503
|
-
*
|
|
1525
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1504
1526
|
*
|
|
1505
1527
|
*/
|
|
1506
1528
|
async seeCookie(name) {
|
|
@@ -1516,6 +1538,7 @@ class TestCafe extends Helper {
|
|
|
1516
1538
|
* ```
|
|
1517
1539
|
*
|
|
1518
1540
|
* @param {string} name cookie name.
|
|
1541
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1519
1542
|
*/
|
|
1520
1543
|
async dontSeeCookie(name) {
|
|
1521
1544
|
const cookie = await this.grabCookie(name);
|
|
@@ -1565,6 +1588,7 @@ class TestCafe extends Helper {
|
|
|
1565
1588
|
* ```
|
|
1566
1589
|
*
|
|
1567
1590
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
1591
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1568
1592
|
*/
|
|
1569
1593
|
async clearCookie(cookieName) {
|
|
1570
1594
|
const clearCookies = ClientFunction(() => {
|
|
@@ -1592,6 +1616,7 @@ class TestCafe extends Helper {
|
|
|
1592
1616
|
*
|
|
1593
1617
|
* @param {string} urlPart value to check.
|
|
1594
1618
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1619
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1595
1620
|
*/
|
|
1596
1621
|
async waitInUrl(urlPart, sec = null) {
|
|
1597
1622
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1617,6 +1642,7 @@ class TestCafe extends Helper {
|
|
|
1617
1642
|
*
|
|
1618
1643
|
* @param {string} urlPart value to check.
|
|
1619
1644
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1645
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1620
1646
|
*/
|
|
1621
1647
|
async waitUrlEquals(urlPart, sec = null) {
|
|
1622
1648
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1654,7 +1680,7 @@ class TestCafe extends Helper {
|
|
|
1654
1680
|
* @param {string|function} fn to be executed in browser context.
|
|
1655
1681
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
1656
1682
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1657
|
-
*
|
|
1683
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1658
1684
|
*/
|
|
1659
1685
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
1660
1686
|
let args = [];
|
|
@@ -1679,9 +1705,10 @@ class TestCafe extends Helper {
|
|
|
1679
1705
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
1680
1706
|
* ```
|
|
1681
1707
|
*
|
|
1682
|
-
* @param {
|
|
1708
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1683
1709
|
* @param {number} num number of elements.
|
|
1684
1710
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1711
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1685
1712
|
*/
|
|
1686
1713
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
1687
1714
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1701,8 +1728,9 @@ class TestCafe extends Helper {
|
|
|
1701
1728
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
1702
1729
|
* ```
|
|
1703
1730
|
*
|
|
1704
|
-
* @param {
|
|
1731
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1705
1732
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1733
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1706
1734
|
*/
|
|
1707
1735
|
async waitForElement(locator, sec) {
|
|
1708
1736
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1720,8 +1748,9 @@ class TestCafe extends Helper {
|
|
|
1720
1748
|
* I.waitToHide('#popup');
|
|
1721
1749
|
* ```
|
|
1722
1750
|
*
|
|
1723
|
-
* @param {
|
|
1751
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1724
1752
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1753
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1725
1754
|
*/
|
|
1726
1755
|
async waitToHide(locator, sec) {
|
|
1727
1756
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1739,8 +1768,9 @@ class TestCafe extends Helper {
|
|
|
1739
1768
|
* I.waitForInvisible('#popup');
|
|
1740
1769
|
* ```
|
|
1741
1770
|
*
|
|
1742
|
-
* @param {
|
|
1771
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1743
1772
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1773
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1744
1774
|
*/
|
|
1745
1775
|
async waitForInvisible(locator, sec) {
|
|
1746
1776
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1762,7 +1792,8 @@ class TestCafe extends Helper {
|
|
|
1762
1792
|
*
|
|
1763
1793
|
* @param {string }text to wait for.
|
|
1764
1794
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1765
|
-
* @param {
|
|
1795
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1796
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1766
1797
|
*
|
|
1767
1798
|
*/
|
|
1768
1799
|
async waitForText(text, sec = null, context = null) {
|