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
@@ -116,7 +116,7 @@ class Appium extends Webdriver {
116
116
  const defaults = {
117
117
  // webdriverio defaults
118
118
  protocol: 'http',
119
- host: '0.0.0.0',
119
+ hostname: '0.0.0.0', // webdriverio specs
120
120
  port: 4723,
121
121
  path: '/wd/hub',
122
122
 
@@ -146,6 +146,8 @@ class Appium extends Webdriver {
146
146
  config.capabilities.platformName = config.platform || config.capabilities.platformName;
147
147
  config.waitForTimeout /= 1000; // convert to seconds
148
148
 
149
+ // [CodeceptJS compatible] transform host to hostname
150
+ config.hostname = config.host || config.hostname;
149
151
 
150
152
  if (!config.app && config.capabilities.browserName) {
151
153
  this.isWeb = true;
@@ -1220,13 +1222,14 @@ class Appium extends Webdriver {
1220
1222
 
1221
1223
  /**
1222
1224
  * Appends text to a input field or textarea.
1223
- Field is located by name, label, CSS or XPath
1224
-
1225
- ```js
1226
- I.appendField('#myTextField', 'appended');
1227
- ```
1228
- @param field located by label|name|CSS|XPath|strict locator
1229
- @param value text value to append.
1225
+ * Field is located by name, label, CSS or XPath
1226
+ *
1227
+ * ```js
1228
+ * I.appendField('#myTextField', 'appended');
1229
+ * ```
1230
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator
1231
+ * @param {string} value text value to append.
1232
+ * {--end--}
1230
1233
  *
1231
1234
  */
1232
1235
  async appendField(field, value) {
@@ -1236,17 +1239,18 @@ I.appendField('#myTextField', 'appended');
1236
1239
 
1237
1240
  /**
1238
1241
  * Selects a checkbox or radio button.
1239
- Element is located by label or name or CSS or XPath.
1240
-
1241
- The second parameter is a context (CSS or XPath locator) to narrow the search.
1242
-
1243
- ```js
1244
- I.checkOption('#agree');
1245
- I.checkOption('I Agree to Terms and Conditions');
1246
- I.checkOption('agree', '//form');
1247
- ```
1248
- @param field checkbox located by label | name | CSS | XPath | strict locator.
1249
- @param context (optional) element located by CSS | XPath | strict locator.
1242
+ * Element is located by label or name or CSS or XPath.
1243
+ *
1244
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
1245
+ *
1246
+ * ```js
1247
+ * I.checkOption('#agree');
1248
+ * I.checkOption('I Agree to Terms and Conditions');
1249
+ * I.checkOption('agree', '//form');
1250
+ * ```
1251
+ * @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
1252
+ * @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
1253
+ * {--end--}
1250
1254
  *
1251
1255
  */
1252
1256
  async checkOption(field) {
@@ -1256,29 +1260,30 @@ I.checkOption('agree', '//form');
1256
1260
 
1257
1261
  /**
1258
1262
  * Perform a click on a link or a button, given by a locator.
1259
- If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
1260
- For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
1261
- For images, the "alt" attribute and inner text of any parent links are searched.
1262
-
1263
- The second parameter is a context (CSS or XPath locator) to narrow the search.
1264
-
1265
- ```js
1266
- // simple link
1267
- I.click('Logout');
1268
- // button of form
1269
- I.click('Submit');
1270
- // CSS button
1271
- I.click('#form input[type=submit]');
1272
- // XPath
1273
- I.click('//form/*[@type=submit]');
1274
- // link in context
1275
- I.click('Logout', '#nav');
1276
- // using strict locator
1277
- I.click({css: 'nav a.login'});
1278
- ```
1279
-
1280
- @param locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1281
- @param context (optional) element to search in CSS|XPath|Strict locator.
1263
+ * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
1264
+ * For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
1265
+ * For images, the "alt" attribute and inner text of any parent links are searched.
1266
+ *
1267
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
1268
+ *
1269
+ * ```js
1270
+ * // simple link
1271
+ * I.click('Logout');
1272
+ * // button of form
1273
+ * I.click('Submit');
1274
+ * // CSS button
1275
+ * I.click('#form input[type=submit]');
1276
+ * // XPath
1277
+ * I.click('//form/*[@type=submit]');
1278
+ * // link in context
1279
+ * I.click('Logout', '#nav');
1280
+ * // using strict locator
1281
+ * I.click({css: 'nav a.login'});
1282
+ * ```
1283
+ *
1284
+ * @param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1285
+ * @param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1286
+ * {--end--}
1282
1287
  *
1283
1288
  */
1284
1289
  async click(locator, context) {
@@ -1288,8 +1293,15 @@ I.click({css: 'nav a.login'});
1288
1293
 
1289
1294
  /**
1290
1295
  * Verifies that the specified checkbox is not checked.
1291
-
1292
- @param field located by label|name|CSS|XPath|strict locator.
1296
+ *
1297
+ * ```js
1298
+ * I.dontSeeeCheckboxIsChedcked('#agree'); // located by ID
1299
+ * I.dontSeeeCheckboxIsChedcked('I agree to terms'); // located by label
1300
+ * I.dontSeeeCheckboxIsChedcked('agree'); // located by name
1301
+ * ```
1302
+ *
1303
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1304
+ * {--end--}
1293
1305
  *
1294
1306
  */
1295
1307
  async dontSeeCheckboxIsChecked(field) {
@@ -1299,21 +1311,31 @@ I.click({css: 'nav a.login'});
1299
1311
 
1300
1312
  /**
1301
1313
  * Opposite to `seeElement`. Checks that element is not visible (or in DOM)
1302
-
1303
- @param locator located by CSS|XPath|Strict locator.
1304
- *
1314
+ *
1315
+ * ```js
1316
+ * I.dontSeeElement('.modal'); // modal is not shown
1317
+ * ```
1318
+ *
1319
+ * @param {string|object} locator located by CSS|XPath|Strict locator.
1320
+ * {--end--}
1305
1321
  */
1306
- async dontSeeElement(locator, context) {
1322
+ async dontSeeElement(locator) {
1307
1323
  if (this.isWeb) return super.dontSeeElement(locator);
1308
1324
  return super.dontSeeElement(parseLocator.call(this, locator));
1309
1325
  }
1310
1326
 
1311
1327
  /**
1312
1328
  * Checks that value of input field or textare doesn't equal to given value
1313
- Opposite to `seeInField`.
1314
-
1315
- @param field located by label|name|CSS|XPath|strict locator.
1316
- @param value value to check.
1329
+ * Opposite to `seeInField`.
1330
+ *
1331
+ * ```js
1332
+ * I.dontSeeInField('email', 'user@user.com'); // field by name
1333
+ * I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
1334
+ * ```
1335
+ *
1336
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1337
+ * @param {string} value value to check.
1338
+ * {--end--}
1317
1339
  *
1318
1340
  */
1319
1341
  async dontSeeInField(field, value) {
@@ -1324,37 +1346,40 @@ Opposite to `seeInField`.
1324
1346
 
1325
1347
  /**
1326
1348
  * Opposite to `see`. Checks that a text is not present on a page.
1327
- Use context parameter to narrow down the search.
1328
-
1329
- ```js
1330
- I.dontSee('Login'); // assume we are already logged in
1331
- ```
1332
- @param text is not present.
1333
- @param context (optional) element located by CSS|XPath|strict locator in which to perfrom search.
1349
+ * Use context parameter to narrow down the search.
1350
+ *
1351
+ * ```js
1352
+ * I.dontSee('Login'); // assume we are already logged in.
1353
+ * I.dontSee('Login', '.nav'); // no login inside .nav element
1354
+ * ```
1355
+ *
1356
+ * @param {string} text which is not present.
1357
+ * @param {string|object} context (optional) element located by CSS|XPath|strict locator in which to perfrom search.
1334
1358
  *
1359
+ * {--end--}
1335
1360
  */
1336
- async dontSee(text, context) {
1361
+ async dontSee(text, context = null) {
1337
1362
  if (this.isWeb) return super.dontSee(text, context);
1338
1363
  return super.dontSee(text, parseLocator.call(this, context));
1339
1364
  }
1340
1365
 
1341
1366
  /**
1342
1367
  * Fills a text field or textarea, after clearing its value, with the given string.
1343
- Field is located by name, label, CSS, or XPath.
1344
-
1345
- ```js
1346
- // by label
1347
- I.fillField('Email', 'hello@world.com');
1348
- // by name
1349
- I.fillField('password', secret('123456'));
1350
- // by CSS
1351
- I.fillField('form#login input[name=username]', 'John');
1352
- // or by strict locator
1353
- I.fillField({css: 'form#login input[name=username]'}, 'John');
1354
- ```
1355
- @param field located by label|name|CSS|XPath|strict locator.
1356
- @param value text value to fill.
1357
-
1368
+ * Field is located by name, label, CSS, or XPath.
1369
+ *
1370
+ * ```js
1371
+ * // by label
1372
+ * I.fillField('Email', 'hello@world.com');
1373
+ * // by name
1374
+ * I.fillField('password', secret('123456'));
1375
+ * // by CSS
1376
+ * I.fillField('form#login input[name=username]', 'John');
1377
+ * // or by strict locator
1378
+ * I.fillField({css: 'form#login input[name=username]'}, 'John');
1379
+ * ```
1380
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1381
+ * @param {string} value text value to fill.
1382
+ * {--end--}
1358
1383
  *
1359
1384
  */
1360
1385
  async fillField(field, value) {
@@ -1365,14 +1390,16 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
1365
1390
 
1366
1391
  /**
1367
1392
  * Retrieves a text from an element located by CSS or XPath and returns it to test.
1368
- Resumes test execution, so **should be used inside async with `await`** operator.
1369
-
1370
- ```js
1371
- let pin = await I.grabTextFrom('#pin');
1372
- ```
1373
- If multiple elements found returns an array of texts.
1374
-
1375
- @param locator element located by CSS|XPath|strict locator.
1393
+ * Resumes test execution, so **should be used inside async with `await`** operator.
1394
+ *
1395
+ * ```js
1396
+ * let pin = await I.grabTextFrom('#pin');
1397
+ * ```
1398
+ * If multiple elements found returns an array of texts.
1399
+ *
1400
+ * @param locator element located by CSS|XPath|strict locator.
1401
+ * @returns {Promise<string>} attribute value
1402
+ * {--end--}
1376
1403
  *
1377
1404
  */
1378
1405
  async grabTextFrom(locator) {
@@ -1382,12 +1409,14 @@ If multiple elements found returns an array of texts.
1382
1409
 
1383
1410
  /**
1384
1411
  * Retrieves a value from a form element located by CSS or XPath and returns it to test.
1385
- Resumes test execution, so **should be used inside async function with `await`** operator.
1386
-
1387
- ```js
1388
- let email = await I.grabValueFrom('input[name=email]');
1389
- ```
1390
- @param locator field located by label|name|CSS|XPath|strict locator.
1412
+ * Resumes test execution, so **should be used inside async function with `await`** operator.
1413
+ *
1414
+ * ```js
1415
+ * let email = await I.grabValueFrom('input[name=email]');
1416
+ * ```
1417
+ * @param {string|object} locator field located by label|name|CSS|XPath|strict locator.
1418
+ * @returns {Promise<string>} attribute value
1419
+ * {--end--}
1391
1420
  *
1392
1421
  */
1393
1422
  async grabValueFrom(locator) {
@@ -1397,13 +1426,15 @@ let email = await I.grabValueFrom('input[name=email]');
1397
1426
 
1398
1427
  /**
1399
1428
  * Verifies that the specified checkbox is checked.
1400
-
1401
- ```js
1402
- I.seeCheckboxIsChecked('Agree');
1403
- I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
1404
- I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1405
- ```
1406
- @param field located by label|name|CSS|XPath|strict locator.
1429
+ *
1430
+ * ```js
1431
+ * I.seeCheckboxIsChecked('Agree');
1432
+ * I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
1433
+ * I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1434
+ * ```
1435
+ *
1436
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1437
+ * {--end--}
1407
1438
  *
1408
1439
  */
1409
1440
  async seeCheckboxIsChecked(field) {
@@ -1413,12 +1444,13 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1413
1444
 
1414
1445
  /**
1415
1446
  * Checks that a given Element is visible
1416
- Element is located by CSS or XPath.
1417
-
1418
- ```js
1419
- I.seeElement('#modal');
1420
- ```
1421
- @param locator located by CSS|XPath|strict locator.
1447
+ * Element is located by CSS or XPath.
1448
+ *
1449
+ * ```js
1450
+ * I.seeElement('#modal');
1451
+ * ```
1452
+ * @param {string|object} locator located by CSS|XPath|strict locator.
1453
+ * {--end--}
1422
1454
  *
1423
1455
  */
1424
1456
  async seeElement(locator) {
@@ -1428,16 +1460,17 @@ I.seeElement('#modal');
1428
1460
 
1429
1461
  /**
1430
1462
  * Checks that the given input field or textarea equals to given value.
1431
- For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
1432
-
1433
- ```js
1434
- I.seeInField('Username', 'davert');
1435
- I.seeInField({css: 'form textarea'},'Type your comment here');
1436
- I.seeInField('form input[type=hidden]','hidden_value');
1437
- I.seeInField('#searchform input','Search');
1438
- ```
1439
- @param field located by label|name|CSS|XPath|strict locator.
1440
- @param value value to check.
1463
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
1464
+ *
1465
+ * ```js
1466
+ * I.seeInField('Username', 'davert');
1467
+ * I.seeInField({css: 'form textarea'},'Type your comment here');
1468
+ * I.seeInField('form input[type=hidden]','hidden_value');
1469
+ * I.seeInField('#searchform input','Search');
1470
+ * ```
1471
+ * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1472
+ * @param {string} value value to check.
1473
+ * {--end--}
1441
1474
  *
1442
1475
  */
1443
1476
  async seeInField(field, value) {
@@ -1447,15 +1480,16 @@ I.seeInField('#searchform input','Search');
1447
1480
 
1448
1481
  /**
1449
1482
  * Checks that a page contains a visible text.
1450
- Use context parameter to narrow down the search.
1451
-
1452
- ```js
1453
- I.see('Welcome'); // text welcome on a page
1454
- I.see('Welcome', '.content'); // text inside .content div
1455
- I.see('Register', {css: 'form.register'}); // use strict locator
1456
- ```
1457
- @param text expected on page.
1458
- @param context (optional) element located by CSS|Xpath|strict locator in which to search for text.
1483
+ * Use context parameter to narrow down the search.
1484
+ *
1485
+ * ```js
1486
+ * I.see('Welcome'); // text welcome on a page
1487
+ * I.see('Welcome', '.content'); // text inside .content div
1488
+ * I.see('Register', {css: 'form.register'}); // use strict locator
1489
+ * ```
1490
+ * @param {string} text expected on page.
1491
+ * @param {string|object} context (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
1492
+ * {--end--}
1459
1493
  *
1460
1494
  */
1461
1495
  async see(text, context) {
@@ -1465,25 +1499,26 @@ I.see('Register', {css: 'form.register'}); // use strict locator
1465
1499
 
1466
1500
  /**
1467
1501
  * Selects an option in a drop-down select.
1468
- Field is searched by label | name | CSS | XPath.
1469
- Option is selected by visible text or by value.
1470
-
1471
- ```js
1472
- I.selectOption('Choose Plan', 'Monthly'); // select by label
1473
- I.selectOption('subscription', 'Monthly'); // match option by text
1474
- I.selectOption('subscription', '0'); // or by value
1475
- I.selectOption('//form/select[@name=account]','Premium');
1476
- I.selectOption('form select[name=account]', 'Premium');
1477
- I.selectOption({css: 'form select[name=account]'}, 'Premium');
1478
- ```
1479
-
1480
- Provide an array for the second argument to select multiple options.
1481
-
1482
- ```js
1483
- I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1484
- ```
1485
- @param select field located by label|name|CSS|XPath|strict locator.
1486
- @param option visible text or value of option.
1502
+ * Field is searched by label | name | CSS | XPath.
1503
+ * Option is selected by visible text or by value.
1504
+ *
1505
+ * ```js
1506
+ * I.selectOption('Choose Plan', 'Monthly'); // select by label
1507
+ * I.selectOption('subscription', 'Monthly'); // match option by text
1508
+ * I.selectOption('subscription', '0'); // or by value
1509
+ * I.selectOption('//form/select[@name=account]','Premium');
1510
+ * I.selectOption('form select[name=account]', 'Premium');
1511
+ * I.selectOption({css: 'form select[name=account]'}, 'Premium');
1512
+ * ```
1513
+ *
1514
+ * Provide an array for the second argument to select multiple options.
1515
+ *
1516
+ * ```js
1517
+ * I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1518
+ * ```
1519
+ * @param {string|object} select field located by label|name|CSS|XPath|strict locator.
1520
+ * @param {string|array} option visible text or value of option.
1521
+ * {--end--}
1487
1522
  *
1488
1523
  * * Supported on only for web testing!
1489
1524
  */
@@ -1494,15 +1529,16 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1494
1529
 
1495
1530
  /**
1496
1531
  * Waits for element to be present on page (by default waits for 1sec).
1497
- Element can be located by CSS or XPath.
1498
-
1499
- ```js
1500
- I.waitForElement('.btn.continue');
1501
- I.waitForElement('.btn.continue', 5); // wait for 5 secs
1502
- ```
1503
-
1504
- @param locator element located by CSS|XPath|strict locator.
1505
- @param sec (optional) time in seconds to wait, 1 by default.
1532
+ * Element can be located by CSS or XPath.
1533
+ *
1534
+ * ```js
1535
+ * I.waitForElement('.btn.continue');
1536
+ * I.waitForElement('.btn.continue', 5); // wait for 5 secs
1537
+ * ```
1538
+ *
1539
+ * @param {string|object} locator element located by CSS|XPath|strict locator.
1540
+ * @param {number} sec (optional, `1` by default) time in seconds to wait
1541
+ * {--end--}
1506
1542
  *
1507
1543
  */
1508
1544
  async waitForElement(locator, sec = null) {
@@ -1512,14 +1548,15 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
1512
1548
 
1513
1549
  /**
1514
1550
  * Waits for an element to become visible on a page (by default waits for 1sec).
1515
- Element can be located by CSS or XPath.
1516
-
1517
- ```
1518
- I.waitForVisible('#popup');
1519
- ```
1520
-
1521
- @param locator element located by CSS|XPath|strict locator.
1522
- @param sec (optional) time in seconds to wait, 1 by default.
1551
+ * Element can be located by CSS or XPath.
1552
+ *
1553
+ * ```js
1554
+ * I.waitForVisible('#popup');
1555
+ * ```
1556
+ *
1557
+ * @param {string|object} locator element located by CSS|XPath|strict locator.
1558
+ * @param {number} sec (optional, `1` by default) time in seconds to wait
1559
+ * {--end--}
1523
1560
  *
1524
1561
  */
1525
1562
  async waitForVisible(locator, sec = null) {
@@ -1529,14 +1566,15 @@ I.waitForVisible('#popup');
1529
1566
 
1530
1567
  /**
1531
1568
  * Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
1532
- Element can be located by CSS or XPath.
1533
-
1534
- ```
1535
- I.waitForInvisible('#popup');
1536
- ```
1537
-
1538
- @param locator element located by CSS|XPath|strict locator.
1539
- @param sec (optional) time in seconds to wait, 1 by default.
1569
+ * Element can be located by CSS or XPath.
1570
+ *
1571
+ * ```js
1572
+ * I.waitForInvisible('#popup');
1573
+ * ```
1574
+ *
1575
+ * @param {string|object} locator element located by CSS|XPath|strict locator.
1576
+ * @param {number} sec (optional, `1` by default) time in seconds to wait
1577
+ * {--end--}
1540
1578
  *
1541
1579
  */
1542
1580
  async waitForInvisible(locator, sec = null) {
@@ -1546,17 +1584,18 @@ I.waitForInvisible('#popup');
1546
1584
 
1547
1585
  /**
1548
1586
  * Waits for a text to appear (by default waits for 1sec).
1549
- Element can be located by CSS or XPath.
1550
- Narrow down search results by providing context.
1551
-
1552
- ```js
1553
- I.waitForText('Thank you, form has been submitted');
1554
- I.waitForText('Thank you, form has been submitted', 5, '#modal');
1555
- ```
1556
-
1557
- @param text to wait for.
1558
- @param sec (optional) time in seconds to wait.
1559
- @param context (optional) element located by CSS|XPath|strict locator.
1587
+ * Element can be located by CSS or XPath.
1588
+ * Narrow down search results by providing context.
1589
+ *
1590
+ * ```js
1591
+ * I.waitForText('Thank you, form has been submitted');
1592
+ * I.waitForText('Thank you, form has been submitted', 5, '#modal');
1593
+ * ```
1594
+ *
1595
+ * @param {string }text to wait for.
1596
+ * @param {number} sec (optional, `1` by default) time in seconds to wait
1597
+ * @param {string|object} context (optional) element located by CSS|XPath|strict locator.
1598
+ * {--end--}
1560
1599
  *
1561
1600
  */
1562
1601
  async waitForText(text, sec = null, context = null) {