codeceptjs 3.3.5 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -7
- package/bin/codecept.js +40 -3
- package/docs/basics.md +24 -1
- package/docs/build/Appium.js +41 -22
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +106 -57
- package/docs/build/Playwright.js +187 -111
- package/docs/build/Protractor.js +132 -70
- package/docs/build/Puppeteer.js +143 -76
- package/docs/build/REST.js +2 -2
- package/docs/build/TestCafe.js +107 -57
- package/docs/build/WebDriver.js +162 -89
- package/docs/changelog.md +37 -7
- package/docs/commands.md +5 -3
- package/docs/configuration.md +5 -5
- package/docs/helpers/Appium.md +25 -23
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +57 -57
- package/docs/helpers/Playwright.md +76 -75
- package/docs/helpers/Puppeteer.md +76 -85
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +57 -57
- package/docs/helpers/WebDriver.md +84 -97
- package/docs/quickstart.md +1 -1
- package/docs/reports.md +1 -1
- package/docs/secrets.md +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +3 -3
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +2 -2
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/command/configMigrate.js +1 -1
- package/lib/command/dryRun.js +2 -1
- package/lib/command/generate.js +35 -18
- package/lib/command/run-rerun.js +38 -0
- package/lib/command/utils.js +13 -3
- package/lib/config.js +2 -2
- package/lib/data/context.js +7 -0
- package/lib/helper/Appium.js +6 -4
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/Playwright.js +48 -38
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/REST.js +2 -2
- package/lib/helper/TestCafe.js +1 -1
- package/lib/helper/WebDriver.js +7 -7
- package/lib/plugin/wdio.js +11 -2
- package/lib/utils.js +3 -0
- package/package.json +2 -2
- package/typings/index.d.ts +46 -46
- package/typings/types.d.ts +497 -443
package/docs/build/REST.js
CHANGED
|
@@ -9,7 +9,7 @@ const { beautify } = require('../utils');
|
|
|
9
9
|
*
|
|
10
10
|
* @typedef RESTConfig
|
|
11
11
|
* @type {object}
|
|
12
|
-
* @prop {string} endpoint - API base URL
|
|
12
|
+
* @prop {string} [endpoint] - API base URL
|
|
13
13
|
* @prop {boolean} [prettyPrintJson=false] - pretty print json for response/request on console logs
|
|
14
14
|
* @prop {number} [timeout=1000] - timeout for requests in milliseconds. 10000ms by default
|
|
15
15
|
* @prop {object} [defaultHeaders] - a list of default headers
|
|
@@ -138,7 +138,7 @@ class REST extends Helper {
|
|
|
138
138
|
|
|
139
139
|
if (request.data instanceof Secret) {
|
|
140
140
|
_debugRequest.data = '*****';
|
|
141
|
-
request.data = typeof request.data === 'object' ? { ...request.data.toString() } : request.data.toString();
|
|
141
|
+
request.data = (typeof request.data === 'object' && !(request.data instanceof Secret)) ? { ...request.data.toString() } : request.data.toString();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
if ((typeof request.data) === 'string') {
|
package/docs/build/TestCafe.js
CHANGED
|
@@ -42,7 +42,7 @@ const getHtmlSource = t => ClientFunction(() => document.getElementsByTagName('h
|
|
|
42
42
|
*
|
|
43
43
|
* ## Configuration
|
|
44
44
|
*
|
|
45
|
-
* This helper should be configured in codecept.
|
|
45
|
+
* This helper should be configured in codecept.conf.ts or codecept.conf.js
|
|
46
46
|
*
|
|
47
47
|
* * `url`: base url of website to be tested
|
|
48
48
|
* * `show`: (optional, default: false) - show browser window.
|
|
@@ -351,7 +351,8 @@ class TestCafe extends Helper {
|
|
|
351
351
|
*
|
|
352
352
|
* @param {number} width width in pixels or `maximize`.
|
|
353
353
|
* @param {number} height height in pixels.
|
|
354
|
-
*
|
|
354
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
355
|
+
*
|
|
355
356
|
*/
|
|
356
357
|
async resizeWindow(width, height) {
|
|
357
358
|
if (width === 'maximize') {
|
|
@@ -386,7 +387,7 @@ class TestCafe extends Helper {
|
|
|
386
387
|
*
|
|
387
388
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
388
389
|
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
389
|
-
*
|
|
390
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
390
391
|
*
|
|
391
392
|
*
|
|
392
393
|
*/
|
|
@@ -400,7 +401,8 @@ class TestCafe extends Helper {
|
|
|
400
401
|
* ```js
|
|
401
402
|
* I.refreshPage();
|
|
402
403
|
* ```
|
|
403
|
-
*
|
|
404
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
405
|
+
*
|
|
404
406
|
*/
|
|
405
407
|
async refreshPage() {
|
|
406
408
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -417,7 +419,8 @@ class TestCafe extends Helper {
|
|
|
417
419
|
*
|
|
418
420
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
419
421
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
420
|
-
*
|
|
422
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
423
|
+
*
|
|
421
424
|
*
|
|
422
425
|
*/
|
|
423
426
|
async waitForVisible(locator, sec) {
|
|
@@ -444,7 +447,8 @@ class TestCafe extends Helper {
|
|
|
444
447
|
* ```
|
|
445
448
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
446
449
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
447
|
-
*
|
|
450
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
451
|
+
*
|
|
448
452
|
*/
|
|
449
453
|
async fillField(field, value) {
|
|
450
454
|
const els = await findFields.call(this, field);
|
|
@@ -464,7 +468,8 @@ class TestCafe extends Helper {
|
|
|
464
468
|
* I.clearField('#email');
|
|
465
469
|
* ```
|
|
466
470
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
467
|
-
*
|
|
471
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder.
|
|
472
|
+
*
|
|
468
473
|
*/
|
|
469
474
|
async clearField(field) {
|
|
470
475
|
const els = await findFields.call(this, field);
|
|
@@ -486,7 +491,8 @@ class TestCafe extends Helper {
|
|
|
486
491
|
* ```
|
|
487
492
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
488
493
|
* @param {string} value text value to append.
|
|
489
|
-
*
|
|
494
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
495
|
+
*
|
|
490
496
|
*
|
|
491
497
|
*/
|
|
492
498
|
async appendField(field, value) {
|
|
@@ -501,7 +507,7 @@ class TestCafe extends Helper {
|
|
|
501
507
|
|
|
502
508
|
/**
|
|
503
509
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
504
|
-
* Path to file is relative current codecept directory (where codecept.
|
|
510
|
+
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
505
511
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
506
512
|
*
|
|
507
513
|
* ```js
|
|
@@ -510,8 +516,9 @@ class TestCafe extends Helper {
|
|
|
510
516
|
* ```
|
|
511
517
|
*
|
|
512
518
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
513
|
-
* @param {string} pathToFile local file path relative to codecept.
|
|
514
|
-
*
|
|
519
|
+
* @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
520
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
521
|
+
*
|
|
515
522
|
*
|
|
516
523
|
*/
|
|
517
524
|
async attachFile(field, pathToFile) {
|
|
@@ -537,7 +544,8 @@ class TestCafe extends Helper {
|
|
|
537
544
|
* ```
|
|
538
545
|
*
|
|
539
546
|
* @param {string|string[]} key key or array of keys to press.
|
|
540
|
-
*
|
|
547
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
548
|
+
*
|
|
541
549
|
*
|
|
542
550
|
* {{ keys }}
|
|
543
551
|
*/
|
|
@@ -561,7 +569,8 @@ class TestCafe extends Helper {
|
|
|
561
569
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
562
570
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
563
571
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
564
|
-
*
|
|
572
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
573
|
+
*
|
|
565
574
|
*
|
|
566
575
|
*/
|
|
567
576
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -586,7 +595,8 @@ class TestCafe extends Helper {
|
|
|
586
595
|
*
|
|
587
596
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
588
597
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
589
|
-
*
|
|
598
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
599
|
+
*
|
|
590
600
|
*
|
|
591
601
|
*/
|
|
592
602
|
async doubleClick(locator, context = null) {
|
|
@@ -617,7 +627,8 @@ class TestCafe extends Helper {
|
|
|
617
627
|
*
|
|
618
628
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
619
629
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
620
|
-
*
|
|
630
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
631
|
+
*
|
|
621
632
|
*
|
|
622
633
|
*/
|
|
623
634
|
async rightClick(locator, context = null) {
|
|
@@ -647,7 +658,8 @@ class TestCafe extends Helper {
|
|
|
647
658
|
* ```
|
|
648
659
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
649
660
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
650
|
-
*
|
|
661
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
662
|
+
*
|
|
651
663
|
*/
|
|
652
664
|
async checkOption(field, context = null) {
|
|
653
665
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -670,7 +682,8 @@ class TestCafe extends Helper {
|
|
|
670
682
|
* ```
|
|
671
683
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
672
684
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
673
|
-
*
|
|
685
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
686
|
+
*
|
|
674
687
|
*/
|
|
675
688
|
async uncheckOption(field, context = null) {
|
|
676
689
|
const el = await findCheckable.call(this, field, context);
|
|
@@ -692,7 +705,8 @@ class TestCafe extends Helper {
|
|
|
692
705
|
* ```
|
|
693
706
|
*
|
|
694
707
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
695
|
-
*
|
|
708
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
709
|
+
*
|
|
696
710
|
*/
|
|
697
711
|
async seeCheckboxIsChecked(field) {
|
|
698
712
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -708,7 +722,8 @@ class TestCafe extends Helper {
|
|
|
708
722
|
* ```
|
|
709
723
|
*
|
|
710
724
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
711
|
-
*
|
|
725
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
726
|
+
*
|
|
712
727
|
*/
|
|
713
728
|
async dontSeeCheckboxIsChecked(field) {
|
|
714
729
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -735,7 +750,8 @@ class TestCafe extends Helper {
|
|
|
735
750
|
* ```
|
|
736
751
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
737
752
|
* @param {string|Array<*>} option visible text or value of option.
|
|
738
|
-
*
|
|
753
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
754
|
+
*
|
|
739
755
|
*/
|
|
740
756
|
async selectOption(select, option) {
|
|
741
757
|
const els = await findFields.call(this, select);
|
|
@@ -787,7 +803,8 @@ class TestCafe extends Helper {
|
|
|
787
803
|
* ```
|
|
788
804
|
*
|
|
789
805
|
* @param {string} url a fragment to check
|
|
790
|
-
*
|
|
806
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
807
|
+
*
|
|
791
808
|
*/
|
|
792
809
|
async seeInCurrentUrl(url) {
|
|
793
810
|
stringIncludes('url').assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -797,7 +814,8 @@ class TestCafe extends Helper {
|
|
|
797
814
|
* Checks that current url does not contain a provided fragment.
|
|
798
815
|
*
|
|
799
816
|
* @param {string} url value to check.
|
|
800
|
-
*
|
|
817
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
818
|
+
*
|
|
801
819
|
*/
|
|
802
820
|
async dontSeeInCurrentUrl(url) {
|
|
803
821
|
stringIncludes('url').negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -814,7 +832,8 @@ class TestCafe extends Helper {
|
|
|
814
832
|
* ```
|
|
815
833
|
*
|
|
816
834
|
* @param {string} url value to check.
|
|
817
|
-
*
|
|
835
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
836
|
+
*
|
|
818
837
|
*/
|
|
819
838
|
async seeCurrentUrlEquals(url) {
|
|
820
839
|
urlEquals(this.options.url).assert(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -830,7 +849,8 @@ class TestCafe extends Helper {
|
|
|
830
849
|
* ```
|
|
831
850
|
*
|
|
832
851
|
* @param {string} url value to check.
|
|
833
|
-
*
|
|
852
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
853
|
+
*
|
|
834
854
|
*/
|
|
835
855
|
async dontSeeCurrentUrlEquals(url) {
|
|
836
856
|
urlEquals(this.options.url).negate(url, await getPageUrl(this.t)().catch(mapError));
|
|
@@ -847,7 +867,8 @@ class TestCafe extends Helper {
|
|
|
847
867
|
* ```
|
|
848
868
|
* @param {string} text expected on page.
|
|
849
869
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
850
|
-
*
|
|
870
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
871
|
+
*
|
|
851
872
|
*
|
|
852
873
|
*/
|
|
853
874
|
async see(text, context = null) {
|
|
@@ -874,7 +895,8 @@ class TestCafe extends Helper {
|
|
|
874
895
|
*
|
|
875
896
|
* @param {string} text which is not present.
|
|
876
897
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
877
|
-
*
|
|
898
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
899
|
+
*
|
|
878
900
|
*
|
|
879
901
|
*/
|
|
880
902
|
async dontSee(text, context = null) {
|
|
@@ -898,7 +920,8 @@ class TestCafe extends Helper {
|
|
|
898
920
|
* I.seeElement('#modal');
|
|
899
921
|
* ```
|
|
900
922
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
901
|
-
*
|
|
923
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
924
|
+
*
|
|
902
925
|
*/
|
|
903
926
|
async seeElement(locator) {
|
|
904
927
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -915,7 +938,8 @@ class TestCafe extends Helper {
|
|
|
915
938
|
* ```
|
|
916
939
|
*
|
|
917
940
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
918
|
-
*
|
|
941
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
942
|
+
*
|
|
919
943
|
*/
|
|
920
944
|
async dontSeeElement(locator) {
|
|
921
945
|
const exists = (await findElements.call(this, this.context, locator)).filterVisible().exists;
|
|
@@ -932,7 +956,8 @@ class TestCafe extends Helper {
|
|
|
932
956
|
* I.seeElementInDOM('#modal');
|
|
933
957
|
* ```
|
|
934
958
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
935
|
-
*
|
|
959
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
960
|
+
*
|
|
936
961
|
*/
|
|
937
962
|
async seeElementInDOM(locator) {
|
|
938
963
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -949,7 +974,8 @@ class TestCafe extends Helper {
|
|
|
949
974
|
* ```
|
|
950
975
|
*
|
|
951
976
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
952
|
-
*
|
|
977
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
978
|
+
*
|
|
953
979
|
*/
|
|
954
980
|
async dontSeeElementInDOM(locator) {
|
|
955
981
|
const exists = (await findElements.call(this, this.context, locator)).exists;
|
|
@@ -968,7 +994,8 @@ class TestCafe extends Helper {
|
|
|
968
994
|
*
|
|
969
995
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
970
996
|
* @param {number} num number of elements.
|
|
971
|
-
*
|
|
997
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
998
|
+
*
|
|
972
999
|
*
|
|
973
1000
|
*/
|
|
974
1001
|
async seeNumberOfVisibleElements(locator, num) {
|
|
@@ -1006,7 +1033,8 @@ class TestCafe extends Helper {
|
|
|
1006
1033
|
* ```
|
|
1007
1034
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1008
1035
|
* @param {string} value value to check.
|
|
1009
|
-
*
|
|
1036
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1037
|
+
*
|
|
1010
1038
|
*/
|
|
1011
1039
|
async seeInField(field, value) {
|
|
1012
1040
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1030,7 +1058,8 @@ class TestCafe extends Helper {
|
|
|
1030
1058
|
*
|
|
1031
1059
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1032
1060
|
* @param {string} value value to check.
|
|
1033
|
-
*
|
|
1061
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1062
|
+
*
|
|
1034
1063
|
*/
|
|
1035
1064
|
async dontSeeInField(field, value) {
|
|
1036
1065
|
// const expectedValue = findElements.call(this, this.context, field).value;
|
|
@@ -1064,7 +1093,8 @@ class TestCafe extends Helper {
|
|
|
1064
1093
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1065
1094
|
* ```
|
|
1066
1095
|
* @param {string} text value to check.
|
|
1067
|
-
*
|
|
1096
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1097
|
+
*
|
|
1068
1098
|
*/
|
|
1069
1099
|
async seeInSource(text) {
|
|
1070
1100
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1079,7 +1109,8 @@ class TestCafe extends Helper {
|
|
|
1079
1109
|
* ```
|
|
1080
1110
|
*
|
|
1081
1111
|
* @param {string} value to check.
|
|
1082
|
-
*
|
|
1112
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1113
|
+
*
|
|
1083
1114
|
*/
|
|
1084
1115
|
async dontSeeInSource(text) {
|
|
1085
1116
|
const source = await getHtmlSource(this.t)();
|
|
@@ -1087,7 +1118,7 @@ class TestCafe extends Helper {
|
|
|
1087
1118
|
}
|
|
1088
1119
|
|
|
1089
1120
|
/**
|
|
1090
|
-
* Saves screenshot of the specified locator to ouput folder (set in codecept.
|
|
1121
|
+
* Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1091
1122
|
* Filename is relative to output folder.
|
|
1092
1123
|
*
|
|
1093
1124
|
* ```js
|
|
@@ -1096,7 +1127,8 @@ class TestCafe extends Helper {
|
|
|
1096
1127
|
*
|
|
1097
1128
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1098
1129
|
* @param {string} fileName file name to save.
|
|
1099
|
-
*
|
|
1130
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1131
|
+
*
|
|
1100
1132
|
*
|
|
1101
1133
|
*/
|
|
1102
1134
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -1111,7 +1143,7 @@ class TestCafe extends Helper {
|
|
|
1111
1143
|
}
|
|
1112
1144
|
|
|
1113
1145
|
/**
|
|
1114
|
-
* Saves a screenshot to ouput folder (set in codecept.
|
|
1146
|
+
* Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1115
1147
|
* Filename is relative to output folder.
|
|
1116
1148
|
* Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
1117
1149
|
*
|
|
@@ -1122,7 +1154,8 @@ class TestCafe extends Helper {
|
|
|
1122
1154
|
*
|
|
1123
1155
|
* @param {string} fileName file name to save.
|
|
1124
1156
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1125
|
-
*
|
|
1157
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1158
|
+
*
|
|
1126
1159
|
*/
|
|
1127
1160
|
// TODO Implement full page screenshots
|
|
1128
1161
|
async saveScreenshot(fileName) {
|
|
@@ -1141,7 +1174,8 @@ class TestCafe extends Helper {
|
|
|
1141
1174
|
* ```
|
|
1142
1175
|
*
|
|
1143
1176
|
* @param {number} sec number of second to wait.
|
|
1144
|
-
*
|
|
1177
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1178
|
+
*
|
|
1145
1179
|
*/
|
|
1146
1180
|
async wait(sec) {
|
|
1147
1181
|
return new Promise(((done) => {
|
|
@@ -1175,7 +1209,7 @@ class TestCafe extends Helper {
|
|
|
1175
1209
|
*
|
|
1176
1210
|
* @param {string|function} fn function to be executed in browser context.
|
|
1177
1211
|
* @param {...any} args to be passed to function.
|
|
1178
|
-
*
|
|
1212
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1179
1213
|
*
|
|
1180
1214
|
*
|
|
1181
1215
|
* If a function returns a Promise It will wait for it resolution.
|
|
@@ -1388,7 +1422,8 @@ class TestCafe extends Helper {
|
|
|
1388
1422
|
* ```js
|
|
1389
1423
|
* I.scrollPageToTop();
|
|
1390
1424
|
* ```
|
|
1391
|
-
*
|
|
1425
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1426
|
+
*
|
|
1392
1427
|
*/
|
|
1393
1428
|
scrollPageToTop() {
|
|
1394
1429
|
return ClientFunction(() => window.scrollTo(0, 0)).with({ boundTestRun: this.t })().catch(mapError);
|
|
@@ -1400,7 +1435,8 @@ class TestCafe extends Helper {
|
|
|
1400
1435
|
* ```js
|
|
1401
1436
|
* I.scrollPageToBottom();
|
|
1402
1437
|
* ```
|
|
1403
|
-
*
|
|
1438
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1439
|
+
*
|
|
1404
1440
|
*/
|
|
1405
1441
|
scrollPageToBottom() {
|
|
1406
1442
|
return ClientFunction(() => {
|
|
@@ -1425,7 +1461,8 @@ class TestCafe extends Helper {
|
|
|
1425
1461
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1426
1462
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1427
1463
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1428
|
-
*
|
|
1464
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1465
|
+
*
|
|
1429
1466
|
*/
|
|
1430
1467
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1431
1468
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1464,7 +1501,8 @@ class TestCafe extends Helper {
|
|
|
1464
1501
|
* ```
|
|
1465
1502
|
*
|
|
1466
1503
|
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1467
|
-
*
|
|
1504
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1505
|
+
*
|
|
1468
1506
|
*/
|
|
1469
1507
|
async switchTo(locator) {
|
|
1470
1508
|
if (Number.isInteger(locator)) {
|
|
@@ -1497,7 +1535,8 @@ class TestCafe extends Helper {
|
|
|
1497
1535
|
* ```
|
|
1498
1536
|
*
|
|
1499
1537
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
1500
|
-
*
|
|
1538
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1539
|
+
*
|
|
1501
1540
|
*/
|
|
1502
1541
|
async setCookie(cookie) {
|
|
1503
1542
|
if (Array.isArray(cookie)) {
|
|
@@ -1522,7 +1561,8 @@ class TestCafe extends Helper {
|
|
|
1522
1561
|
* ```
|
|
1523
1562
|
*
|
|
1524
1563
|
* @param {string} name cookie name.
|
|
1525
|
-
*
|
|
1564
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1565
|
+
*
|
|
1526
1566
|
*
|
|
1527
1567
|
*/
|
|
1528
1568
|
async seeCookie(name) {
|
|
@@ -1538,7 +1578,8 @@ class TestCafe extends Helper {
|
|
|
1538
1578
|
* ```
|
|
1539
1579
|
*
|
|
1540
1580
|
* @param {string} name cookie name.
|
|
1541
|
-
*
|
|
1581
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1582
|
+
*
|
|
1542
1583
|
*/
|
|
1543
1584
|
async dontSeeCookie(name) {
|
|
1544
1585
|
const cookie = await this.grabCookie(name);
|
|
@@ -1588,7 +1629,8 @@ class TestCafe extends Helper {
|
|
|
1588
1629
|
* ```
|
|
1589
1630
|
*
|
|
1590
1631
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
1591
|
-
*
|
|
1632
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1633
|
+
*
|
|
1592
1634
|
*/
|
|
1593
1635
|
async clearCookie(cookieName) {
|
|
1594
1636
|
const clearCookies = ClientFunction(() => {
|
|
@@ -1616,7 +1658,8 @@ class TestCafe extends Helper {
|
|
|
1616
1658
|
*
|
|
1617
1659
|
* @param {string} urlPart value to check.
|
|
1618
1660
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1619
|
-
*
|
|
1661
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1662
|
+
*
|
|
1620
1663
|
*/
|
|
1621
1664
|
async waitInUrl(urlPart, sec = null) {
|
|
1622
1665
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1642,7 +1685,8 @@ class TestCafe extends Helper {
|
|
|
1642
1685
|
*
|
|
1643
1686
|
* @param {string} urlPart value to check.
|
|
1644
1687
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1645
|
-
*
|
|
1688
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1689
|
+
*
|
|
1646
1690
|
*/
|
|
1647
1691
|
async waitUrlEquals(urlPart, sec = null) {
|
|
1648
1692
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1680,7 +1724,8 @@ class TestCafe extends Helper {
|
|
|
1680
1724
|
* @param {string|function} fn to be executed in browser context.
|
|
1681
1725
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
1682
1726
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1683
|
-
*
|
|
1727
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1728
|
+
*
|
|
1684
1729
|
*/
|
|
1685
1730
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
1686
1731
|
let args = [];
|
|
@@ -1708,7 +1753,8 @@ class TestCafe extends Helper {
|
|
|
1708
1753
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1709
1754
|
* @param {number} num number of elements.
|
|
1710
1755
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1711
|
-
*
|
|
1756
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1757
|
+
*
|
|
1712
1758
|
*/
|
|
1713
1759
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
1714
1760
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1730,7 +1776,8 @@ class TestCafe extends Helper {
|
|
|
1730
1776
|
*
|
|
1731
1777
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1732
1778
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1733
|
-
*
|
|
1779
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1780
|
+
*
|
|
1734
1781
|
*/
|
|
1735
1782
|
async waitForElement(locator, sec) {
|
|
1736
1783
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1750,7 +1797,8 @@ class TestCafe extends Helper {
|
|
|
1750
1797
|
*
|
|
1751
1798
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1752
1799
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1753
|
-
*
|
|
1800
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1801
|
+
*
|
|
1754
1802
|
*/
|
|
1755
1803
|
async waitToHide(locator, sec) {
|
|
1756
1804
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1770,7 +1818,8 @@ class TestCafe extends Helper {
|
|
|
1770
1818
|
*
|
|
1771
1819
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1772
1820
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1773
|
-
*
|
|
1821
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1822
|
+
*
|
|
1774
1823
|
*/
|
|
1775
1824
|
async waitForInvisible(locator, sec) {
|
|
1776
1825
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1793,7 +1842,8 @@ class TestCafe extends Helper {
|
|
|
1793
1842
|
* @param {string }text to wait for.
|
|
1794
1843
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1795
1844
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1796
|
-
*
|
|
1845
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1846
|
+
*
|
|
1797
1847
|
*
|
|
1798
1848
|
*/
|
|
1799
1849
|
async waitForText(text, sec = null, context = null) {
|