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.
Files changed (173) hide show
  1. package/CHANGELOG.md +125 -37
  2. package/README.md +15 -22
  3. package/bin/codecept.js +4 -1
  4. package/docs/acceptance.md +44 -1
  5. package/docs/advanced.md +1 -1
  6. package/docs/angular.md +6 -9
  7. package/docs/basics.md +388 -75
  8. package/docs/bdd.md +4 -3
  9. package/docs/best.md +1 -1
  10. package/docs/books.md +31 -0
  11. package/docs/build/Appium.js +215 -176
  12. package/docs/build/Nightmare.js +618 -489
  13. package/docs/build/Polly.js +189 -0
  14. package/docs/build/Protractor.js +747 -608
  15. package/docs/build/Puppeteer.js +914 -633
  16. package/docs/build/REST.js +1 -1
  17. package/docs/build/TestCafe.js +1835 -0
  18. package/docs/build/WebDriver.js +861 -805
  19. package/docs/build/WebDriverIO.js +616 -617
  20. package/docs/changelog.md +410 -316
  21. package/docs/commands.md +6 -6
  22. package/docs/community-helpers.md +2 -0
  23. package/docs/detox.md +235 -0
  24. package/docs/examples.md +23 -0
  25. package/docs/helpers/ApiDataFactory.md +11 -10
  26. package/docs/helpers/Appium.md +130 -61
  27. package/docs/helpers/Detox.md +579 -0
  28. package/docs/helpers/FileSystem.md +2 -1
  29. package/docs/helpers/Mochawesome.md +1 -0
  30. package/docs/helpers/Nightmare.md +348 -128
  31. package/docs/helpers/Polly.md +85 -0
  32. package/docs/helpers/Protractor.md +451 -184
  33. package/docs/helpers/Puppeteer-firefox.md +55 -0
  34. package/docs/helpers/Puppeteer.md +619 -183
  35. package/docs/helpers/REST.md +17 -16
  36. package/docs/helpers/SeleniumWebdriver.md +9 -8
  37. package/docs/helpers/TestCafe.md +1168 -0
  38. package/docs/helpers/WebDriver.md +600 -291
  39. package/docs/helpers/WebDriverIO.md +393 -278
  40. package/docs/helpers.md +37 -18
  41. package/docs/locators.md +2 -0
  42. package/docs/mobile-react-native-locators.md +64 -0
  43. package/docs/mobile.md +5 -0
  44. package/docs/plugins.md +54 -13
  45. package/docs/puppeteer.md +74 -26
  46. package/docs/quickstart.md +47 -12
  47. package/docs/react.md +67 -0
  48. package/docs/reports.md +1 -1
  49. package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
  50. package/docs/shared/react.mustache +1 -0
  51. package/docs/testcafe.md +157 -0
  52. package/docs/videos.md +19 -0
  53. package/docs/webapi/amOnPage.mustache +1 -1
  54. package/docs/webapi/appendField.mustache +2 -2
  55. package/docs/webapi/attachFile.mustache +2 -2
  56. package/docs/webapi/checkOption.mustache +2 -2
  57. package/docs/webapi/clearCookie.mustache +1 -1
  58. package/docs/webapi/clearField.mustache +1 -1
  59. package/docs/webapi/click.mustache +2 -2
  60. package/docs/webapi/clickLink.mustache +3 -3
  61. package/docs/webapi/dontSee.mustache +6 -3
  62. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
  63. package/docs/webapi/dontSeeCookie.mustache +5 -1
  64. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
  65. package/docs/webapi/dontSeeElement.mustache +5 -1
  66. package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
  67. package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
  68. package/docs/webapi/dontSeeInField.mustache +7 -2
  69. package/docs/webapi/dontSeeInSource.mustache +5 -1
  70. package/docs/webapi/dontSeeInTitle.mustache +5 -1
  71. package/docs/webapi/doubleClick.mustache +2 -2
  72. package/docs/webapi/downloadFile.mustache +2 -2
  73. package/docs/webapi/dragAndDrop.mustache +2 -2
  74. package/docs/webapi/dragSlider.mustache +2 -2
  75. package/docs/webapi/executeAsyncScript.mustache +1 -1
  76. package/docs/webapi/executeScript.mustache +1 -1
  77. package/docs/webapi/fillField.mustache +2 -2
  78. package/docs/webapi/grabAttributeFrom.mustache +3 -2
  79. package/docs/webapi/grabBrowserLogs.mustache +3 -1
  80. package/docs/webapi/grabCookie.mustache +2 -1
  81. package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
  82. package/docs/webapi/grabCurrentUrl.mustache +3 -1
  83. package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
  84. package/docs/webapi/grabHTMLFrom.mustache +2 -1
  85. package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
  86. package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
  87. package/docs/webapi/grabPageScrollPosition.mustache +3 -1
  88. package/docs/webapi/grabSource.mustache +3 -1
  89. package/docs/webapi/grabTextFrom.mustache +2 -1
  90. package/docs/webapi/grabTitle.mustache +3 -1
  91. package/docs/webapi/grabValueFrom.mustache +2 -1
  92. package/docs/webapi/moveCursorTo.mustache +3 -3
  93. package/docs/webapi/pressKey.mustache +1 -1
  94. package/docs/webapi/resizeWindow.mustache +2 -2
  95. package/docs/webapi/rightClick.mustache +2 -2
  96. package/docs/webapi/saveScreenshot.mustache +3 -3
  97. package/docs/webapi/say.mustache +2 -2
  98. package/docs/webapi/scrollPageToBottom.mustache +1 -1
  99. package/docs/webapi/scrollPageToTop.mustache +1 -1
  100. package/docs/webapi/scrollTo.mustache +3 -3
  101. package/docs/webapi/see.mustache +2 -2
  102. package/docs/webapi/seeAttributesOnElements.mustache +3 -3
  103. package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
  104. package/docs/webapi/seeCookie.mustache +1 -1
  105. package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
  106. package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
  107. package/docs/webapi/seeElement.mustache +1 -1
  108. package/docs/webapi/seeElementInDOM.mustache +1 -1
  109. package/docs/webapi/seeInCurrentUrl.mustache +1 -1
  110. package/docs/webapi/seeInField.mustache +2 -2
  111. package/docs/webapi/seeInSource.mustache +1 -1
  112. package/docs/webapi/seeInTitle.mustache +5 -1
  113. package/docs/webapi/seeNumberOfElements.mustache +10 -0
  114. package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
  115. package/docs/webapi/selectOption.mustache +2 -2
  116. package/docs/webapi/setCookie.mustache +1 -1
  117. package/docs/webapi/switchTo.mustache +6 -1
  118. package/docs/webapi/uncheckOption.mustache +2 -2
  119. package/docs/webapi/wait.mustache +1 -2
  120. package/docs/webapi/waitForDetached.mustache +3 -3
  121. package/docs/webapi/waitForElement.mustache +2 -2
  122. package/docs/webapi/waitForEnabled.mustache +1 -1
  123. package/docs/webapi/waitForFunction.mustache +3 -3
  124. package/docs/webapi/waitForInvisible.mustache +3 -3
  125. package/docs/webapi/waitForText.mustache +3 -3
  126. package/docs/webapi/waitForValue.mustache +3 -3
  127. package/docs/webapi/waitForVisible.mustache +3 -3
  128. package/docs/webapi/waitInUrl.mustache +2 -2
  129. package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
  130. package/docs/webapi/waitToHide.mustache +3 -3
  131. package/docs/webapi/waitUntil.mustache +3 -3
  132. package/docs/webapi/waitUrlEquals.mustache +2 -2
  133. package/docs/webdriver.md +453 -0
  134. package/lib/codecept.js +11 -9
  135. package/lib/command/definitions.js +183 -30
  136. package/lib/command/gherkin/snippets.js +29 -9
  137. package/lib/command/init.js +31 -9
  138. package/lib/command/run-multiple.js +46 -59
  139. package/lib/command/utils.js +1 -1
  140. package/lib/container.js +30 -4
  141. package/lib/data/dataScenarioConfig.js +18 -0
  142. package/lib/helper/Appium.js +24 -24
  143. package/lib/helper/Nightmare.js +81 -84
  144. package/lib/helper/Polly.js +189 -0
  145. package/lib/helper/Protractor.js +96 -86
  146. package/lib/helper/Puppeteer.js +238 -113
  147. package/lib/helper/REST.js +1 -1
  148. package/lib/helper/TestCafe.js +1257 -0
  149. package/lib/helper/WebDriver.js +217 -277
  150. package/lib/helper/WebDriverIO.js +75 -75
  151. package/lib/helper/clientscripts/nightmare.js +8 -0
  152. package/lib/helper/extras/React.js +55 -0
  153. package/lib/helper/testcafe/testControllerHolder.js +42 -0
  154. package/lib/helper/testcafe/testcafe-utils.js +63 -0
  155. package/lib/history.js +39 -0
  156. package/lib/hooks.js +25 -1
  157. package/lib/interfaces/gherkin.js +17 -1
  158. package/lib/interfaces/scenarioConfig.js +2 -2
  159. package/lib/listener/config.js +3 -3
  160. package/lib/locator.js +6 -0
  161. package/lib/pause.js +22 -1
  162. package/lib/plugin/allure.js +63 -0
  163. package/lib/plugin/autoLogin.js +65 -16
  164. package/lib/plugin/puppeteerCoverage.js +6 -1
  165. package/lib/plugin/stepByStepReport.js +4 -3
  166. package/lib/scenario.js +23 -17
  167. package/lib/step.js +5 -2
  168. package/lib/ui.js +1 -1
  169. package/lib/utils.js +70 -20
  170. package/package.json +20 -19
  171. package/translations/de-DE.js +69 -0
  172. package/translations/index.js +1 -0
  173. package/docs/video.md +0 -26
@@ -6,6 +6,6 @@ I.scrollTo('footer');
6
6
  I.scrollTo('#submit', 5, 5);
7
7
  ```
8
8
 
9
- @param locator located by CSS|XPath|strict locator.
10
- @param offsetX (optional) X-axis offset.
11
- @param offsetY (optional) Y-axis offset.
9
+ @param {string|object} locator located by CSS|XPath|strict locator.
10
+ @param {number} offsetX (optional, `0` by default) X-axis offset.
11
+ @param {number} offsetY (optional, `0` by default) Y-axis offset.
@@ -6,5 +6,5 @@ I.see('Welcome'); // text welcome on a page
6
6
  I.see('Welcome', '.content'); // text inside .content div
7
7
  I.see('Register', {css: 'form.register'}); // use strict locator
8
8
  ```
9
- @param text expected on page.
10
- @param context (optional) element located by CSS|Xpath|strict locator in which to search for text.
9
+ @param {string} text expected on page.
10
+ @param {string|object} context (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
@@ -1,8 +1,8 @@
1
1
  Checks that all elements with given locator have given attributes.
2
2
 
3
3
  ```js
4
- I.seeAttributesOnElements('//form', {'method': "post"});
4
+ I.seeAttributesOnElements('//form', { method: "post"});
5
5
  ```
6
6
 
7
- @param locator located by CSS|XPath|strict locator.
8
- @param attributes object with attributes and their values to check.
7
+ @param {string|object} locator located by CSS|XPath|strict locator.
8
+ @param {object} attributes attributes and their values to check.
@@ -5,4 +5,5 @@ I.seeCheckboxIsChecked('Agree');
5
5
  I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
6
6
  I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
7
7
  ```
8
- @param field located by label|name|CSS|XPath|strict locator.
8
+
9
+ @param {string|object} field located by label|name|CSS|XPath|strict locator.
@@ -4,4 +4,4 @@ Checks that cookie with given name exists.
4
4
  I.seeCookie('Auth');
5
5
  ```
6
6
 
7
- @param name cookie name.
7
+ @param {string} name cookie name.
@@ -4,5 +4,5 @@ Checks that all elements with given locator have given CSS properties.
4
4
  I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
5
5
  ```
6
6
 
7
- @param locator located by CSS|XPath|strict locator.
8
- @param cssProperties object with CSS properties and their values to check.
7
+ @param {string|object} locator located by CSS|XPath|strict locator.
8
+ @param {object} cssProperties object with CSS properties and their values to check.
@@ -7,4 +7,4 @@ I.seeCurrentUrlEquals('/register');
7
7
  I.seeCurrentUrlEquals('http://my.site.com/register');
8
8
  ```
9
9
 
10
- @param url value to check.
10
+ @param {string} url value to check.
@@ -4,4 +4,4 @@ Element is located by CSS or XPath.
4
4
  ```js
5
5
  I.seeElement('#modal');
6
6
  ```
7
- @param locator located by CSS|XPath|strict locator.
7
+ @param {string|object} locator located by CSS|XPath|strict locator.
@@ -4,4 +4,4 @@ Element is located by CSS or XPath.
4
4
  ```js
5
5
  I.seeElementInDOM('#modal');
6
6
  ```
7
- @param locator located by CSS|XPath|strict locator.
7
+ @param {string|object} locator element located by CSS|XPath|strict locator.
@@ -4,4 +4,4 @@ Checks that current url contains a provided fragment.
4
4
  I.seeInCurrentUrl('/register'); // we are on registration page
5
5
  ```
6
6
 
7
- @param url value to check.
7
+ @param {string} url a fragment to check
@@ -7,5 +7,5 @@ I.seeInField({css: 'form textarea'},'Type your comment here');
7
7
  I.seeInField('form input[type=hidden]','hidden_value');
8
8
  I.seeInField('#searchform input','Search');
9
9
  ```
10
- @param field located by label|name|CSS|XPath|strict locator.
11
- @param value value to check.
10
+ @param {string|object} field located by label|name|CSS|XPath|strict locator.
11
+ @param {string} value value to check.
@@ -3,4 +3,4 @@ Checks that the current page contains the given string in its raw source code.
3
3
  ```js
4
4
  I.seeInSource('<h1>Green eggs &amp; ham</h1>');
5
5
  ```
6
- @param text value to check.
6
+ @param {string} text value to check.
@@ -1,3 +1,7 @@
1
1
  Checks that title contains text.
2
2
 
3
- @param text text value to check.
3
+ ```js
4
+ I.seeInTitle('Home Page');
5
+ ```
6
+
7
+ @param {string} text text value to check.
@@ -0,0 +1,10 @@
1
+ Asserts that an element appears a given number of times in the DOM.
2
+ Element is located by label or name or CSS or XPath.
3
+
4
+
5
+ ```js
6
+ I.seeNumberOfElements('#submitBtn', 1);
7
+ ```
8
+
9
+ @param {string|object} locator element located by CSS|XPath|strict locator.
10
+ @param {number} num number of elements.
@@ -5,5 +5,5 @@ Element is located by CSS or XPath.
5
5
  I.seeNumberOfVisibleElements('.buttons', 3);
6
6
  ```
7
7
 
8
- @param locator element located by CSS|XPath|strict locator.
9
- @param num number of elements.
8
+ @param {string|object} locator element located by CSS|XPath|strict locator.
9
+ @param {number} num number of elements.
@@ -16,5 +16,5 @@ Provide an array for the second argument to select multiple options.
16
16
  ```js
17
17
  I.selectOption('Which OS do you use?', ['Android', 'iOS']);
18
18
  ```
19
- @param select field located by label|name|CSS|XPath|strict locator.
20
- @param option visible text or value of option.
19
+ @param {string|object} select field located by label|name|CSS|XPath|strict locator.
20
+ @param {string|array} option visible text or value of option.
@@ -4,4 +4,4 @@ Sets a cookie.
4
4
  I.setCookie({name: 'auth', value: true});
5
5
  ```
6
6
 
7
- @param cookie cookie JSON object.
7
+ @param {object} cookie a cookie object.
@@ -1,3 +1,8 @@
1
1
  Switches frame or in case of null locator reverts to parent.
2
2
 
3
- @param locator element located by CSS|XPath|strict locator.
3
+ ```js
4
+ I.switchTo('iframe'); // switch to first iframe
5
+ I.switchTo(); // switch back to main page
6
+ ```
7
+
8
+ @param {string|object} locator (optional, `null` by default) element located by CSS|XPath|strict locator.
@@ -8,5 +8,5 @@ I.uncheckOption('#agree');
8
8
  I.uncheckOption('I Agree to Terms and Conditions');
9
9
  I.uncheckOption('agree', '//form');
10
10
  ```
11
- @param field checkbox located by label | name | CSS | XPath | strict locator.
12
- @param context (optional) element located by CSS | XPath | strict locator.
11
+ @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
12
+ @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
@@ -4,5 +4,4 @@ Pauses execution for a number of seconds.
4
4
  I.wait(2); // wait 2 secs
5
5
  ```
6
6
 
7
- @param sec number of second to wait.
8
- @param sec time in seconds to wait.
7
+ @param {number} sec number of second to wait.
@@ -1,9 +1,9 @@
1
1
  Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
2
2
  Element can be located by CSS or XPath.
3
3
 
4
- ```
4
+ ```js
5
5
  I.waitForDetached('#popup');
6
6
  ```
7
7
 
8
- @param locator element located by CSS|XPath|strict locator.
9
- @param sec (optional) time in seconds to wait, 1 by default.
8
+ @param {string|object} locator element located by CSS|XPath|strict locator.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -6,5 +6,5 @@ I.waitForElement('.btn.continue');
6
6
  I.waitForElement('.btn.continue', 5); // wait for 5 secs
7
7
  ```
8
8
 
9
- @param locator element located by CSS|XPath|strict locator.
10
- @param sec (optional) time in seconds to wait, 1 by default.
9
+ @param {string|object} locator element located by CSS|XPath|strict locator.
10
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -1,5 +1,5 @@
1
1
  Waits for element to become enabled (by default waits for 1sec).
2
2
  Element can be located by CSS or XPath.
3
3
 
4
- @param locator element located by CSS|XPath|strict locator.
4
+ @param {string|object} locator element located by CSS|XPath|strict locator.
5
5
  @param sec (optional) time in seconds to wait, 1 by default.
@@ -11,6 +11,6 @@ I.waitForFunction(() => window.requests == 0, 5); // waits for 5 sec
11
11
  I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and wait for 5 sec
12
12
  ```
13
13
 
14
- @param fn to be executed in browser context.
15
- @param argsOrSec (optional) arguments for function or seconds.
16
- @param sec (optional) time in seconds to wait, 1 by default.
14
+ @param {string|function} fn to be executed in browser context.
15
+ @param {array|number} argsOrSec (optional, `1` by default) arguments for function or seconds.
16
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -1,9 +1,9 @@
1
1
  Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
2
2
  Element can be located by CSS or XPath.
3
3
 
4
- ```
4
+ ```js
5
5
  I.waitForInvisible('#popup');
6
6
  ```
7
7
 
8
- @param locator element located by CSS|XPath|strict locator.
9
- @param sec (optional) time in seconds to wait, 1 by default.
8
+ @param {string|object} locator element located by CSS|XPath|strict locator.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -7,6 +7,6 @@ I.waitForText('Thank you, form has been submitted');
7
7
  I.waitForText('Thank you, form has been submitted', 5, '#modal');
8
8
  ```
9
9
 
10
- @param text to wait for.
11
- @param sec (optional) time in seconds to wait.
12
- @param context (optional) element located by CSS|XPath|strict locator.
10
+ @param {string }text to wait for.
11
+ @param {number} sec (optional, `1` by default) time in seconds to wait
12
+ @param {string|object} context (optional) element located by CSS|XPath|strict locator.
@@ -4,6 +4,6 @@ Waits for the specified value to be in value attribute.
4
4
  I.waitForValue('//input', "GoodValue");
5
5
  ```
6
6
 
7
- @param field input field.
8
- @param value expected value.
9
- @param sec (optional) time in seconds to wait, 1 sec by default.
7
+ @param {string|object} field input field.
8
+ @param {string }value expected value.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -1,9 +1,9 @@
1
1
  Waits for an element to become visible on a page (by default waits for 1sec).
2
2
  Element can be located by CSS or XPath.
3
3
 
4
- ```
4
+ ```js
5
5
  I.waitForVisible('#popup');
6
6
  ```
7
7
 
8
- @param locator element located by CSS|XPath|strict locator.
9
- @param sec (optional) time in seconds to wait, 1 by default.
8
+ @param {string|object} locator element located by CSS|XPath|strict locator.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -4,5 +4,5 @@ Waiting for the part of the URL to match the expected. Useful for SPA to underst
4
4
  I.waitInUrl('/info', 2);
5
5
  ```
6
6
 
7
- @param urlPart value to check.
8
- @param sec (optional) time in seconds to wait.
7
+ @param {string} urlPart value to check.
8
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -4,6 +4,6 @@ Waits for a specified number of elements on the page.
4
4
  I.waitNumberOfVisibleElements('a', 3);
5
5
  ```
6
6
 
7
- @param locator element located by CSS|XPath|strict locator.
8
- @param num number of elements.
9
- @param sec (optional) time in seconds to wait.
7
+ @param {string|object} locator element located by CSS|XPath|strict locator.
8
+ @param {number} num number of elements.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -1,9 +1,9 @@
1
1
  Waits for an element to hide (by default waits for 1sec).
2
2
  Element can be located by CSS or XPath.
3
3
 
4
- ```
4
+ ```js
5
5
  I.waitToHide('#popup');
6
6
  ```
7
7
 
8
- @param locator element located by CSS|XPath|strict locator.
9
- @param sec (optional) time in seconds to wait, 1 by default.
8
+ @param {string|object} locator element located by CSS|XPath|strict locator.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
@@ -5,6 +5,6 @@ I.waitUntil(() => window.requests == 0);
5
5
  I.waitUntil(() => window.requests == 0, 5);
6
6
  ```
7
7
 
8
- @param fn function which is executed in browser context.
9
- @param sec (optional) time in seconds to wait, 1 by default.
10
- @param timeoutMsg (optional) message to show in case of timeout fail.
8
+ @param {function|string} fn function which is executed in browser context.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait
10
+ @param {string} [timeoutMsg=''] message to show in case of timeout fail.
@@ -5,5 +5,5 @@ I.waitUrlEquals('/info', 2);
5
5
  I.waitUrlEquals('http://127.0.0.1:8000/info');
6
6
  ```
7
7
 
8
- @param urlPart value to check.
9
- @param sec (optional) time in seconds to wait.
8
+ @param {string} urlPart value to check.
9
+ @param {number} sec (optional, `1` by default) time in seconds to wait