codeceptjs 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- 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 +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
|
@@ -533,7 +533,7 @@ class WebDriverIO extends Helper {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
/**
|
|
536
|
-
* {{>
|
|
536
|
+
* {{> amOnPage }}
|
|
537
537
|
* Appium: support only web testing
|
|
538
538
|
*/
|
|
539
539
|
amOnPage(url) {
|
|
@@ -541,7 +541,7 @@ class WebDriverIO extends Helper {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
|
-
* {{>
|
|
544
|
+
* {{> click }}
|
|
545
545
|
* Appium: support
|
|
546
546
|
*/
|
|
547
547
|
async click(locator, context = null) {
|
|
@@ -558,7 +558,7 @@ class WebDriverIO extends Helper {
|
|
|
558
558
|
}
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
|
-
* {{>
|
|
561
|
+
* {{> doubleClick }}
|
|
562
562
|
* Appium: support only web testing
|
|
563
563
|
*/
|
|
564
564
|
async doubleClick(locator, context = null) {
|
|
@@ -577,7 +577,7 @@ class WebDriverIO extends Helper {
|
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
/**
|
|
580
|
-
* {{>
|
|
580
|
+
* {{> rightClick }}
|
|
581
581
|
* Appium: support, but in apps works as usual click
|
|
582
582
|
*/
|
|
583
583
|
async rightClick(locator) {
|
|
@@ -594,7 +594,7 @@ class WebDriverIO extends Helper {
|
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
/**
|
|
597
|
-
* {{>
|
|
597
|
+
* {{> fillField }}
|
|
598
598
|
* Appium: support
|
|
599
599
|
*/
|
|
600
600
|
async fillField(field, value) {
|
|
@@ -605,7 +605,7 @@ class WebDriverIO extends Helper {
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
/**
|
|
608
|
-
* {{>
|
|
608
|
+
* {{> appendField }}
|
|
609
609
|
* Appium: support, but it's clear a field before insert in apps
|
|
610
610
|
*/
|
|
611
611
|
async appendField(field, value) {
|
|
@@ -617,7 +617,7 @@ class WebDriverIO extends Helper {
|
|
|
617
617
|
|
|
618
618
|
|
|
619
619
|
/**
|
|
620
|
-
* {{>
|
|
620
|
+
* {{> clearField}}
|
|
621
621
|
* Appium: support
|
|
622
622
|
*/
|
|
623
623
|
async clearField(field) {
|
|
@@ -629,7 +629,7 @@ class WebDriverIO extends Helper {
|
|
|
629
629
|
|
|
630
630
|
|
|
631
631
|
/**
|
|
632
|
-
* {{>
|
|
632
|
+
* {{> selectOption}}
|
|
633
633
|
*/
|
|
634
634
|
async selectOption(select, option) {
|
|
635
635
|
const res = await findFields.call(this, select);
|
|
@@ -660,7 +660,7 @@ class WebDriverIO extends Helper {
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
/**
|
|
663
|
-
* {{>
|
|
663
|
+
* {{> attachFile }}
|
|
664
664
|
* Appium: not tested
|
|
665
665
|
*/
|
|
666
666
|
async attachFile(locator, pathToFile) {
|
|
@@ -677,7 +677,7 @@ class WebDriverIO extends Helper {
|
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
/**
|
|
680
|
-
* {{>
|
|
680
|
+
* {{> checkOption }}
|
|
681
681
|
* Appium: not tested
|
|
682
682
|
*/
|
|
683
683
|
async checkOption(field, context = null) {
|
|
@@ -695,7 +695,7 @@ class WebDriverIO extends Helper {
|
|
|
695
695
|
}
|
|
696
696
|
|
|
697
697
|
/**
|
|
698
|
-
* {{>
|
|
698
|
+
* {{> uncheckOption }}
|
|
699
699
|
* Appium: not tested
|
|
700
700
|
*/
|
|
701
701
|
async uncheckOption(field, context = null) {
|
|
@@ -713,7 +713,7 @@ class WebDriverIO extends Helper {
|
|
|
713
713
|
}
|
|
714
714
|
|
|
715
715
|
/**
|
|
716
|
-
* {{>
|
|
716
|
+
* {{> grabTextFrom }}
|
|
717
717
|
* Appium: support
|
|
718
718
|
*/
|
|
719
719
|
async grabTextFrom(locator) {
|
|
@@ -725,7 +725,7 @@ class WebDriverIO extends Helper {
|
|
|
725
725
|
}
|
|
726
726
|
|
|
727
727
|
/**
|
|
728
|
-
* {{>
|
|
728
|
+
* {{> grabHTMLFrom }}
|
|
729
729
|
* Appium: support only web testing
|
|
730
730
|
*/
|
|
731
731
|
async grabHTMLFrom(locator) {
|
|
@@ -735,7 +735,7 @@ class WebDriverIO extends Helper {
|
|
|
735
735
|
}
|
|
736
736
|
|
|
737
737
|
/**
|
|
738
|
-
* {{>
|
|
738
|
+
* {{> grabValueFrom }}
|
|
739
739
|
* Appium: support only web testing
|
|
740
740
|
*/
|
|
741
741
|
async grabValueFrom(locator) {
|
|
@@ -746,7 +746,7 @@ class WebDriverIO extends Helper {
|
|
|
746
746
|
}
|
|
747
747
|
|
|
748
748
|
/**
|
|
749
|
-
* {{>
|
|
749
|
+
* {{> grabCssPropertyFrom }}
|
|
750
750
|
*/
|
|
751
751
|
async grabCssPropertyFrom(locator, cssProperty) {
|
|
752
752
|
const res = await this._locate(locator, true);
|
|
@@ -755,7 +755,7 @@ class WebDriverIO extends Helper {
|
|
|
755
755
|
}
|
|
756
756
|
|
|
757
757
|
/**
|
|
758
|
-
* {{>
|
|
758
|
+
* {{> grabAttributeFrom }}
|
|
759
759
|
* Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
760
760
|
*/
|
|
761
761
|
async grabAttributeFrom(locator, attr) {
|
|
@@ -765,7 +765,7 @@ class WebDriverIO extends Helper {
|
|
|
765
765
|
}
|
|
766
766
|
|
|
767
767
|
/**
|
|
768
|
-
* {{>
|
|
768
|
+
* {{> seeInTitle }}
|
|
769
769
|
* Appium: support only web testing
|
|
770
770
|
*/
|
|
771
771
|
async seeInTitle(text) {
|
|
@@ -788,7 +788,7 @@ class WebDriverIO extends Helper {
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
/**
|
|
791
|
-
* {{>
|
|
791
|
+
* {{> dontSeeInTitle }}
|
|
792
792
|
* Appium: support only web testing
|
|
793
793
|
*/
|
|
794
794
|
async dontSeeInTitle(text) {
|
|
@@ -797,7 +797,7 @@ class WebDriverIO extends Helper {
|
|
|
797
797
|
}
|
|
798
798
|
|
|
799
799
|
/**
|
|
800
|
-
* {{>
|
|
800
|
+
* {{> grabTitle }}
|
|
801
801
|
* Appium: support only web testing
|
|
802
802
|
*/
|
|
803
803
|
async grabTitle() {
|
|
@@ -807,7 +807,7 @@ class WebDriverIO extends Helper {
|
|
|
807
807
|
}
|
|
808
808
|
|
|
809
809
|
/**
|
|
810
|
-
* {{>
|
|
810
|
+
* {{> see }}
|
|
811
811
|
* Appium: support with context in apps
|
|
812
812
|
*/
|
|
813
813
|
async see(text, context = null) {
|
|
@@ -829,7 +829,7 @@ class WebDriverIO extends Helper {
|
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
/**
|
|
832
|
-
* {{>
|
|
832
|
+
* {{> dontSee }}
|
|
833
833
|
* Appium: support with context in apps
|
|
834
834
|
*/
|
|
835
835
|
async dontSee(text, context = null) {
|
|
@@ -837,7 +837,7 @@ class WebDriverIO extends Helper {
|
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
/**
|
|
840
|
-
* {{>
|
|
840
|
+
* {{> seeInField }}
|
|
841
841
|
* Appium: support only web testing
|
|
842
842
|
*/
|
|
843
843
|
async seeInField(field, value) {
|
|
@@ -845,7 +845,7 @@ class WebDriverIO extends Helper {
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
/**
|
|
848
|
-
* {{>
|
|
848
|
+
* {{> dontSeeInField }}
|
|
849
849
|
* Appium: support only web testing
|
|
850
850
|
*/
|
|
851
851
|
async dontSeeInField(field, value) {
|
|
@@ -853,7 +853,7 @@ class WebDriverIO extends Helper {
|
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
/**
|
|
856
|
-
* {{>
|
|
856
|
+
* {{> seeCheckboxIsChecked }}
|
|
857
857
|
* Appium: not tested
|
|
858
858
|
*/
|
|
859
859
|
async seeCheckboxIsChecked(field) {
|
|
@@ -861,7 +861,7 @@ class WebDriverIO extends Helper {
|
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
/**
|
|
864
|
-
* {{>
|
|
864
|
+
* {{> dontSeeCheckboxIsChecked }}
|
|
865
865
|
* Appium: not tested
|
|
866
866
|
*/
|
|
867
867
|
async dontSeeCheckboxIsChecked(field) {
|
|
@@ -869,7 +869,7 @@ class WebDriverIO extends Helper {
|
|
|
869
869
|
}
|
|
870
870
|
|
|
871
871
|
/**
|
|
872
|
-
* {{>
|
|
872
|
+
* {{> seeElement }}
|
|
873
873
|
* Appium: support
|
|
874
874
|
*/
|
|
875
875
|
async seeElement(locator) {
|
|
@@ -883,7 +883,7 @@ class WebDriverIO extends Helper {
|
|
|
883
883
|
}
|
|
884
884
|
|
|
885
885
|
/**
|
|
886
|
-
* {{>
|
|
886
|
+
* {{> dontSeeElement}}
|
|
887
887
|
* Appium: support
|
|
888
888
|
*/
|
|
889
889
|
async dontSeeElement(locator) {
|
|
@@ -896,7 +896,7 @@ class WebDriverIO extends Helper {
|
|
|
896
896
|
}
|
|
897
897
|
|
|
898
898
|
/**
|
|
899
|
-
* {{>
|
|
899
|
+
* {{> seeElementInDOM }}
|
|
900
900
|
* Appium: support
|
|
901
901
|
*/
|
|
902
902
|
async seeElementInDOM(locator) {
|
|
@@ -905,7 +905,7 @@ class WebDriverIO extends Helper {
|
|
|
905
905
|
}
|
|
906
906
|
|
|
907
907
|
/**
|
|
908
|
-
* {{>
|
|
908
|
+
* {{> dontSeeElementInDOM }}
|
|
909
909
|
* Appium: support
|
|
910
910
|
*/
|
|
911
911
|
async dontSeeElementInDOM(locator) {
|
|
@@ -914,7 +914,7 @@ class WebDriverIO extends Helper {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
/**
|
|
917
|
-
* {{>
|
|
917
|
+
* {{> seeInSource }}
|
|
918
918
|
* Appium: support
|
|
919
919
|
*/
|
|
920
920
|
async seeInSource(text) {
|
|
@@ -923,7 +923,7 @@ class WebDriverIO extends Helper {
|
|
|
923
923
|
}
|
|
924
924
|
|
|
925
925
|
/**
|
|
926
|
-
* {{>
|
|
926
|
+
* {{> grabSource }}
|
|
927
927
|
* Appium: support
|
|
928
928
|
*/
|
|
929
929
|
async grabSource() {
|
|
@@ -943,7 +943,7 @@ class WebDriverIO extends Helper {
|
|
|
943
943
|
}
|
|
944
944
|
|
|
945
945
|
/**
|
|
946
|
-
* {{>
|
|
946
|
+
* {{> grabCurrentUrl }}
|
|
947
947
|
*/
|
|
948
948
|
async grabCurrentUrl() {
|
|
949
949
|
const res = await this.browser.url();
|
|
@@ -957,7 +957,7 @@ class WebDriverIO extends Helper {
|
|
|
957
957
|
}
|
|
958
958
|
|
|
959
959
|
/**
|
|
960
|
-
* {{>
|
|
960
|
+
* {{> dontSeeInSource }}
|
|
961
961
|
* Appium: support
|
|
962
962
|
*/
|
|
963
963
|
async dontSeeInSource(text) {
|
|
@@ -983,7 +983,7 @@ class WebDriverIO extends Helper {
|
|
|
983
983
|
}
|
|
984
984
|
|
|
985
985
|
/**
|
|
986
|
-
* {{>
|
|
986
|
+
* {{> seeNumberOfVisibleElements }}
|
|
987
987
|
*/
|
|
988
988
|
async seeNumberOfVisibleElements(locator, num) {
|
|
989
989
|
const res = await this.grabNumberOfVisibleElements(locator);
|
|
@@ -991,7 +991,7 @@ class WebDriverIO extends Helper {
|
|
|
991
991
|
}
|
|
992
992
|
|
|
993
993
|
/**
|
|
994
|
-
* {{>
|
|
994
|
+
* {{> seeCssPropertiesOnElements }}
|
|
995
995
|
*/
|
|
996
996
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
997
997
|
const res = await this._locate(locator);
|
|
@@ -1026,7 +1026,7 @@ class WebDriverIO extends Helper {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
/**
|
|
1029
|
-
* {{>
|
|
1029
|
+
* {{> seeAttributesOnElements }}
|
|
1030
1030
|
*/
|
|
1031
1031
|
async seeAttributesOnElements(locator, attributes) {
|
|
1032
1032
|
const res = await this._locate(locator);
|
|
@@ -1053,7 +1053,7 @@ class WebDriverIO extends Helper {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
1055
|
/**
|
|
1056
|
-
* {{>
|
|
1056
|
+
* {{> grabNumberOfVisibleElements }}
|
|
1057
1057
|
*/
|
|
1058
1058
|
async grabNumberOfVisibleElements(locator) {
|
|
1059
1059
|
const res = await this._locate(locator);
|
|
@@ -1065,7 +1065,7 @@ class WebDriverIO extends Helper {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
1067
|
/**
|
|
1068
|
-
* {{>
|
|
1068
|
+
* {{> seeInCurrentUrl }}
|
|
1069
1069
|
* Appium: support only web testing
|
|
1070
1070
|
*/
|
|
1071
1071
|
async seeInCurrentUrl(url) {
|
|
@@ -1074,7 +1074,7 @@ class WebDriverIO extends Helper {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
1076
1076
|
/**
|
|
1077
|
-
* {{>
|
|
1077
|
+
* {{> dontSeeInCurrentUrl }}
|
|
1078
1078
|
* Appium: support only web testing
|
|
1079
1079
|
*/
|
|
1080
1080
|
async dontSeeInCurrentUrl(url) {
|
|
@@ -1083,7 +1083,7 @@ class WebDriverIO extends Helper {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
1085
1085
|
/**
|
|
1086
|
-
* {{>
|
|
1086
|
+
* {{> seeCurrentUrlEquals }}
|
|
1087
1087
|
* Appium: support only web testing
|
|
1088
1088
|
*/
|
|
1089
1089
|
async seeCurrentUrlEquals(url) {
|
|
@@ -1092,7 +1092,7 @@ class WebDriverIO extends Helper {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
1094
|
/**
|
|
1095
|
-
* {{>
|
|
1095
|
+
* {{> dontSeeCurrentUrlEquals }}
|
|
1096
1096
|
* Appium: support only web testing
|
|
1097
1097
|
*/
|
|
1098
1098
|
async dontSeeCurrentUrlEquals(url) {
|
|
@@ -1101,7 +1101,7 @@ class WebDriverIO extends Helper {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
/**
|
|
1104
|
-
* {{>
|
|
1104
|
+
* {{> executeScript }}
|
|
1105
1105
|
* Appium: support only web testing
|
|
1106
1106
|
*
|
|
1107
1107
|
* Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
|
|
@@ -1111,7 +1111,7 @@ class WebDriverIO extends Helper {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
1113
|
/**
|
|
1114
|
-
* {{>
|
|
1114
|
+
* {{> executeAsyncScript }}
|
|
1115
1115
|
* Appium: support only web testing
|
|
1116
1116
|
*/
|
|
1117
1117
|
executeAsyncScript(fn) {
|
|
@@ -1133,7 +1133,7 @@ class WebDriverIO extends Helper {
|
|
|
1133
1133
|
*/
|
|
1134
1134
|
|
|
1135
1135
|
/**
|
|
1136
|
-
* {{>
|
|
1136
|
+
* {{> scrollTo }}
|
|
1137
1137
|
* Appium: support only web testing
|
|
1138
1138
|
*/
|
|
1139
1139
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -1165,7 +1165,7 @@ class WebDriverIO extends Helper {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
|
|
1167
1167
|
/**
|
|
1168
|
-
* {{>
|
|
1168
|
+
* {{> moveCursorTo}}
|
|
1169
1169
|
* Appium: support only web testing
|
|
1170
1170
|
*/
|
|
1171
1171
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -1199,7 +1199,7 @@ class WebDriverIO extends Helper {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
|
|
1201
1201
|
/**
|
|
1202
|
-
* {{>
|
|
1202
|
+
* {{> saveScreenshot}}
|
|
1203
1203
|
* Appium: support
|
|
1204
1204
|
*/
|
|
1205
1205
|
async saveScreenshot(fileName, fullPage = false) {
|
|
@@ -1228,7 +1228,7 @@ class WebDriverIO extends Helper {
|
|
|
1228
1228
|
|
|
1229
1229
|
|
|
1230
1230
|
/**
|
|
1231
|
-
* {{>
|
|
1231
|
+
* {{> setCookie}}
|
|
1232
1232
|
* Appium: support only web testing
|
|
1233
1233
|
*
|
|
1234
1234
|
* Uses Selenium's JSON [cookie
|
|
@@ -1239,7 +1239,7 @@ class WebDriverIO extends Helper {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
1241
|
/**
|
|
1242
|
-
* {{>
|
|
1242
|
+
* {{> clearCookie}}
|
|
1243
1243
|
* Appium: support only web testing
|
|
1244
1244
|
*/
|
|
1245
1245
|
async clearCookie(cookie) {
|
|
@@ -1247,7 +1247,7 @@ class WebDriverIO extends Helper {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
|
|
1249
1249
|
/**
|
|
1250
|
-
* {{>
|
|
1250
|
+
* {{> seeCookie}}
|
|
1251
1251
|
* Appium: support only web testing
|
|
1252
1252
|
*/
|
|
1253
1253
|
async seeCookie(name) {
|
|
@@ -1256,7 +1256,7 @@ class WebDriverIO extends Helper {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
|
|
1258
1258
|
/**
|
|
1259
|
-
* {{>
|
|
1259
|
+
* {{> dontSeeCookie}}
|
|
1260
1260
|
* Appium: support only web testing
|
|
1261
1261
|
*/
|
|
1262
1262
|
async dontSeeCookie(name) {
|
|
@@ -1265,7 +1265,7 @@ class WebDriverIO extends Helper {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
1267
|
/**
|
|
1268
|
-
* {{>
|
|
1268
|
+
* {{> grabCookie}}
|
|
1269
1269
|
* Appium: support only web testing
|
|
1270
1270
|
*/
|
|
1271
1271
|
async grabCookie(name) {
|
|
@@ -1325,8 +1325,8 @@ class WebDriverIO extends Helper {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
|
|
1327
1327
|
/**
|
|
1328
|
-
* {{>
|
|
1329
|
-
* {{>
|
|
1328
|
+
* {{> pressKey }}
|
|
1329
|
+
* {{> _keys }}
|
|
1330
1330
|
*
|
|
1331
1331
|
* To make combinations with modifier and mouse clicks (like Ctrl+Click) press a modifier, click, then release it.
|
|
1332
1332
|
* Appium: support, but clear field before pressing in apps:
|
|
@@ -1349,7 +1349,7 @@ class WebDriverIO extends Helper {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
|
|
1351
1351
|
/**
|
|
1352
|
-
* {{>
|
|
1352
|
+
* {{> resizeWindow }}
|
|
1353
1353
|
* Appium: not tested in web, in apps doesn't work
|
|
1354
1354
|
*/
|
|
1355
1355
|
async resizeWindow(width, height) {
|
|
@@ -1370,7 +1370,7 @@ class WebDriverIO extends Helper {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
|
|
1372
1372
|
/**
|
|
1373
|
-
* {{>
|
|
1373
|
+
* {{> dragAndDrop }}
|
|
1374
1374
|
* Appium: not tested
|
|
1375
1375
|
*/
|
|
1376
1376
|
async dragAndDrop(srcElement, destElement) {
|
|
@@ -1429,7 +1429,7 @@ class WebDriverIO extends Helper {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
1431
|
/**
|
|
1432
|
-
* {{>
|
|
1432
|
+
* {{> wait }}
|
|
1433
1433
|
* Appium: support
|
|
1434
1434
|
*/
|
|
1435
1435
|
async wait(sec) {
|
|
@@ -1437,7 +1437,7 @@ class WebDriverIO extends Helper {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
|
|
1439
1439
|
/**
|
|
1440
|
-
* {{>
|
|
1440
|
+
* {{> waitForEnabled }}
|
|
1441
1441
|
* Appium: support
|
|
1442
1442
|
*/
|
|
1443
1443
|
async waitForEnabled(locator, sec = null) {
|
|
@@ -1457,7 +1457,7 @@ class WebDriverIO extends Helper {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
|
|
1459
1459
|
/**
|
|
1460
|
-
* {{>
|
|
1460
|
+
* {{> waitForElement }}
|
|
1461
1461
|
* Appium: support
|
|
1462
1462
|
*/
|
|
1463
1463
|
async waitForElement(locator, sec = null) {
|
|
@@ -1477,7 +1477,7 @@ class WebDriverIO extends Helper {
|
|
|
1477
1477
|
|
|
1478
1478
|
|
|
1479
1479
|
/**
|
|
1480
|
-
* {{>
|
|
1480
|
+
* {{> waitInUrl }}
|
|
1481
1481
|
*/
|
|
1482
1482
|
async waitInUrl(urlPart, sec = null) {
|
|
1483
1483
|
const client = this.browser;
|
|
@@ -1499,7 +1499,7 @@ class WebDriverIO extends Helper {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
|
|
1501
1501
|
/**
|
|
1502
|
-
* {{>
|
|
1502
|
+
* {{> waitUrlEquals }}
|
|
1503
1503
|
*/
|
|
1504
1504
|
async waitUrlEquals(urlPart, sec = null) {
|
|
1505
1505
|
const aSec = sec || this.options.waitForTimeout;
|
|
@@ -1523,7 +1523,7 @@ class WebDriverIO extends Helper {
|
|
|
1523
1523
|
}
|
|
1524
1524
|
|
|
1525
1525
|
/**
|
|
1526
|
-
* {{>
|
|
1526
|
+
* {{> waitForText }}
|
|
1527
1527
|
* Appium: support
|
|
1528
1528
|
*/
|
|
1529
1529
|
async waitForText(text, sec = null, context = null) {
|
|
@@ -1544,7 +1544,7 @@ class WebDriverIO extends Helper {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
|
|
1546
1546
|
/**
|
|
1547
|
-
* {{>
|
|
1547
|
+
* {{> waitForValue }}
|
|
1548
1548
|
*/
|
|
1549
1549
|
async waitForValue(field, value, sec = null) {
|
|
1550
1550
|
const client = this.browser;
|
|
@@ -1564,7 +1564,7 @@ class WebDriverIO extends Helper {
|
|
|
1564
1564
|
}
|
|
1565
1565
|
|
|
1566
1566
|
/**
|
|
1567
|
-
* {{>
|
|
1567
|
+
* {{> waitForVisible }}
|
|
1568
1568
|
* Appium: support
|
|
1569
1569
|
*/
|
|
1570
1570
|
async waitForVisible(locator, sec = null) {
|
|
@@ -1581,7 +1581,7 @@ class WebDriverIO extends Helper {
|
|
|
1581
1581
|
}
|
|
1582
1582
|
|
|
1583
1583
|
/**
|
|
1584
|
-
* {{>
|
|
1584
|
+
* {{> waitNumberOfVisibleElements }}
|
|
1585
1585
|
*/
|
|
1586
1586
|
async waitNumberOfVisibleElements(locator, num, sec = null) {
|
|
1587
1587
|
const aSec = sec || this.options.waitForTimeout;
|
|
@@ -1596,7 +1596,7 @@ class WebDriverIO extends Helper {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
|
|
1598
1598
|
/**
|
|
1599
|
-
* {{>
|
|
1599
|
+
* {{> waitForInvisible }}
|
|
1600
1600
|
* Appium: support
|
|
1601
1601
|
*/
|
|
1602
1602
|
async waitForInvisible(locator, sec = null) {
|
|
@@ -1613,7 +1613,7 @@ class WebDriverIO extends Helper {
|
|
|
1613
1613
|
}
|
|
1614
1614
|
|
|
1615
1615
|
/**
|
|
1616
|
-
* {{>
|
|
1616
|
+
* {{> waitToHide }}
|
|
1617
1617
|
* Appium: support
|
|
1618
1618
|
*/
|
|
1619
1619
|
async waitToHide(locator, sec = null) {
|
|
@@ -1626,7 +1626,7 @@ class WebDriverIO extends Helper {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
|
|
1628
1628
|
/**
|
|
1629
|
-
* {{>
|
|
1629
|
+
* {{> waitForDetached }}
|
|
1630
1630
|
* Appium: support
|
|
1631
1631
|
*/
|
|
1632
1632
|
async waitForDetached(locator, sec = null) {
|
|
@@ -1641,7 +1641,7 @@ class WebDriverIO extends Helper {
|
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
1643
1643
|
/**
|
|
1644
|
-
* {{>
|
|
1644
|
+
* {{> waitForFunction }}
|
|
1645
1645
|
* Appium: support
|
|
1646
1646
|
*/
|
|
1647
1647
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
@@ -1660,7 +1660,7 @@ class WebDriverIO extends Helper {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
|
|
1662
1662
|
/**
|
|
1663
|
-
* {{>
|
|
1663
|
+
* {{> waitUntil }}
|
|
1664
1664
|
* @param interval (optional) time in seconds between condition checks.
|
|
1665
1665
|
* * *Appium*: supported
|
|
1666
1666
|
*/
|
|
@@ -1671,7 +1671,7 @@ class WebDriverIO extends Helper {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
|
|
1673
1673
|
/**
|
|
1674
|
-
* {{>
|
|
1674
|
+
* {{> switchTo }}
|
|
1675
1675
|
* Appium: support only web testing
|
|
1676
1676
|
*/
|
|
1677
1677
|
async switchTo(locator) {
|
|
@@ -1761,7 +1761,7 @@ class WebDriverIO extends Helper {
|
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
1763
|
/**
|
|
1764
|
-
* {{>
|
|
1764
|
+
* {{> grabNumberOfOpenTabs }}
|
|
1765
1765
|
*/
|
|
1766
1766
|
async grabNumberOfOpenTabs() {
|
|
1767
1767
|
const pages = await this.browser.getTabIds();
|
|
@@ -1769,7 +1769,7 @@ class WebDriverIO extends Helper {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
|
|
1771
1771
|
/**
|
|
1772
|
-
* {{>
|
|
1772
|
+
* {{> refreshPage }}
|
|
1773
1773
|
*/
|
|
1774
1774
|
async refreshPage() {
|
|
1775
1775
|
const client = this.browser;
|
|
@@ -1777,7 +1777,7 @@ class WebDriverIO extends Helper {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
|
|
1779
1779
|
/**
|
|
1780
|
-
* {{>
|
|
1780
|
+
* {{> scrollPageToTop }}
|
|
1781
1781
|
*/
|
|
1782
1782
|
scrollPageToTop() {
|
|
1783
1783
|
const client = this.browser;
|
|
@@ -1789,7 +1789,7 @@ class WebDriverIO extends Helper {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
|
|
1791
1791
|
/**
|
|
1792
|
-
* {{>
|
|
1792
|
+
* {{> scrollPageToBottom }}
|
|
1793
1793
|
*/
|
|
1794
1794
|
scrollPageToBottom() {
|
|
1795
1795
|
const client = this.browser;
|
|
@@ -1806,7 +1806,7 @@ class WebDriverIO extends Helper {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
|
|
1808
1808
|
/**
|
|
1809
|
-
* {{>
|
|
1809
|
+
* {{> grabPageScrollPosition}}
|
|
1810
1810
|
*/
|
|
1811
1811
|
async grabPageScrollPosition() {
|
|
1812
1812
|
/* eslint-disable comma-dangle */
|
|
@@ -139,5 +139,13 @@ if (!window.codeceptjs) {
|
|
|
139
139
|
return element.dispatchEvent(event);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
codeceptjs.unCheckEl = function (el) {
|
|
143
|
+
const element = this.fetchElement(el);
|
|
144
|
+
const event = document.createEvent('HTMLEvents');
|
|
145
|
+
element.checked = false;
|
|
146
|
+
event.initEvent('change', true, true);
|
|
147
|
+
return element.dispatchEvent(event);
|
|
148
|
+
};
|
|
149
|
+
|
|
142
150
|
window.codeceptjs = codeceptjs;
|
|
143
151
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
let resqScript;
|
|
4
|
+
|
|
5
|
+
module.exports = async function findReact(matcher, locator) {
|
|
6
|
+
if (!resqScript) resqScript = fs.readFileSync(require.resolve('resq'));
|
|
7
|
+
await matcher.executionContext().evaluate(resqScript.toString());
|
|
8
|
+
await matcher.executionContext().evaluate(() => window.resq.waitToLoadReact());
|
|
9
|
+
const arrayHandle = await matcher.executionContext().evaluateHandle((selector, props, state, reactElement) => {
|
|
10
|
+
let elements = window.resq.resq$$(selector);
|
|
11
|
+
if (Object.keys(props).length) {
|
|
12
|
+
elements = elements.byProps(props);
|
|
13
|
+
}
|
|
14
|
+
if (Object.keys(state).length) {
|
|
15
|
+
elements = elements.byState(state);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!elements.length) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// resq returns an array of HTMLElements if the React component is a fragment
|
|
23
|
+
// this avoids having nested arrays of nodes which the driver does not understand
|
|
24
|
+
// [[div, div], [div, div]] => [div, div, div, div]
|
|
25
|
+
let nodes = [];
|
|
26
|
+
|
|
27
|
+
elements.forEach((element) => {
|
|
28
|
+
let { node, isFragment } = element;
|
|
29
|
+
|
|
30
|
+
if (!node) {
|
|
31
|
+
isFragment = true;
|
|
32
|
+
node = element.children;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (isFragment) {
|
|
36
|
+
nodes = nodes.concat(node);
|
|
37
|
+
} else {
|
|
38
|
+
nodes.push(node);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return [...nodes];
|
|
43
|
+
}, locator.react, locator.props || {}, locator.state || {}, locator.children || {}, matcher);
|
|
44
|
+
|
|
45
|
+
const properties = await arrayHandle.getProperties();
|
|
46
|
+
await arrayHandle.dispose();
|
|
47
|
+
const result = [];
|
|
48
|
+
for (const property of properties.values()) {
|
|
49
|
+
const elementHandle = property.asElement();
|
|
50
|
+
if (elementHandle) { result.push(elementHandle); }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
};
|