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/Nightmare.js
CHANGED
|
@@ -35,7 +35,7 @@ let withinStatus = false;
|
|
|
35
35
|
*
|
|
36
36
|
* ## Configuration
|
|
37
37
|
*
|
|
38
|
-
* This helper should be configured in codecept.
|
|
38
|
+
* This helper should be configured in codecept.conf.ts or codecept.conf.js
|
|
39
39
|
*
|
|
40
40
|
* * `url` - base url of website to be tested
|
|
41
41
|
* * `restart` (optional, default: true) - restart browser between tests.
|
|
@@ -434,7 +434,8 @@ class Nightmare extends Helper {
|
|
|
434
434
|
* ```
|
|
435
435
|
*
|
|
436
436
|
* @param {string} text text value to check.
|
|
437
|
-
*
|
|
437
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
438
|
+
*
|
|
438
439
|
*/
|
|
439
440
|
async seeInTitle(text) {
|
|
440
441
|
const title = await this.browser.title();
|
|
@@ -449,7 +450,8 @@ class Nightmare extends Helper {
|
|
|
449
450
|
* ```
|
|
450
451
|
*
|
|
451
452
|
* @param {string} text value to check.
|
|
452
|
-
*
|
|
453
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
454
|
+
*
|
|
453
455
|
*/
|
|
454
456
|
async dontSeeInTitle(text) {
|
|
455
457
|
const title = await this.browser.title();
|
|
@@ -493,7 +495,8 @@ class Nightmare extends Helper {
|
|
|
493
495
|
* ```
|
|
494
496
|
*
|
|
495
497
|
* @param {string} url a fragment to check
|
|
496
|
-
*
|
|
498
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
499
|
+
*
|
|
497
500
|
*/
|
|
498
501
|
async seeInCurrentUrl(url) {
|
|
499
502
|
const currentUrl = await this.browser.url();
|
|
@@ -504,7 +507,8 @@ class Nightmare extends Helper {
|
|
|
504
507
|
* Checks that current url does not contain a provided fragment.
|
|
505
508
|
*
|
|
506
509
|
* @param {string} url value to check.
|
|
507
|
-
*
|
|
510
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
511
|
+
*
|
|
508
512
|
*/
|
|
509
513
|
async dontSeeInCurrentUrl(url) {
|
|
510
514
|
const currentUrl = await this.browser.url();
|
|
@@ -522,7 +526,8 @@ class Nightmare extends Helper {
|
|
|
522
526
|
* ```
|
|
523
527
|
*
|
|
524
528
|
* @param {string} url value to check.
|
|
525
|
-
*
|
|
529
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
530
|
+
*
|
|
526
531
|
*/
|
|
527
532
|
async seeCurrentUrlEquals(url) {
|
|
528
533
|
const currentUrl = await this.browser.url();
|
|
@@ -539,7 +544,8 @@ class Nightmare extends Helper {
|
|
|
539
544
|
* ```
|
|
540
545
|
*
|
|
541
546
|
* @param {string} url value to check.
|
|
542
|
-
*
|
|
547
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
548
|
+
*
|
|
543
549
|
*/
|
|
544
550
|
async dontSeeCurrentUrlEquals(url) {
|
|
545
551
|
const currentUrl = await this.browser.url();
|
|
@@ -557,7 +563,8 @@ class Nightmare extends Helper {
|
|
|
557
563
|
* ```
|
|
558
564
|
* @param {string} text expected on page.
|
|
559
565
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
560
|
-
*
|
|
566
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
567
|
+
*
|
|
561
568
|
*/
|
|
562
569
|
async see(text, context = null) {
|
|
563
570
|
return proceedSee.call(this, 'assert', text, context);
|
|
@@ -574,7 +581,8 @@ class Nightmare extends Helper {
|
|
|
574
581
|
*
|
|
575
582
|
* @param {string} text which is not present.
|
|
576
583
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
577
|
-
*
|
|
584
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
585
|
+
*
|
|
578
586
|
*/
|
|
579
587
|
dontSee(text, context = null) {
|
|
580
588
|
return proceedSee.call(this, 'negate', text, context);
|
|
@@ -588,7 +596,8 @@ class Nightmare extends Helper {
|
|
|
588
596
|
* I.seeElement('#modal');
|
|
589
597
|
* ```
|
|
590
598
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
591
|
-
*
|
|
599
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
600
|
+
*
|
|
592
601
|
*/
|
|
593
602
|
async seeElement(locator) {
|
|
594
603
|
locator = new Locator(locator, 'css');
|
|
@@ -606,7 +615,8 @@ class Nightmare extends Helper {
|
|
|
606
615
|
* ```
|
|
607
616
|
*
|
|
608
617
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
609
|
-
*
|
|
618
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
619
|
+
*
|
|
610
620
|
*/
|
|
611
621
|
async dontSeeElement(locator) {
|
|
612
622
|
locator = new Locator(locator, 'css');
|
|
@@ -625,7 +635,8 @@ class Nightmare extends Helper {
|
|
|
625
635
|
* I.seeElementInDOM('#modal');
|
|
626
636
|
* ```
|
|
627
637
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
628
|
-
*
|
|
638
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
639
|
+
*
|
|
629
640
|
*/
|
|
630
641
|
async seeElementInDOM(locator) {
|
|
631
642
|
locator = new Locator(locator, 'css');
|
|
@@ -641,7 +652,8 @@ class Nightmare extends Helper {
|
|
|
641
652
|
* ```
|
|
642
653
|
*
|
|
643
654
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
644
|
-
*
|
|
655
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
656
|
+
*
|
|
645
657
|
*/
|
|
646
658
|
async dontSeeElementInDOM(locator) {
|
|
647
659
|
locator = new Locator(locator, 'css');
|
|
@@ -656,7 +668,8 @@ class Nightmare extends Helper {
|
|
|
656
668
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
657
669
|
* ```
|
|
658
670
|
* @param {string} text value to check.
|
|
659
|
-
*
|
|
671
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
672
|
+
*
|
|
660
673
|
*/
|
|
661
674
|
async seeInSource(text) {
|
|
662
675
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -671,7 +684,8 @@ class Nightmare extends Helper {
|
|
|
671
684
|
* ```
|
|
672
685
|
*
|
|
673
686
|
* @param {string} value to check.
|
|
674
|
-
*
|
|
687
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
688
|
+
*
|
|
675
689
|
*/
|
|
676
690
|
async dontSeeInSource(text) {
|
|
677
691
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -689,7 +703,8 @@ class Nightmare extends Helper {
|
|
|
689
703
|
*
|
|
690
704
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
691
705
|
* @param {number} num number of elements.
|
|
692
|
-
*
|
|
706
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
707
|
+
*
|
|
693
708
|
*/
|
|
694
709
|
async seeNumberOfElements(locator, num) {
|
|
695
710
|
const elements = await this._locate(locator);
|
|
@@ -706,7 +721,8 @@ class Nightmare extends Helper {
|
|
|
706
721
|
*
|
|
707
722
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
708
723
|
* @param {number} num number of elements.
|
|
709
|
-
*
|
|
724
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
725
|
+
*
|
|
710
726
|
*/
|
|
711
727
|
async seeNumberOfVisibleElements(locator, num) {
|
|
712
728
|
const res = await this.grabNumberOfVisibleElements(locator);
|
|
@@ -760,7 +776,7 @@ class Nightmare extends Helper {
|
|
|
760
776
|
*
|
|
761
777
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
762
778
|
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
763
|
-
*
|
|
779
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
764
780
|
*
|
|
765
781
|
*/
|
|
766
782
|
async click(locator, context = null) {
|
|
@@ -783,7 +799,8 @@ class Nightmare extends Helper {
|
|
|
783
799
|
*
|
|
784
800
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
785
801
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
786
|
-
*
|
|
802
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
803
|
+
*
|
|
787
804
|
*/
|
|
788
805
|
async doubleClick(locator, context = null) {
|
|
789
806
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -806,7 +823,8 @@ class Nightmare extends Helper {
|
|
|
806
823
|
*
|
|
807
824
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
808
825
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
809
|
-
*
|
|
826
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
827
|
+
*
|
|
810
828
|
*/
|
|
811
829
|
async rightClick(locator, context = null) {
|
|
812
830
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -827,7 +845,8 @@ class Nightmare extends Helper {
|
|
|
827
845
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
828
846
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
829
847
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
830
|
-
*
|
|
848
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
849
|
+
*
|
|
831
850
|
*/
|
|
832
851
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
833
852
|
locator = new Locator(locator, 'css');
|
|
@@ -863,7 +882,7 @@ class Nightmare extends Helper {
|
|
|
863
882
|
*
|
|
864
883
|
* @param {string|function} fn function to be executed in browser context.
|
|
865
884
|
* @param {...any} args to be passed to function.
|
|
866
|
-
*
|
|
885
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
867
886
|
*
|
|
868
887
|
*
|
|
869
888
|
* Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
|
|
@@ -897,7 +916,7 @@ class Nightmare extends Helper {
|
|
|
897
916
|
*
|
|
898
917
|
* @param {string|function} fn function to be executed in browser context.
|
|
899
918
|
* @param {...any} args to be passed to function.
|
|
900
|
-
*
|
|
919
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
901
920
|
*
|
|
902
921
|
*
|
|
903
922
|
* Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
|
|
@@ -914,7 +933,8 @@ class Nightmare extends Helper {
|
|
|
914
933
|
*
|
|
915
934
|
* @param {number} width width in pixels or `maximize`.
|
|
916
935
|
* @param {number} height height in pixels.
|
|
917
|
-
*
|
|
936
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
937
|
+
*
|
|
918
938
|
*/
|
|
919
939
|
async resizeWindow(width, height) {
|
|
920
940
|
if (width === 'maximize') {
|
|
@@ -936,7 +956,8 @@ class Nightmare extends Helper {
|
|
|
936
956
|
* ```
|
|
937
957
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
938
958
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
939
|
-
*
|
|
959
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
960
|
+
*
|
|
940
961
|
*/
|
|
941
962
|
async checkOption(field, context = null) {
|
|
942
963
|
const els = await findCheckable.call(this, field, context);
|
|
@@ -958,7 +979,8 @@ class Nightmare extends Helper {
|
|
|
958
979
|
* ```
|
|
959
980
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
960
981
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
961
|
-
*
|
|
982
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
983
|
+
*
|
|
962
984
|
*/
|
|
963
985
|
async uncheckOption(field, context = null) {
|
|
964
986
|
const els = await findCheckable.call(this, field, context);
|
|
@@ -983,7 +1005,8 @@ class Nightmare extends Helper {
|
|
|
983
1005
|
* ```
|
|
984
1006
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
985
1007
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
986
|
-
*
|
|
1008
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1009
|
+
*
|
|
987
1010
|
*/
|
|
988
1011
|
async fillField(field, value) {
|
|
989
1012
|
const el = await findField.call(this, field);
|
|
@@ -1001,7 +1024,8 @@ class Nightmare extends Helper {
|
|
|
1001
1024
|
* I.clearField('#email');
|
|
1002
1025
|
* ```
|
|
1003
1026
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1004
|
-
*
|
|
1027
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder.
|
|
1028
|
+
*
|
|
1005
1029
|
*/
|
|
1006
1030
|
async clearField(field) {
|
|
1007
1031
|
return this.fillField(field, '');
|
|
@@ -1016,7 +1040,8 @@ class Nightmare extends Helper {
|
|
|
1016
1040
|
* ```
|
|
1017
1041
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1018
1042
|
* @param {string} value text value to append.
|
|
1019
|
-
*
|
|
1043
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1044
|
+
*
|
|
1020
1045
|
*/
|
|
1021
1046
|
async appendField(field, value) {
|
|
1022
1047
|
const el = await findField.call(this, field);
|
|
@@ -1037,7 +1062,8 @@ class Nightmare extends Helper {
|
|
|
1037
1062
|
* ```
|
|
1038
1063
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1039
1064
|
* @param {string} value value to check.
|
|
1040
|
-
*
|
|
1065
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1066
|
+
*
|
|
1041
1067
|
*/
|
|
1042
1068
|
async seeInField(field, value) {
|
|
1043
1069
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
@@ -1054,7 +1080,8 @@ class Nightmare extends Helper {
|
|
|
1054
1080
|
*
|
|
1055
1081
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1056
1082
|
* @param {string} value value to check.
|
|
1057
|
-
*
|
|
1083
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1084
|
+
*
|
|
1058
1085
|
*/
|
|
1059
1086
|
async dontSeeInField(field, value) {
|
|
1060
1087
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -1098,7 +1125,8 @@ class Nightmare extends Helper {
|
|
|
1098
1125
|
* ```
|
|
1099
1126
|
*
|
|
1100
1127
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1101
|
-
*
|
|
1128
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1129
|
+
*
|
|
1102
1130
|
*/
|
|
1103
1131
|
async seeCheckboxIsChecked(field) {
|
|
1104
1132
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -1114,7 +1142,8 @@ class Nightmare extends Helper {
|
|
|
1114
1142
|
* ```
|
|
1115
1143
|
*
|
|
1116
1144
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1117
|
-
*
|
|
1145
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1146
|
+
*
|
|
1118
1147
|
*/
|
|
1119
1148
|
async dontSeeCheckboxIsChecked(field) {
|
|
1120
1149
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -1122,7 +1151,7 @@ class Nightmare extends Helper {
|
|
|
1122
1151
|
|
|
1123
1152
|
/**
|
|
1124
1153
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
1125
|
-
* Path to file is relative current codecept directory (where codecept.
|
|
1154
|
+
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
1126
1155
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
1127
1156
|
*
|
|
1128
1157
|
* ```js
|
|
@@ -1131,8 +1160,9 @@ class Nightmare extends Helper {
|
|
|
1131
1160
|
* ```
|
|
1132
1161
|
*
|
|
1133
1162
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1134
|
-
* @param {string} pathToFile local file path relative to codecept.
|
|
1135
|
-
*
|
|
1163
|
+
* @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
1164
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1165
|
+
*
|
|
1136
1166
|
*
|
|
1137
1167
|
* Doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more](https://github.com/rosshinkley/nightmare-upload#important-note-about-setting-file-upload-inputs))
|
|
1138
1168
|
*/
|
|
@@ -1406,7 +1436,8 @@ class Nightmare extends Helper {
|
|
|
1406
1436
|
* ```
|
|
1407
1437
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1408
1438
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1409
|
-
*
|
|
1439
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1440
|
+
*
|
|
1410
1441
|
*/
|
|
1411
1442
|
async selectOption(select, option) {
|
|
1412
1443
|
const fetchAndCheckOption = function (el, locator) {
|
|
@@ -1463,7 +1494,8 @@ class Nightmare extends Helper {
|
|
|
1463
1494
|
* ```
|
|
1464
1495
|
*
|
|
1465
1496
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
1466
|
-
*
|
|
1497
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1498
|
+
*
|
|
1467
1499
|
*
|
|
1468
1500
|
* Wrapper for `.cookies.set(cookie)`.
|
|
1469
1501
|
* [See more](https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie)
|
|
@@ -1480,7 +1512,8 @@ class Nightmare extends Helper {
|
|
|
1480
1512
|
* ```
|
|
1481
1513
|
*
|
|
1482
1514
|
* @param {string} name cookie name.
|
|
1483
|
-
*
|
|
1515
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1516
|
+
*
|
|
1484
1517
|
*
|
|
1485
1518
|
*/
|
|
1486
1519
|
async seeCookie(name) {
|
|
@@ -1496,7 +1529,8 @@ class Nightmare extends Helper {
|
|
|
1496
1529
|
* ```
|
|
1497
1530
|
*
|
|
1498
1531
|
* @param {string} name cookie name.
|
|
1499
|
-
*
|
|
1532
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1533
|
+
*
|
|
1500
1534
|
*/
|
|
1501
1535
|
async dontSeeCookie(name) {
|
|
1502
1536
|
const res = await this.browser.cookies.get(name);
|
|
@@ -1535,7 +1569,8 @@ class Nightmare extends Helper {
|
|
|
1535
1569
|
* ```
|
|
1536
1570
|
*
|
|
1537
1571
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
1538
|
-
*
|
|
1572
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1573
|
+
*
|
|
1539
1574
|
*/
|
|
1540
1575
|
async clearCookie(cookie) {
|
|
1541
1576
|
if (!cookie) {
|
|
@@ -1561,7 +1596,8 @@ class Nightmare extends Helper {
|
|
|
1561
1596
|
* @param {string|function} fn to be executed in browser context.
|
|
1562
1597
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
1563
1598
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1564
|
-
*
|
|
1599
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1600
|
+
*
|
|
1565
1601
|
*/
|
|
1566
1602
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
1567
1603
|
let args = [];
|
|
@@ -1584,7 +1620,8 @@ class Nightmare extends Helper {
|
|
|
1584
1620
|
* ```
|
|
1585
1621
|
*
|
|
1586
1622
|
* @param {number} sec number of second to wait.
|
|
1587
|
-
*
|
|
1623
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1624
|
+
*
|
|
1588
1625
|
*/
|
|
1589
1626
|
async wait(sec) {
|
|
1590
1627
|
return new Promise(((done) => {
|
|
@@ -1605,7 +1642,8 @@ class Nightmare extends Helper {
|
|
|
1605
1642
|
* @param {string }text to wait for.
|
|
1606
1643
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1607
1644
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1608
|
-
*
|
|
1645
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1646
|
+
*
|
|
1609
1647
|
*/
|
|
1610
1648
|
async waitForText(text, sec, context = null) {
|
|
1611
1649
|
if (!context) {
|
|
@@ -1634,7 +1672,8 @@ class Nightmare extends Helper {
|
|
|
1634
1672
|
*
|
|
1635
1673
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1636
1674
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1637
|
-
*
|
|
1675
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1676
|
+
*
|
|
1638
1677
|
*/
|
|
1639
1678
|
waitForVisible(locator, sec) {
|
|
1640
1679
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1661,7 +1700,8 @@ class Nightmare extends Helper {
|
|
|
1661
1700
|
*
|
|
1662
1701
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1663
1702
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1664
|
-
*
|
|
1703
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1704
|
+
*
|
|
1665
1705
|
*/
|
|
1666
1706
|
async waitToHide(locator, sec = null) {
|
|
1667
1707
|
return this.waitForInvisible(locator, sec);
|
|
@@ -1677,7 +1717,8 @@ class Nightmare extends Helper {
|
|
|
1677
1717
|
*
|
|
1678
1718
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1679
1719
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1680
|
-
*
|
|
1720
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1721
|
+
*
|
|
1681
1722
|
*/
|
|
1682
1723
|
waitForInvisible(locator, sec) {
|
|
1683
1724
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1705,7 +1746,8 @@ class Nightmare extends Helper {
|
|
|
1705
1746
|
*
|
|
1706
1747
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1707
1748
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1708
|
-
*
|
|
1749
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1750
|
+
*
|
|
1709
1751
|
*/
|
|
1710
1752
|
async waitForElement(locator, sec) {
|
|
1711
1753
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1735,7 +1777,8 @@ class Nightmare extends Helper {
|
|
|
1735
1777
|
*
|
|
1736
1778
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1737
1779
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1738
|
-
*
|
|
1780
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1781
|
+
*
|
|
1739
1782
|
*/
|
|
1740
1783
|
async waitForDetached(locator, sec) {
|
|
1741
1784
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1755,7 +1798,8 @@ class Nightmare extends Helper {
|
|
|
1755
1798
|
* ```js
|
|
1756
1799
|
* I.refreshPage();
|
|
1757
1800
|
* ```
|
|
1758
|
-
*
|
|
1801
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1802
|
+
*
|
|
1759
1803
|
*/
|
|
1760
1804
|
async refreshPage() {
|
|
1761
1805
|
return this.browser.refresh();
|
|
@@ -1770,7 +1814,7 @@ class Nightmare extends Helper {
|
|
|
1770
1814
|
}
|
|
1771
1815
|
|
|
1772
1816
|
/**
|
|
1773
|
-
* Saves screenshot of the specified locator to ouput folder (set in codecept.
|
|
1817
|
+
* Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1774
1818
|
* Filename is relative to output folder.
|
|
1775
1819
|
*
|
|
1776
1820
|
* ```js
|
|
@@ -1779,7 +1823,8 @@ class Nightmare extends Helper {
|
|
|
1779
1823
|
*
|
|
1780
1824
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1781
1825
|
* @param {string} fileName file name to save.
|
|
1782
|
-
*
|
|
1826
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1827
|
+
*
|
|
1783
1828
|
*
|
|
1784
1829
|
*/
|
|
1785
1830
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -1848,7 +1893,7 @@ class Nightmare extends Helper {
|
|
|
1848
1893
|
}
|
|
1849
1894
|
|
|
1850
1895
|
/**
|
|
1851
|
-
* Saves a screenshot to ouput folder (set in codecept.
|
|
1896
|
+
* Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1852
1897
|
* Filename is relative to output folder.
|
|
1853
1898
|
* 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.
|
|
1854
1899
|
*
|
|
@@ -1859,7 +1904,8 @@ class Nightmare extends Helper {
|
|
|
1859
1904
|
*
|
|
1860
1905
|
* @param {string} fileName file name to save.
|
|
1861
1906
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1862
|
-
*
|
|
1907
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1908
|
+
*
|
|
1863
1909
|
*/
|
|
1864
1910
|
async saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) {
|
|
1865
1911
|
const outputFile = screenshotOutputFolder(fileName);
|
|
@@ -1892,7 +1938,8 @@ class Nightmare extends Helper {
|
|
|
1892
1938
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1893
1939
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1894
1940
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1895
|
-
*
|
|
1941
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1942
|
+
*
|
|
1896
1943
|
*/
|
|
1897
1944
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1898
1945
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1919,7 +1966,8 @@ class Nightmare extends Helper {
|
|
|
1919
1966
|
* ```js
|
|
1920
1967
|
* I.scrollPageToTop();
|
|
1921
1968
|
* ```
|
|
1922
|
-
*
|
|
1969
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1970
|
+
*
|
|
1923
1971
|
*/
|
|
1924
1972
|
async scrollPageToTop() {
|
|
1925
1973
|
return this.executeScript(() => window.scrollTo(0, 0));
|
|
@@ -1931,7 +1979,8 @@ class Nightmare extends Helper {
|
|
|
1931
1979
|
* ```js
|
|
1932
1980
|
* I.scrollPageToBottom();
|
|
1933
1981
|
* ```
|
|
1934
|
-
*
|
|
1982
|
+
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1983
|
+
*
|
|
1935
1984
|
*/
|
|
1936
1985
|
async scrollPageToBottom() {
|
|
1937
1986
|
/* eslint-disable prefer-arrow-callback, comma-dangle */
|