codeceptjs 3.1.2 → 3.2.2

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 (67) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +2 -3
  3. package/bin/codecept.js +1 -0
  4. package/docs/advanced.md +94 -60
  5. package/docs/basics.md +27 -2
  6. package/docs/bdd.md +57 -3
  7. package/docs/build/Appium.js +8 -4
  8. package/docs/build/FileSystem.js +1 -0
  9. package/docs/build/Playwright.js +39 -30
  10. package/docs/build/Protractor.js +9 -24
  11. package/docs/build/Puppeteer.js +10 -28
  12. package/docs/build/REST.js +1 -0
  13. package/docs/build/WebDriver.js +3 -25
  14. package/docs/changelog.md +103 -0
  15. package/docs/commands.md +21 -7
  16. package/docs/custom-helpers.md +1 -36
  17. package/docs/helpers/Appium.md +34 -30
  18. package/docs/helpers/FileSystem.md +1 -1
  19. package/docs/helpers/Playwright.md +16 -18
  20. package/docs/helpers/Puppeteer.md +1 -17
  21. package/docs/helpers/REST.md +3 -1
  22. package/docs/helpers/WebDriver.md +1 -17
  23. package/docs/mobile-react-native-locators.md +3 -0
  24. package/docs/pageobjects.md +2 -0
  25. package/docs/playwright.md +16 -33
  26. package/docs/plugins.md +128 -3
  27. package/docs/reports.md +23 -5
  28. package/lib/actor.js +20 -2
  29. package/lib/codecept.js +2 -0
  30. package/lib/command/info.js +1 -1
  31. package/lib/config.js +13 -1
  32. package/lib/container.js +3 -1
  33. package/lib/data/dataTableArgument.js +35 -0
  34. package/lib/helper/Appium.js +8 -4
  35. package/lib/helper/FileSystem.js +1 -0
  36. package/lib/helper/Playwright.js +39 -20
  37. package/lib/helper/Protractor.js +2 -14
  38. package/lib/helper/Puppeteer.js +3 -18
  39. package/lib/helper/REST.js +1 -0
  40. package/lib/helper/WebDriver.js +3 -15
  41. package/lib/index.js +2 -0
  42. package/lib/interfaces/featureConfig.js +3 -0
  43. package/lib/interfaces/gherkin.js +7 -1
  44. package/lib/interfaces/scenarioConfig.js +4 -0
  45. package/lib/listener/helpers.js +1 -0
  46. package/lib/listener/steps.js +21 -3
  47. package/lib/listener/timeout.js +72 -0
  48. package/lib/locator.js +3 -0
  49. package/lib/mochaFactory.js +2 -3
  50. package/lib/plugin/allure.js +6 -1
  51. package/lib/plugin/coverage.js +1 -1
  52. package/lib/plugin/retryFailedStep.js +4 -3
  53. package/lib/plugin/retryTo.js +130 -0
  54. package/lib/plugin/screenshotOnFail.js +1 -0
  55. package/lib/plugin/stepByStepReport.js +7 -0
  56. package/lib/plugin/stepTimeout.js +91 -0
  57. package/lib/recorder.js +23 -9
  58. package/lib/step.js +58 -0
  59. package/lib/store.js +2 -0
  60. package/lib/ui.js +2 -2
  61. package/package.json +4 -6
  62. package/typings/index.d.ts +8 -1
  63. package/typings/types.d.ts +103 -70
  64. package/docs/angular.md +0 -325
  65. package/docs/helpers/Protractor.md +0 -1658
  66. package/docs/webapi/waitUntil.mustache +0 -11
  67. package/typings/Protractor.d.ts +0 -16
package/CHANGELOG.md CHANGED
@@ -1,3 +1,106 @@
1
+ ## 3.2.2
2
+
3
+ * [Playwright] Reverted removal of retry on context errors. Fixes #3130
4
+ * Timeout improvements by @nikocanvacom:
5
+ * Added priorites to timeouts
6
+ * Added `overrideStepLimits` to [stepTimeout plugin](https://codecept.io/plugins/#steptimeout) to override steps timeouts set by `limitTime`.
7
+ * Fixed step timeout not working due to override by NaN by test timeout #3126
8
+ * [Appium] Fixed logging error when `manualStart` is true. See #3140 by @nikocanvacom
9
+
10
+
11
+ ## 3.2.1
12
+
13
+ > ♻️ This release fixes hanging of tests by reducing timeouts for automatic retries on failures.
14
+
15
+ * [retryFailedStep plugin] **New Defaults**: retries steps up to 3 times with factor of 1.5 (previously 5 with factor 2)
16
+ * [Playwright] - disabled retry on failed context actions (not needed anymore)
17
+ * [Puppeteer] - reduced retries on context failures to 3 times.
18
+ * [Playwright] Handling `crash` event to automatically close crashed pages.
19
+
20
+ ## 3.2.0
21
+
22
+ 🛩️ Features:
23
+
24
+ **[Timeouts](https://codecept.io/advanced/#timeout) implemented**
25
+ * global timeouts (via `timeout` config option).
26
+ * _Breaking change:_ timeout option expects **timeout in seconds**, not in milliseconds as it was previously.
27
+ * test timeouts (via `Scenario` and `Feature` options)
28
+ * _Breaking change:_ `Feature().timeout()` and `Scenario().timeout()` calls has no effect and are deprecated
29
+
30
+ ```js
31
+ // set timeout for every test in suite to 10 secs
32
+ Feature('tests with timeout', { timeout: 10 });
33
+
34
+ // set timeout for this test to 20 secs
35
+ Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {});
36
+ ```
37
+
38
+ * step timeouts (See #3059 by @nikocanvacom)
39
+
40
+ ```js
41
+ // set step timeout to 5 secs
42
+ I.limitTime(5).click('Link');
43
+ ```
44
+ * `stepTimeout` plugin introduced to automatically add timeouts for each step (#3059 by @nikocanvacom).
45
+
46
+ [**retryTo**](/plugins/#retryto) plugin introduced to rerun a set of steps on failure:
47
+
48
+ ```js
49
+ // editing in text in iframe
50
+ // if iframe was not loaded - retry 5 times
51
+ await retryTo(() => {
52
+ I.switchTo('#editor frame');
53
+ I.fillField('textarea', 'value');
54
+ }, 5);
55
+ ```
56
+
57
+ * [Playwright] added `locale` configuration
58
+ * [WebDriver] upgraded to webdriverio v7
59
+
60
+ 🐛 Bugfixes:
61
+
62
+ * Fixed allure plugin "Unexpected endStep()" error in #3098 by @abhimanyupandian
63
+ * [Puppeteer] always close remote browser on test end. See #3054 by @mattonem
64
+ * stepbyStepReport Plugin: Disabled screenshots after test has failed. See #3119 by @ioannisChalkias
65
+
66
+
67
+ ## 3.1.3
68
+
69
+ 🛩️ Features:
70
+
71
+ * BDD Improvement. Added `DataTableArgument` class to work with table data structures.
72
+
73
+ ```js
74
+ const { DataTableArgument } = require('codeceptjs');
75
+ //...
76
+ Given('I have an employee card', (table) => {
77
+ const dataTableArgument = new DataTableArgument(table);
78
+ const hashes = dataTableArgument.hashes();
79
+ // hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }];
80
+ const rows = dataTableArgument.rows();
81
+ // rows = [['Harry', 'Potter', Seeker]];
82
+ }
83
+ ```
84
+ See updated [BDD section](https://codecept.io/bdd/) for more API options. Thanks to @EgorBodnar
85
+
86
+ * Support `cjs` file extensions for config file: `codecept.conf.cjs`. See #3052 by @kalvenschraut
87
+ * API updates: Added `test.file` and `suite.file` properties to `test` and `suite` objects to use in helpers and plugins.
88
+
89
+ 🐛 Bugfixes:
90
+
91
+ * [Playwright] Fixed resetting `test.artifacts` for failing tests. See #3033 by @jancorvus. Fixes #3032
92
+ * [Playwright] Apply `basicAuth` credentials to all opened browser contexts. See #3036 by @nikocanvacom. Fixes #3035
93
+ * [WebDriver] Updated `webdriverio` default version to `^6.12.1`. See #3043 by @sridhareaswaran
94
+ * [Playwright] `I.haveRequestHeaders` affects all tabs. See #3049 by @jancorvus
95
+ * BDD: Fixed unhandled empty feature files. Fix #3046 by @abhimanyupandian
96
+ * Fixed `RangeError: Invalid string length` in `recorder.js` when running huge amount of tests.
97
+ * [Appium] Fixed definitions for `touchPerform`, `hideDeviceKeyboard`, `removeApp` by @mirao
98
+
99
+ 📖 Documentation:
100
+
101
+ * Added Testrail reporter [Reports Docs](https://codecept.io/reports/#testrail)
102
+
103
+
1
104
  ## 3.1.2
2
105
 
3
106
  🛩️ Features:
package/README.md CHANGED
@@ -29,7 +29,7 @@ Scenario('check Welcome page on site', ({ I }) => {
29
29
 
30
30
  CodeceptJS tests are:
31
31
 
32
- * **Synchronous**. You don't need to care about callbacks, or promises, test scenarios are linear, your test should be too.
32
+ * **Synchronous**. You don't need to care about callbacks or promises or test scenarios which are linear. But, your tests should be linear.
33
33
  * Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons.
34
34
  * Backend **API agnostic**. We don't know which WebDriver implementation is running this test. We can easily switch from WebDriverIO to Protractor or PhantomJS.
35
35
 
@@ -38,11 +38,10 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently C
38
38
  * [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
39
39
  * [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
40
40
  * [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol.
41
- * [**Protractor**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Protractor.md) - helper empowered by [Protractor](http://protractortest.org/) to run tests via WebDriver protocol.
42
41
  * [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation.
43
42
  * [**Nightmare**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - uses Electron and NightmareJS to run tests.
44
43
  * [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
45
- * [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimied to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
44
+ * [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
46
45
 
47
46
  And more to come...
48
47
 
package/bin/codecept.js CHANGED
@@ -105,6 +105,7 @@ program.command('run [test]')
105
105
  .option('-c, --config [file]', 'configuration file to be used')
106
106
  .option('--features', 'run only *.feature files and skip tests')
107
107
  .option('--tests', 'run only JS test files and skip features')
108
+ .option('--no-timeouts', 'disable all timeouts')
108
109
  .option('-p, --plugins <k=v,k2=v2,...>', 'enable plugins, comma-separated')
109
110
 
110
111
  // mocha options
package/docs/advanced.md CHANGED
@@ -100,7 +100,7 @@ Scenario('update user profile', ({ }) => {
100
100
  All tests with `@tag` could be executed with `--grep @tag` option.
101
101
 
102
102
  ```sh
103
- codeceptjs run --grep @slow
103
+ npx codeceptjs run --grep @slow
104
104
  ```
105
105
 
106
106
  Use regex for more flexible filtering:
@@ -119,24 +119,30 @@ CodeceptJS provides a debug mode in which additional information is printed.
119
119
  It can be turned on with `--debug` flag.
120
120
 
121
121
  ```sh
122
- codeceptjs run --debug
122
+ npx codeceptjs run --debug
123
123
  ```
124
124
 
125
125
  to receive even more information turn on `--verbose` flag:
126
126
 
127
127
  ```sh
128
- codeceptjs run --verbose
128
+ npx codeceptjs run --verbose
129
129
  ```
130
130
 
131
- And don't forget that you can pause execution and enter **interactive console** mode by calling `pause()` inside your test.
131
+ > You can pause execution and enter **interactive console** mode by calling `pause()` inside your test.
132
132
 
133
- For advanced debugging use NodeJS debugger. In WebStorm IDE:
133
+ To see a complete internal debug of CodeceptJS use `DEBUG` env variable:
134
+
135
+ ```sh
136
+ DEBUG=codeceptjs:* npx codeceptjs run
137
+ ```
138
+
139
+ For an interactive debugging use NodeJS debugger. In **WebStorm**:
134
140
 
135
141
  ```sh
136
142
  node $NODE_DEBUG_OPTION ./node_modules/.bin/codeceptjs run
137
143
  ```
138
144
 
139
- For Visual Studio Code, add the following configuration in launch.json:
145
+ For **Visual Studio Code**, add the following configuration in launch.json:
140
146
 
141
147
  ```json
142
148
  {
@@ -180,29 +186,99 @@ You can use this options for build your own [plugins](https://codecept.io/hooks/
180
186
  });
181
187
  ```
182
188
 
183
- ### Timeout
189
+ ## Timeout <Badge text="Updated in 3.2" type="warning"/>
184
190
 
185
- By default there is no timeout for tests, however you can change this value for a specific suite:
191
+ Tests can get stuck due to various reasons such as network connection issues, crashed browser, etc.
192
+ This can make tests process hang. To prevent these situations timeouts can be used. Timeouts can be set explicitly for flaky parts of code, or implicitly in a config.
193
+
194
+ > Previous timeout implementation was disabled as it had no effect when dealing with steps and promises.
195
+
196
+ ### Steps Timeout
197
+
198
+ It is possible to limit a step execution to specified time with `I.limitTime` command.
199
+ It will set timeout in seconds for the next executed step:
186
200
 
187
201
  ```js
188
- Feature('Stop me').timeout(5000); // set timeout to 5s
202
+ // limit clicking to 5 seconds
203
+ I.limitTime(5).click('Link')
189
204
  ```
190
205
 
191
- or for the test:
206
+ It is possible to set a timeout for all steps implicitly (except waiters) using [stepTimeout plugin](/plugins/#steptimeout).
207
+
208
+ ### Tests Timeout
209
+
210
+ Test timeout can be set in seconds via Scenario options:
192
211
 
193
212
  ```js
194
- // set timeout to 1s
195
- Scenario("Stop me faster",({ I }) => {
196
- // test goes here
197
- }).timeout(1000);
213
+ // limit test to 20 seconds
214
+ Scenario('slow test that should be stopped', { timeout: 20 }, ({ I }) => {
215
+ // ...
216
+ })
217
+ ```
198
218
 
199
- // alternative
200
- Scenario("Stop me faster", {timeout: 1000},({ I }) => {});
219
+ This timeout can be set globally in `codecept.conf.js` in seconds:
201
220
 
202
- // disable timeout for this scenario
203
- Scenario("Don't stop me", {timeout: 0},({ I }) => {});
221
+ ```js
222
+ exports.config = {
223
+
224
+ // each test must not run longer than 5 mins
225
+ timeout: 300,
226
+
227
+ }
204
228
  ```
205
229
 
230
+ ### Suites Timeout
231
+
232
+ A timeout for a group of tests can be set on Feature level via options.
233
+
234
+ ```js
235
+ // limit all tests in this suite to 30 seconds
236
+ Feature('flaky tests', { timeout: 30 })
237
+ ```
238
+
239
+ ### Sum Up
240
+
241
+ Let's list all available timeout options.
242
+
243
+ Timeouts can be set globally in config:
244
+
245
+ ```js
246
+ // in codecept.confg.js:
247
+ { // ...
248
+ timeout: 30, // limit all tests in all suites to 30 secs
249
+
250
+ plugins: {
251
+ stepTimeout: {
252
+ enabled: true,
253
+ timeout: 10, // limit all steps except waiters to 10 secs
254
+ }
255
+ }
256
+ }
257
+
258
+ ```
259
+
260
+ or inside a test file:
261
+
262
+ ```js
263
+ // limit all tests in this suite to 10 secs
264
+ Feature('tests with timeout', { timeout: 10 });
265
+
266
+ // limit this test to 20 secs
267
+ Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {
268
+ // limit step to 5 seconds
269
+ I.limitTime(5).click('Link');
270
+ });
271
+ ```
272
+
273
+ Global timeouts will be overridden by explicit timeouts of a test or steps.
274
+
275
+ ### Disable Timeouts
276
+
277
+ To execute tests ignoring all timeout settings use `--no-timeouts` option:
278
+
279
+ ```
280
+ npx codeceptjs run --no-timeouts
281
+ ```
206
282
 
207
283
  ## Dynamic Configuration
208
284
 
@@ -249,45 +325,3 @@ Please note that some config changes can't be applied on the fly. For instance,
249
325
 
250
326
  Configuration changes will be reverted after a test or a suite.
251
327
 
252
-
253
- ### Rerunning Flaky Tests Multiple Times <Badge text="Since 2.4" type="warning"/>
254
-
255
- End to end tests can be flaky for various reasons. Even when we can't do anything to solve this problem it we can do next two things:
256
-
257
- * Detect flaky tests in our suite
258
- * Fix flaky tests by rerunning them.
259
-
260
- Both tasks can be achieved with [`run-rerun` command](/commands/#run-rerun) which runs tests multiple times until all tests are passed.
261
-
262
- You should set min and max runs boundaries so when few tests fail in a row you can rerun them until they are succeeded.
263
-
264
- ```js
265
- // inside to codecept.conf.js
266
- exports.config = { // ...
267
- rerun: {
268
- // run 4 times until 1st success
269
- minSuccess: 1,
270
- maxReruns: 4,
271
- }
272
- }
273
- ```
274
-
275
- If you want to check all your tests for stability you can set high boundaries for minimal success:
276
-
277
- ```js
278
- // inside to codecept.conf.js
279
- exports.config = { // ...
280
- rerun: {
281
- // run all tests must pass exactly 5 times
282
- minSuccess: 5,
283
- maxReruns: 5,
284
- }
285
- }
286
- ```
287
-
288
- Now execute tests with `run-rerun` command:
289
-
290
- ```
291
- npx codeceptjs run-rerun
292
- ```
293
-
package/docs/basics.md CHANGED
@@ -41,7 +41,6 @@ Refer to following guides to more information on:
41
41
  * [▶ Playwright](/playwright)
42
42
  * [▶ WebDriver](/webdriver)
43
43
  * [▶ Puppeteer](/puppeteer)
44
- * [▶ Protractor](/angular)
45
44
  * [▶ Nightmare](/nightmare)
46
45
  * [▶ TestCafe](/testcafe)
47
46
 
@@ -108,7 +107,7 @@ I.seeElement({name: 'password'});
108
107
  I.seeElement({react: 'user-profile', props: {name: 'davert'}});
109
108
  ```
110
109
 
111
- In [mobile testing](http://codecept.io/mobile/#locating-elements) you can use `~` to specify the accessibility id to locate an element. In web application you can locate elements by their `aria-label` value.
110
+ In [mobile testing](https://codecept.io/mobile/#locating-elements) you can use `~` to specify the accessibility id to locate an element. In web application you can locate elements by their `aria-label` value.
112
111
 
113
112
  ```js
114
113
  // locate element by [aria-label] attribute in web
@@ -317,6 +316,32 @@ var assert = require('assert');
317
316
  assert.equal(title, 'CodeceptJS');
318
317
  ```
319
318
 
319
+ It is important to understand the usage of **async** functions in CodeceptJS. While non-returning actions can be called without await, if an async function uses `grab*` action it must be called with `await`:
320
+
321
+ ```js
322
+ // a helper function
323
+ async function getAllUsers(I) {
324
+ const users = await I.grabTextFrom('.users');
325
+ return users.filter(u => u.includes('active'))
326
+ }
327
+
328
+ // a test
329
+ Scenario('try helper functions', async ({ I }) => {
330
+ // we call function with await because it includes `grab`
331
+ const users = await getAllUsers(I);
332
+ });
333
+ ```
334
+
335
+ If you miss `await` you get commands unsynchrhonized. And this will result to an error like this:
336
+
337
+ ```
338
+ (node:446390) UnhandledPromiseRejectionWarning: ...
339
+ at processTicksAndRejections (internal/process/task_queues.js:95:5)
340
+ (node:446390) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
341
+ ```
342
+
343
+ If you face that error please make sure that all async functions are called with `await`.
344
+
320
345
  ## Running Tests
321
346
 
322
347
  To launch tests use the `run` command, and to execute tests in [multiple browsers](/advanced/#multiple-browsers-execution) or [multiple threads](/advanced/#parallel-execution) use the `run-multiple` command.
package/docs/bdd.md CHANGED
@@ -5,7 +5,7 @@ title: Behavior Driven Development
5
5
 
6
6
  # Behavior Driven Development
7
7
 
8
- Behavior Driven Development (BDD) is a popular software development methodology. BDD is considered an extension of TDD, and is greatly inspired by [Agile](http://agilemanifesto.org/) practices. The primary reason to choose BDD as your development process is to break down communication barriers between business and technical teams. BDD encourages the use of automated testing to verify all documented features of a project from the very beginning. This is why it is common to talk about BDD in the context of test frameworks (like CodeceptJS). The BDD approach, however, is about much more than testing - it is a common language for all team members to use during the development process.
8
+ Behavior Driven Development (BDD) is a popular software development methodology. BDD is considered an extension of TDD, and is greatly inspired by [Agile](https://agilemanifesto.org/) practices. The primary reason to choose BDD as your development process is to break down communication barriers between business and technical teams. BDD encourages the use of automated testing to verify all documented features of a project from the very beginning. This is why it is common to talk about BDD in the context of test frameworks (like CodeceptJS). The BDD approach, however, is about much more than testing - it is a common language for all team members to use during the development process.
9
9
 
10
10
  ## What is Behavior Driven Development
11
11
 
@@ -55,7 +55,7 @@ I should see that total number of products I want to buy is 2
55
55
  And my order amount is $1600
56
56
  ```
57
57
 
58
- As we can see this simple story highlights core concepts that are called *contracts*. We should fulfill those contracts to model software correctly. But how we can verify that those contracts are being satisfied? [Cucumber](http://cucumber.io) introduced a special language for such stories called **Gherkin**. Same story transformed to Gherkin will look like this:
58
+ As we can see this simple story highlights core concepts that are called *contracts*. We should fulfill those contracts to model software correctly. But how we can verify that those contracts are being satisfied? [Cucumber](https://cucumber.io) introduced a special language for such stories called **Gherkin**. Same story transformed to Gherkin will look like this:
59
59
 
60
60
  ```gherkin
61
61
  Feature: checkout process
@@ -264,8 +264,10 @@ You can also use the `parse()` method to obtain an object that allow you to get
264
264
  - `raw()` - returns the table as a 2-D array
265
265
  - `rows()` - returns the table as a 2-D array, without the first row
266
266
  - `hashes()` - returns an array of objects where each row is converted to an object (column header is the key)
267
+ - `rowsHash()` - returns an object where each row corresponds to an entry(first column is the key, second column is the value)
268
+ - `transpose()` - transpose the data, returns nothing. To work with the transposed table use the methods above.
267
269
 
268
- If we use hashes() with the previous exemple :
270
+ If we use hashes() with the previous example :
269
271
 
270
272
  ```js
271
273
  Given('I have products in my cart', (table) => { // eslint-disable-line
@@ -281,7 +283,59 @@ Given('I have products in my cart', (table) => { // eslint-disable-line
281
283
  }
282
284
  });
283
285
  ```
286
+ Examples of tables using:
284
287
 
288
+ ```gherkin
289
+ Given I have a short employees card
290
+ | Harry | Potter |
291
+ | Chuck | Norris |
292
+ ```
293
+ ```js
294
+ const { DataTableArgument } = require('codeceptjs');
295
+ //...
296
+ Given('I have a short employees card', (table) => {
297
+ const dataTableArgument = new DataTableArgument(table);
298
+ const raw = dataTableArgument.raw();
299
+ // row = [['Harry', 'Potter'], ['Chuck', 'Norris']]
300
+ dataTableArgument.transpose();
301
+ const transposedRaw = dataTableArgument.raw();
302
+ // transposedRaw = [['Harry', 'Chuck'], ['Potter', 'Norris']];
303
+ }
304
+ );
305
+ ```
306
+ ```gherkin
307
+ Given I have an employee card
308
+ | name | surname | position |
309
+ | Harry | Potter | Seeker |
310
+ ```
311
+ ```js
312
+ const { DataTableArgument } = require('codeceptjs');
313
+ //...
314
+ Given('I have an employee card', (table) => {
315
+ const dataTableArgument = new DataTableArgument(table);
316
+ const hashes = dataTableArgument.hashes();
317
+ // hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }];
318
+ const rows = dataTableArgument.rows();
319
+ // rows = [['Harry', 'Potter', Seeker]];
320
+ }
321
+ );
322
+ ```
323
+ ```gherkin
324
+ Given I have a formatted employee card
325
+ | name | Harry |
326
+ | surname | Potter |
327
+ | position | Seeker |
328
+ ```
329
+ ```js
330
+ const { DataTableArgument } = require('codeceptjs');
331
+ //...
332
+ Given('I have a formatted employee card', (table) => {
333
+ const dataTableArgument = new DataTableArgument(table);
334
+ const rawHash = dataTableArgument.rowsHash();
335
+ // rawHash = { name: 'Harry', surname: 'Potter', position: 'Seeker' };
336
+ }
337
+ );
338
+ ```
285
339
  ### Examples
286
340
 
287
341
  In case scenarios represent the same logic but differ on data, we can use *Scenario Outline* to provide different examples for the same behavior. Scenario outline is just like a basic scenario with some values replaced with placeholders, which are filled from a table. Each set of values is executed as a different test.
@@ -481,10 +481,11 @@ class Appium extends Webdriver {
481
481
  * ```js
482
482
  * I.removeApp('appName', 'com.example.android.apis');
483
483
  * ```
484
- * @param {string} appId
485
- * @param {string} bundleId String ID of bundle
486
484
  *
487
485
  * Appium: support only Android
486
+ *
487
+ * @param {string} appId
488
+ * @param {string} [bundleId] ID of bundle
488
489
  */
489
490
  async removeApp(appId, bundleId) {
490
491
  onlyForApps.call(this, 'Android');
@@ -820,9 +821,10 @@ class Appium extends Webdriver {
820
821
  * I.hideDeviceKeyboard('pressKey', 'Done');
821
822
  * ```
822
823
  *
823
- * @param {'tapOutside' | 'pressKey'} strategy desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
824
- *
825
824
  * Appium: support Android and iOS
825
+ *
826
+ * @param {'tapOutside' | 'pressKey'} [strategy] Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
827
+ * @param {string} [key] Optional key
826
828
  */
827
829
  async hideDeviceKeyboard(strategy, key) {
828
830
  onlyForApps.call(this);
@@ -1162,6 +1164,8 @@ class Appium extends Webdriver {
1162
1164
  * ```
1163
1165
  *
1164
1166
  * Appium: support Android and iOS
1167
+ *
1168
+ * @param {Array} actions Array of touch actions
1165
1169
  */
1166
1170
  async touchPerform(actions) {
1167
1171
  onlyForApps.call(this);
@@ -91,6 +91,7 @@ class FileSystem extends Helper {
91
91
  * I.amInPath('output/downloads');
92
92
  * I.seeFileNameMatching('.pdf');
93
93
  * ```
94
+ * @param {string} text
94
95
  */
95
96
  seeFileNameMatching(text) {
96
97
  assert.ok(