codeceptjs 3.3.0 → 3.3.3
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 +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +21 -16
- 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 +54 -25
- package/docs/build/Playwright.js +105 -52
- package/docs/build/Protractor.js +72 -34
- package/docs/build/Puppeteer.js +80 -37
- package/docs/build/REST.js +5 -2
- package/docs/build/TestCafe.js +54 -23
- package/docs/build/WebDriver.js +115 -67
- package/docs/changelog.md +50 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- 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/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/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/cli.js +1 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run-workers.js +1 -1
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +55 -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/output.js +4 -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 +534 -112
package/docs/build/Nightmare.js
CHANGED
|
@@ -406,6 +406,7 @@ class Nightmare extends Helper {
|
|
|
406
406
|
* ```
|
|
407
407
|
*
|
|
408
408
|
* @param {string} url url path or global url.
|
|
409
|
+
* @return {void} automatically synchronized promise with recorder #!
|
|
409
410
|
* @param {?object} headers list of request headers can be passed
|
|
410
411
|
*
|
|
411
412
|
*/
|
|
@@ -433,6 +434,7 @@ class Nightmare extends Helper {
|
|
|
433
434
|
* ```
|
|
434
435
|
*
|
|
435
436
|
* @param {string} text text value to check.
|
|
437
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
436
438
|
*/
|
|
437
439
|
async seeInTitle(text) {
|
|
438
440
|
const title = await this.browser.title();
|
|
@@ -447,6 +449,7 @@ class Nightmare extends Helper {
|
|
|
447
449
|
* ```
|
|
448
450
|
*
|
|
449
451
|
* @param {string} text value to check.
|
|
452
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
450
453
|
*/
|
|
451
454
|
async dontSeeInTitle(text) {
|
|
452
455
|
const title = await this.browser.title();
|
|
@@ -490,6 +493,7 @@ class Nightmare extends Helper {
|
|
|
490
493
|
* ```
|
|
491
494
|
*
|
|
492
495
|
* @param {string} url a fragment to check
|
|
496
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
493
497
|
*/
|
|
494
498
|
async seeInCurrentUrl(url) {
|
|
495
499
|
const currentUrl = await this.browser.url();
|
|
@@ -500,6 +504,7 @@ class Nightmare extends Helper {
|
|
|
500
504
|
* Checks that current url does not contain a provided fragment.
|
|
501
505
|
*
|
|
502
506
|
* @param {string} url value to check.
|
|
507
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
503
508
|
*/
|
|
504
509
|
async dontSeeInCurrentUrl(url) {
|
|
505
510
|
const currentUrl = await this.browser.url();
|
|
@@ -517,6 +522,7 @@ class Nightmare extends Helper {
|
|
|
517
522
|
* ```
|
|
518
523
|
*
|
|
519
524
|
* @param {string} url value to check.
|
|
525
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
520
526
|
*/
|
|
521
527
|
async seeCurrentUrlEquals(url) {
|
|
522
528
|
const currentUrl = await this.browser.url();
|
|
@@ -533,6 +539,7 @@ class Nightmare extends Helper {
|
|
|
533
539
|
* ```
|
|
534
540
|
*
|
|
535
541
|
* @param {string} url value to check.
|
|
542
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
536
543
|
*/
|
|
537
544
|
async dontSeeCurrentUrlEquals(url) {
|
|
538
545
|
const currentUrl = await this.browser.url();
|
|
@@ -550,6 +557,7 @@ class Nightmare extends Helper {
|
|
|
550
557
|
* ```
|
|
551
558
|
* @param {string} text expected on page.
|
|
552
559
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
560
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
553
561
|
*/
|
|
554
562
|
async see(text, context = null) {
|
|
555
563
|
return proceedSee.call(this, 'assert', text, context);
|
|
@@ -566,7 +574,7 @@ class Nightmare extends Helper {
|
|
|
566
574
|
*
|
|
567
575
|
* @param {string} text which is not present.
|
|
568
576
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
569
|
-
*
|
|
577
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
570
578
|
*/
|
|
571
579
|
dontSee(text, context = null) {
|
|
572
580
|
return proceedSee.call(this, 'negate', text, context);
|
|
@@ -580,6 +588,7 @@ class Nightmare extends Helper {
|
|
|
580
588
|
* I.seeElement('#modal');
|
|
581
589
|
* ```
|
|
582
590
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
591
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
583
592
|
*/
|
|
584
593
|
async seeElement(locator) {
|
|
585
594
|
locator = new Locator(locator, 'css');
|
|
@@ -597,6 +606,7 @@ class Nightmare extends Helper {
|
|
|
597
606
|
* ```
|
|
598
607
|
*
|
|
599
608
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
609
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
600
610
|
*/
|
|
601
611
|
async dontSeeElement(locator) {
|
|
602
612
|
locator = new Locator(locator, 'css');
|
|
@@ -615,7 +625,7 @@ class Nightmare extends Helper {
|
|
|
615
625
|
* I.seeElementInDOM('#modal');
|
|
616
626
|
* ```
|
|
617
627
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
618
|
-
*
|
|
628
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
619
629
|
*/
|
|
620
630
|
async seeElementInDOM(locator) {
|
|
621
631
|
locator = new Locator(locator, 'css');
|
|
@@ -631,6 +641,7 @@ class Nightmare extends Helper {
|
|
|
631
641
|
* ```
|
|
632
642
|
*
|
|
633
643
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
644
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
634
645
|
*/
|
|
635
646
|
async dontSeeElementInDOM(locator) {
|
|
636
647
|
locator = new Locator(locator, 'css');
|
|
@@ -645,6 +656,7 @@ class Nightmare extends Helper {
|
|
|
645
656
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
646
657
|
* ```
|
|
647
658
|
* @param {string} text value to check.
|
|
659
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
648
660
|
*/
|
|
649
661
|
async seeInSource(text) {
|
|
650
662
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -659,7 +671,7 @@ class Nightmare extends Helper {
|
|
|
659
671
|
* ```
|
|
660
672
|
*
|
|
661
673
|
* @param {string} value to check.
|
|
662
|
-
*
|
|
674
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
663
675
|
*/
|
|
664
676
|
async dontSeeInSource(text) {
|
|
665
677
|
const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
|
|
@@ -677,7 +689,7 @@ class Nightmare extends Helper {
|
|
|
677
689
|
*
|
|
678
690
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
679
691
|
* @param {number} num number of elements.
|
|
680
|
-
*
|
|
692
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
681
693
|
*/
|
|
682
694
|
async seeNumberOfElements(locator, num) {
|
|
683
695
|
const elements = await this._locate(locator);
|
|
@@ -694,7 +706,7 @@ class Nightmare extends Helper {
|
|
|
694
706
|
*
|
|
695
707
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
696
708
|
* @param {number} num number of elements.
|
|
697
|
-
*
|
|
709
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
698
710
|
*/
|
|
699
711
|
async seeNumberOfVisibleElements(locator, num) {
|
|
700
712
|
const res = await this.grabNumberOfVisibleElements(locator);
|
|
@@ -747,7 +759,8 @@ class Nightmare extends Helper {
|
|
|
747
759
|
* ```
|
|
748
760
|
*
|
|
749
761
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
750
|
-
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
762
|
+
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
763
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
751
764
|
*
|
|
752
765
|
*/
|
|
753
766
|
async click(locator, context = null) {
|
|
@@ -770,7 +783,7 @@ class Nightmare extends Helper {
|
|
|
770
783
|
*
|
|
771
784
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
772
785
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
773
|
-
*
|
|
786
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
774
787
|
*/
|
|
775
788
|
async doubleClick(locator, context = null) {
|
|
776
789
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -793,7 +806,7 @@ class Nightmare extends Helper {
|
|
|
793
806
|
*
|
|
794
807
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
795
808
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
796
|
-
*
|
|
809
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
797
810
|
*/
|
|
798
811
|
async rightClick(locator, context = null) {
|
|
799
812
|
const el = await findClickable.call(this, locator, context);
|
|
@@ -814,7 +827,7 @@ class Nightmare extends Helper {
|
|
|
814
827
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
815
828
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
816
829
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
817
|
-
*
|
|
830
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
818
831
|
*/
|
|
819
832
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
820
833
|
locator = new Locator(locator, 'css');
|
|
@@ -850,7 +863,7 @@ class Nightmare extends Helper {
|
|
|
850
863
|
*
|
|
851
864
|
* @param {string|function} fn function to be executed in browser context.
|
|
852
865
|
* @param {...any} args to be passed to function.
|
|
853
|
-
*
|
|
866
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
854
867
|
*
|
|
855
868
|
*
|
|
856
869
|
* Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
|
|
@@ -884,7 +897,7 @@ class Nightmare extends Helper {
|
|
|
884
897
|
*
|
|
885
898
|
* @param {string|function} fn function to be executed in browser context.
|
|
886
899
|
* @param {...any} args to be passed to function.
|
|
887
|
-
*
|
|
900
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
888
901
|
*
|
|
889
902
|
*
|
|
890
903
|
* Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
|
|
@@ -901,6 +914,7 @@ class Nightmare extends Helper {
|
|
|
901
914
|
*
|
|
902
915
|
* @param {number} width width in pixels or `maximize`.
|
|
903
916
|
* @param {number} height height in pixels.
|
|
917
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
904
918
|
*/
|
|
905
919
|
async resizeWindow(width, height) {
|
|
906
920
|
if (width === 'maximize') {
|
|
@@ -922,6 +936,7 @@ class Nightmare extends Helper {
|
|
|
922
936
|
* ```
|
|
923
937
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
924
938
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
939
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
925
940
|
*/
|
|
926
941
|
async checkOption(field, context = null) {
|
|
927
942
|
const els = await findCheckable.call(this, field, context);
|
|
@@ -943,6 +958,7 @@ class Nightmare extends Helper {
|
|
|
943
958
|
* ```
|
|
944
959
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
945
960
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
961
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
946
962
|
*/
|
|
947
963
|
async uncheckOption(field, context = null) {
|
|
948
964
|
const els = await findCheckable.call(this, field, context);
|
|
@@ -967,7 +983,7 @@ class Nightmare extends Helper {
|
|
|
967
983
|
* ```
|
|
968
984
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
969
985
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
970
|
-
*
|
|
986
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
971
987
|
*/
|
|
972
988
|
async fillField(field, value) {
|
|
973
989
|
const el = await findField.call(this, field);
|
|
@@ -985,7 +1001,7 @@ class Nightmare extends Helper {
|
|
|
985
1001
|
* I.clearField('#email');
|
|
986
1002
|
* ```
|
|
987
1003
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
988
|
-
*
|
|
1004
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
989
1005
|
*/
|
|
990
1006
|
async clearField(field) {
|
|
991
1007
|
return this.fillField(field, '');
|
|
@@ -1000,6 +1016,7 @@ class Nightmare extends Helper {
|
|
|
1000
1016
|
* ```
|
|
1001
1017
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1002
1018
|
* @param {string} value text value to append.
|
|
1019
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1003
1020
|
*/
|
|
1004
1021
|
async appendField(field, value) {
|
|
1005
1022
|
const el = await findField.call(this, field);
|
|
@@ -1020,7 +1037,7 @@ class Nightmare extends Helper {
|
|
|
1020
1037
|
* ```
|
|
1021
1038
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1022
1039
|
* @param {string} value value to check.
|
|
1023
|
-
*
|
|
1040
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1024
1041
|
*/
|
|
1025
1042
|
async seeInField(field, value) {
|
|
1026
1043
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
@@ -1037,6 +1054,7 @@ class Nightmare extends Helper {
|
|
|
1037
1054
|
*
|
|
1038
1055
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1039
1056
|
* @param {string} value value to check.
|
|
1057
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1040
1058
|
*/
|
|
1041
1059
|
async dontSeeInField(field, value) {
|
|
1042
1060
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -1080,7 +1098,7 @@ class Nightmare extends Helper {
|
|
|
1080
1098
|
* ```
|
|
1081
1099
|
*
|
|
1082
1100
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1083
|
-
*
|
|
1101
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1084
1102
|
*/
|
|
1085
1103
|
async seeCheckboxIsChecked(field) {
|
|
1086
1104
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -1096,7 +1114,7 @@ class Nightmare extends Helper {
|
|
|
1096
1114
|
* ```
|
|
1097
1115
|
*
|
|
1098
1116
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1099
|
-
*
|
|
1117
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1100
1118
|
*/
|
|
1101
1119
|
async dontSeeCheckboxIsChecked(field) {
|
|
1102
1120
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -1114,6 +1132,7 @@ class Nightmare extends Helper {
|
|
|
1114
1132
|
*
|
|
1115
1133
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1116
1134
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
1135
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1117
1136
|
*
|
|
1118
1137
|
* 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))
|
|
1119
1138
|
*/
|
|
@@ -1387,7 +1406,7 @@ class Nightmare extends Helper {
|
|
|
1387
1406
|
* ```
|
|
1388
1407
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1389
1408
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1390
|
-
*
|
|
1409
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1391
1410
|
*/
|
|
1392
1411
|
async selectOption(select, option) {
|
|
1393
1412
|
const fetchAndCheckOption = function (el, locator) {
|
|
@@ -1444,7 +1463,7 @@ class Nightmare extends Helper {
|
|
|
1444
1463
|
* ```
|
|
1445
1464
|
*
|
|
1446
1465
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
1447
|
-
*
|
|
1466
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1448
1467
|
*
|
|
1449
1468
|
* Wrapper for `.cookies.set(cookie)`.
|
|
1450
1469
|
* [See more](https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie)
|
|
@@ -1461,7 +1480,7 @@ class Nightmare extends Helper {
|
|
|
1461
1480
|
* ```
|
|
1462
1481
|
*
|
|
1463
1482
|
* @param {string} name cookie name.
|
|
1464
|
-
*
|
|
1483
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1465
1484
|
*
|
|
1466
1485
|
*/
|
|
1467
1486
|
async seeCookie(name) {
|
|
@@ -1477,6 +1496,7 @@ class Nightmare extends Helper {
|
|
|
1477
1496
|
* ```
|
|
1478
1497
|
*
|
|
1479
1498
|
* @param {string} name cookie name.
|
|
1499
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1480
1500
|
*/
|
|
1481
1501
|
async dontSeeCookie(name) {
|
|
1482
1502
|
const res = await this.browser.cookies.get(name);
|
|
@@ -1515,6 +1535,7 @@ class Nightmare extends Helper {
|
|
|
1515
1535
|
* ```
|
|
1516
1536
|
*
|
|
1517
1537
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
1538
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1518
1539
|
*/
|
|
1519
1540
|
async clearCookie(cookie) {
|
|
1520
1541
|
if (!cookie) {
|
|
@@ -1540,7 +1561,7 @@ class Nightmare extends Helper {
|
|
|
1540
1561
|
* @param {string|function} fn to be executed in browser context.
|
|
1541
1562
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
1542
1563
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1543
|
-
*
|
|
1564
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1544
1565
|
*/
|
|
1545
1566
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
1546
1567
|
let args = [];
|
|
@@ -1563,6 +1584,7 @@ class Nightmare extends Helper {
|
|
|
1563
1584
|
* ```
|
|
1564
1585
|
*
|
|
1565
1586
|
* @param {number} sec number of second to wait.
|
|
1587
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1566
1588
|
*/
|
|
1567
1589
|
async wait(sec) {
|
|
1568
1590
|
return new Promise(((done) => {
|
|
@@ -1583,6 +1605,7 @@ class Nightmare extends Helper {
|
|
|
1583
1605
|
* @param {string }text to wait for.
|
|
1584
1606
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1585
1607
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
1608
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1586
1609
|
*/
|
|
1587
1610
|
async waitForText(text, sec, context = null) {
|
|
1588
1611
|
if (!context) {
|
|
@@ -1611,7 +1634,7 @@ class Nightmare extends Helper {
|
|
|
1611
1634
|
*
|
|
1612
1635
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1613
1636
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1614
|
-
*
|
|
1637
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1615
1638
|
*/
|
|
1616
1639
|
waitForVisible(locator, sec) {
|
|
1617
1640
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1638,6 +1661,7 @@ class Nightmare extends Helper {
|
|
|
1638
1661
|
*
|
|
1639
1662
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1640
1663
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1664
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1641
1665
|
*/
|
|
1642
1666
|
async waitToHide(locator, sec = null) {
|
|
1643
1667
|
return this.waitForInvisible(locator, sec);
|
|
@@ -1653,6 +1677,7 @@ class Nightmare extends Helper {
|
|
|
1653
1677
|
*
|
|
1654
1678
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1655
1679
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1680
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1656
1681
|
*/
|
|
1657
1682
|
waitForInvisible(locator, sec) {
|
|
1658
1683
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1680,6 +1705,7 @@ class Nightmare extends Helper {
|
|
|
1680
1705
|
*
|
|
1681
1706
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1682
1707
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
1708
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1683
1709
|
*/
|
|
1684
1710
|
async waitForElement(locator, sec) {
|
|
1685
1711
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1709,6 +1735,7 @@ class Nightmare extends Helper {
|
|
|
1709
1735
|
*
|
|
1710
1736
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1711
1737
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
1738
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1712
1739
|
*/
|
|
1713
1740
|
async waitForDetached(locator, sec) {
|
|
1714
1741
|
this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -1728,7 +1755,7 @@ class Nightmare extends Helper {
|
|
|
1728
1755
|
* ```js
|
|
1729
1756
|
* I.refreshPage();
|
|
1730
1757
|
* ```
|
|
1731
|
-
*
|
|
1758
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1732
1759
|
*/
|
|
1733
1760
|
async refreshPage() {
|
|
1734
1761
|
return this.browser.refresh();
|
|
@@ -1752,7 +1779,7 @@ class Nightmare extends Helper {
|
|
|
1752
1779
|
*
|
|
1753
1780
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1754
1781
|
* @param {string} fileName file name to save.
|
|
1755
|
-
*
|
|
1782
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1756
1783
|
*
|
|
1757
1784
|
*/
|
|
1758
1785
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -1832,6 +1859,7 @@ class Nightmare extends Helper {
|
|
|
1832
1859
|
*
|
|
1833
1860
|
* @param {string} fileName file name to save.
|
|
1834
1861
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1862
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1835
1863
|
*/
|
|
1836
1864
|
async saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) {
|
|
1837
1865
|
const outputFile = screenshotOutputFolder(fileName);
|
|
@@ -1864,6 +1892,7 @@ class Nightmare extends Helper {
|
|
|
1864
1892
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1865
1893
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
1866
1894
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
1895
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1867
1896
|
*/
|
|
1868
1897
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
1869
1898
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1890,7 +1919,7 @@ class Nightmare extends Helper {
|
|
|
1890
1919
|
* ```js
|
|
1891
1920
|
* I.scrollPageToTop();
|
|
1892
1921
|
* ```
|
|
1893
|
-
*
|
|
1922
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1894
1923
|
*/
|
|
1895
1924
|
async scrollPageToTop() {
|
|
1896
1925
|
return this.executeScript(() => window.scrollTo(0, 0));
|
|
@@ -1902,7 +1931,7 @@ class Nightmare extends Helper {
|
|
|
1902
1931
|
* ```js
|
|
1903
1932
|
* I.scrollPageToBottom();
|
|
1904
1933
|
* ```
|
|
1905
|
-
*
|
|
1934
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1906
1935
|
*/
|
|
1907
1936
|
async scrollPageToBottom() {
|
|
1908
1937
|
/* eslint-disable prefer-arrow-callback, comma-dangle */
|