codeceptjs 3.0.7 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -2
- package/README.md +9 -1
- package/bin/codecept.js +27 -17
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +76 -4
- package/docs/build/Playwright.js +186 -69
- package/docs/build/Protractor.js +2 -0
- package/docs/build/Puppeteer.js +56 -18
- package/docs/build/REST.js +12 -0
- package/docs/build/WebDriver.js +1 -3
- package/docs/changelog.md +96 -2
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/helpers/Appium.md +96 -94
- package/docs/helpers/Playwright.md +259 -202
- package/docs/helpers/Puppeteer.md +17 -1
- package/docs/helpers/REST.md +23 -9
- package/docs/helpers/WebDriver.md +2 -2
- package/docs/mobile.md +2 -1
- package/docs/playwright.md +156 -6
- package/docs/plugins.md +61 -69
- package/docs/react.md +1 -1
- package/docs/reports.md +21 -3
- package/lib/actor.js +2 -3
- package/lib/codecept.js +13 -2
- package/lib/command/definitions.js +8 -1
- package/lib/command/run-multiple/collection.js +4 -0
- package/lib/config.js +1 -1
- package/lib/container.js +3 -3
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +49 -4
- package/lib/helper/Playwright.js +186 -69
- package/lib/helper/Protractor.js +2 -0
- package/lib/helper/Puppeteer.js +56 -18
- package/lib/helper/REST.js +12 -0
- package/lib/helper/WebDriver.js +1 -3
- package/lib/helper/errors/ConnectionRefused.js +1 -1
- package/lib/helper/extras/Popup.js +1 -1
- package/lib/helper/extras/React.js +44 -32
- package/lib/index.js +2 -0
- package/lib/interfaces/gherkin.js +8 -1
- package/lib/listener/exit.js +2 -4
- package/lib/listener/helpers.js +4 -4
- package/lib/locator.js +7 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/output.js +2 -2
- package/lib/plugin/allure.js +7 -18
- package/lib/plugin/commentStep.js +1 -1
- package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +5 -3
- package/lib/step.js +4 -2
- package/package.json +4 -3
- package/typings/index.d.ts +2 -0
- package/typings/types.d.ts +158 -18
package/docs/build/REST.js
CHANGED
|
@@ -75,6 +75,8 @@ class REST extends Helper {
|
|
|
75
75
|
* Executes axios request
|
|
76
76
|
*
|
|
77
77
|
* @param {*} request
|
|
78
|
+
*
|
|
79
|
+
* @returns {Promise<*>} response
|
|
78
80
|
*/
|
|
79
81
|
async _executeRequest(request) {
|
|
80
82
|
const _debugRequest = { ...request };
|
|
@@ -143,6 +145,8 @@ class REST extends Helper {
|
|
|
143
145
|
*
|
|
144
146
|
* @param {*} url
|
|
145
147
|
* @param {object} [headers={}] - the headers object to be sent. By default it is sent as an empty object
|
|
148
|
+
*
|
|
149
|
+
* @returns {Promise<*>} response
|
|
146
150
|
*/
|
|
147
151
|
async sendGetRequest(url, headers = {}) {
|
|
148
152
|
const request = {
|
|
@@ -166,6 +170,8 @@ class REST extends Helper {
|
|
|
166
170
|
* @param {*} url
|
|
167
171
|
* @param {*} [payload={}] - the payload to be sent. By default it is sent as an empty object
|
|
168
172
|
* @param {object} [headers={}] - the headers object to be sent. By default it is sent as an empty object
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<*>} response
|
|
169
175
|
*/
|
|
170
176
|
async sendPostRequest(url, payload = {}, headers = {}) {
|
|
171
177
|
const request = {
|
|
@@ -197,6 +203,8 @@ class REST extends Helper {
|
|
|
197
203
|
* @param {string} url
|
|
198
204
|
* @param {*} [payload={}] - the payload to be sent. By default it is sent as an empty object
|
|
199
205
|
* @param {object} [headers={}] - the headers object to be sent. By default it is sent as an empty object
|
|
206
|
+
*
|
|
207
|
+
* @returns {Promise<*>} response
|
|
200
208
|
*/
|
|
201
209
|
async sendPatchRequest(url, payload = {}, headers = {}) {
|
|
202
210
|
const request = {
|
|
@@ -228,6 +236,8 @@ class REST extends Helper {
|
|
|
228
236
|
* @param {string} url
|
|
229
237
|
* @param {*} [payload={}] - the payload to be sent. By default it is sent as an empty object
|
|
230
238
|
* @param {object} [headers={}] - the headers object to be sent. By default it is sent as an empty object
|
|
239
|
+
*
|
|
240
|
+
* @returns {Promise<*>} response
|
|
231
241
|
*/
|
|
232
242
|
async sendPutRequest(url, payload = {}, headers = {}) {
|
|
233
243
|
const request = {
|
|
@@ -254,6 +264,8 @@ class REST extends Helper {
|
|
|
254
264
|
*
|
|
255
265
|
* @param {*} url
|
|
256
266
|
* @param {object} [headers={}] - the headers object to be sent. By default it is sent as an empty object
|
|
267
|
+
*
|
|
268
|
+
* @returns {Promise<*>} response
|
|
257
269
|
*/
|
|
258
270
|
async sendDeleteRequest(url, headers = {}) {
|
|
259
271
|
const request = {
|
package/docs/build/WebDriver.js
CHANGED
|
@@ -481,7 +481,7 @@ class WebDriver extends Helper {
|
|
|
481
481
|
try {
|
|
482
482
|
require('webdriverio');
|
|
483
483
|
} catch (e) {
|
|
484
|
-
return ['webdriverio@^
|
|
484
|
+
return ['webdriverio@^6.12.1'];
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
|
|
@@ -1521,7 +1521,6 @@ class WebDriver extends Helper {
|
|
|
1521
1521
|
* @param {string} attr attribute name.
|
|
1522
1522
|
* @returns {Promise<string[]>} attribute value
|
|
1523
1523
|
*
|
|
1524
|
-
* Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
1525
1524
|
*/
|
|
1526
1525
|
async grabAttributeFromAll(locator, attr) {
|
|
1527
1526
|
const res = await this._locate(locator, true);
|
|
@@ -1542,7 +1541,6 @@ class WebDriver extends Helper {
|
|
|
1542
1541
|
* @param {string} attr attribute name.
|
|
1543
1542
|
* @returns {Promise<string>} attribute value
|
|
1544
1543
|
*
|
|
1545
|
-
* Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
1546
1544
|
*/
|
|
1547
1545
|
async grabAttributeFrom(locator, attr) {
|
|
1548
1546
|
const attrs = await this.grabAttributeFromAll(locator, attr);
|
package/docs/changelog.md
CHANGED
|
@@ -7,16 +7,110 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.1.3
|
|
11
|
+
|
|
12
|
+
🛩️ Features:
|
|
13
|
+
|
|
14
|
+
* BDD Improvement. Added `DataTableArgument` class to work with table data structures.
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const { DataTableArgument } = require('codeceptjs');
|
|
18
|
+
//...
|
|
19
|
+
Given('I have an employee card', (table) => {
|
|
20
|
+
const dataTableArgument = new DataTableArgument(table);
|
|
21
|
+
const hashes = dataTableArgument.hashes();
|
|
22
|
+
// hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }];
|
|
23
|
+
const rows = dataTableArgument.rows();
|
|
24
|
+
// rows = [['Harry', 'Potter', Seeker]];
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
See updated [BDD section](https://codecept.io/bdd/) for more API options.
|
|
28
|
+
|
|
29
|
+
* Support `cjs` file extensions for config file: `codecept.conf.cjs`. See [#3052](https://github.com/codeceptjs/CodeceptJS/issues/3052) by **[kalvenschraut](https://github.com/kalvenschraut)**
|
|
30
|
+
* API updates: Added `test.file` and `suite.file` properties to `test` and `suite` objects to use in helpers and plugins.
|
|
31
|
+
|
|
32
|
+
🐛 Bugfixes:
|
|
33
|
+
|
|
34
|
+
* **[Playwright]** Fixed resetting `test.artifacts` for failing tests. See [#3033](https://github.com/codeceptjs/CodeceptJS/issues/3033) by **[jancorvus](https://github.com/jancorvus)**. Fixes [#3032](https://github.com/codeceptjs/CodeceptJS/issues/3032)
|
|
35
|
+
* **[Playwright]** Apply `basicAuth` credentials to all opened browser contexts. See [#3036](https://github.com/codeceptjs/CodeceptJS/issues/3036) by **[nikocanvacom](https://github.com/nikocanvacom)**. Fixes [#3035](https://github.com/codeceptjs/CodeceptJS/issues/3035)
|
|
36
|
+
* **[WebDriver]** Updated `webdriverio` default version to `^6.12.1`. See [#3043](https://github.com/codeceptjs/CodeceptJS/issues/3043) by **[sridhareaswaran](https://github.com/sridhareaswaran)**
|
|
37
|
+
* **[Playwright]** `I.haveRequestHeaders` affects all tabs. See [#3049](https://github.com/codeceptjs/CodeceptJS/issues/3049) by **[jancorvus](https://github.com/jancorvus)**
|
|
38
|
+
* BDD: Fixed unhandled empty feature files. Fix [#3046](https://github.com/codeceptjs/CodeceptJS/issues/3046) by **[abhimanyupandian](https://github.com/abhimanyupandian)**
|
|
39
|
+
* Fixed `RangeError: Invalid string length` in `recorder.js` when running huge amount of tests.
|
|
40
|
+
|
|
41
|
+
📖 Documentation:
|
|
42
|
+
|
|
43
|
+
* Added Testrail reporter [Reports Docs](https://codecept.io/reports/#testrail)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 3.1.2
|
|
47
|
+
|
|
48
|
+
🛩️ Features:
|
|
49
|
+
|
|
50
|
+
* Added `coverage` plugin to generate code coverage for Playwright & Puppeteer. By **[anirudh-modi](https://github.com/anirudh-modi)**
|
|
51
|
+
* Added `subtitle` plugin to generate subtitles for videos recorded with Playwright. By **[anirudh-modi](https://github.com/anirudh-modi)**
|
|
52
|
+
* Configuration: `config.tests` to accept array of file patterns. See [#2994](https://github.com/codeceptjs/CodeceptJS/issues/2994) by **[monsteramba](https://github.com/monsteramba)**
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
exports.config = {
|
|
56
|
+
tests: ['./*_test.js','./sampleTest.js'],
|
|
57
|
+
// ...
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
* Notification is shown for test files without `Feature()`. See [#3011](https://github.com/codeceptjs/CodeceptJS/issues/3011) by **[PeterNgTr](https://github.com/PeterNgTr)**
|
|
61
|
+
|
|
62
|
+
🐛 Bugfixes:
|
|
63
|
+
|
|
64
|
+
* **[Playwright]** Fixed [#2986](https://github.com/codeceptjs/CodeceptJS/issues/2986) error is thrown when deleting a missing video. Fix by **[hatufacci](https://github.com/hatufacci)**
|
|
65
|
+
* Fixed false positive result when invalid function is called in a helper. See [#2997](https://github.com/codeceptjs/CodeceptJS/issues/2997) by **[abhimanyupandian](https://github.com/abhimanyupandian)**
|
|
66
|
+
* **[Appium]** Removed full page mode for `saveScreenshot`. See [#3002](https://github.com/codeceptjs/CodeceptJS/issues/3002) by **[nlespiaucq](https://github.com/nlespiaucq)**
|
|
67
|
+
* **[Playwright]** Fixed [#3003](https://github.com/codeceptjs/CodeceptJS/issues/3003) saving trace for a test with a long name. Fix by **[hatufacci](https://github.com/hatufacci)**
|
|
68
|
+
|
|
69
|
+
🎱 Other:
|
|
70
|
+
|
|
71
|
+
* Deprecated `puppeteerCoverage` plugin in favor of `coverage` plugin.
|
|
72
|
+
|
|
73
|
+
## 3.1.1
|
|
74
|
+
|
|
75
|
+
* **[Appium]** Fixed [#2759](https://github.com/codeceptjs/CodeceptJS/issues/2759)
|
|
76
|
+
`grabNumberOfVisibleElements`, `grabAttributeFrom`, `grabAttributeFromAll` to allow id locators.
|
|
77
|
+
|
|
78
|
+
## 3.1.0
|
|
79
|
+
|
|
80
|
+
* **[Plawyright]** Updated to Playwright 1.13
|
|
81
|
+
* **[Playwright]** **Possible breaking change**: `BrowserContext` is initialized before each test and closed after. This behavior matches recommendation from Playwright team to use different contexts for tests.
|
|
82
|
+
* **[Puppeteer]** Updated to Puppeteer 10.2.
|
|
83
|
+
* **[Protractor]** Helper deprecated
|
|
84
|
+
|
|
85
|
+
🛩️ Features:
|
|
86
|
+
|
|
87
|
+
* **[Playwright]** Added recording of [video](https://codecept.io/playwright/#video) and [traces](https://codecept.io/playwright/#trace) by **[davertmik](https://github.com/davertmik)**
|
|
88
|
+
* **[Playwritght]** [Mocking requests](https://codecept.io/playwright/#mocking-network-requests) implemented via `route` API of Playwright by **[davertmik](https://github.com/davertmik)**
|
|
89
|
+
* **[Playwright]** Added **support for [React locators](https://codecept.io/react/#locators)** in [#2912](https://github.com/codeceptjs/CodeceptJS/issues/2912) by **[AAAstorga](https://github.com/AAAstorga)**
|
|
90
|
+
|
|
91
|
+
🐛 Bugfixes:
|
|
92
|
+
|
|
93
|
+
* **[Puppeteer]** Fixed [#2244](https://github.com/codeceptjs/CodeceptJS/issues/2244) `els[0]._clickablePoint is not a function` by **[karunandrii](https://github.com/karunandrii)**.
|
|
94
|
+
* **[Puppeteer]** Fixed `fillField` to check for invisible elements. See [#2916](https://github.com/codeceptjs/CodeceptJS/issues/2916) by **[anne-open-xchange](https://github.com/anne-open-xchange)**
|
|
95
|
+
* **[Playwright]** Reset of dialog event listener before registration of new one. [#2946](https://github.com/codeceptjs/CodeceptJS/issues/2946) by **[nikocanvacom](https://github.com/nikocanvacom)**
|
|
96
|
+
* Fixed running Gherkin features with `run-multiple` using chunks. See [#2900](https://github.com/codeceptjs/CodeceptJS/issues/2900) by **[andrenoberto](https://github.com/andrenoberto)**
|
|
97
|
+
* Fixed [#2937](https://github.com/codeceptjs/CodeceptJS/issues/2937) broken typings for subfolders on Windows by **[jancorvus](https://github.com/jancorvus)**
|
|
98
|
+
* Fixed issue where cucumberJsonReporter not working with fakerTransform plugin. See [#2942](https://github.com/codeceptjs/CodeceptJS/issues/2942) by **[ilangv](https://github.com/ilangv)**
|
|
99
|
+
* Fixed [#2952](https://github.com/codeceptjs/CodeceptJS/issues/2952) finished job with status code 0 when playwright cannot connect to remote wss url. By **[davertmik](https://github.com/davertmik)**
|
|
100
|
+
|
|
101
|
+
|
|
10
102
|
## 3.0.7
|
|
11
103
|
|
|
12
|
-
Documentation fixes:
|
|
104
|
+
📖 Documentation fixes:
|
|
105
|
+
|
|
13
106
|
* Remove broken link from `Nightmare helper`. See [#2860](https://github.com/codeceptjs/CodeceptJS/issues/2860) by **[Arhell](https://github.com/Arhell)**
|
|
14
107
|
* Fixed broken links in `playwright.md`. See [#2848](https://github.com/codeceptjs/CodeceptJS/issues/2848) by **[johnhoodjr](https://github.com/johnhoodjr)**
|
|
15
108
|
* Fix mocha-multi config example. See [#2881](https://github.com/codeceptjs/CodeceptJS/issues/2881) by **[rimesc](https://github.com/rimesc)**
|
|
16
109
|
* Fix small errors in email documentation file. See [#2884](https://github.com/codeceptjs/CodeceptJS/issues/2884) by **[mkrtchian](https://github.com/mkrtchian)**
|
|
17
110
|
* Improve documentation for `Sharing Data Between Workers` section. See [#2891](https://github.com/codeceptjs/CodeceptJS/issues/2891) by **[ngraf](https://github.com/ngraf)**
|
|
18
111
|
|
|
19
|
-
Features:
|
|
112
|
+
🛩️ Features:
|
|
113
|
+
|
|
20
114
|
* **[WebDriver]** Shadow DOM Support for `Webdriver`. See [#2741](https://github.com/codeceptjs/CodeceptJS/issues/2741) by **[gkushang](https://github.com/gkushang)**
|
|
21
115
|
* [Release management] Introduce the versioning automatically, it follows the semantics versioning. See [#2883](https://github.com/codeceptjs/CodeceptJS/issues/2883) by **[PeterNgTr](https://github.com/PeterNgTr)**
|
|
22
116
|
* Adding opts into `Scenario.skip` that it would be useful for building reports. See [#2867](https://github.com/codeceptjs/CodeceptJS/issues/2867) by **[AlexKo4](https://github.com/AlexKo4)**
|
package/docs/commands.md
CHANGED
|
@@ -47,18 +47,12 @@ Run single test with steps printed
|
|
|
47
47
|
npx codeceptjs run github_test.js --steps
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Run single test in debug mode
|
|
50
|
+
Run single test in debug mode (see more in [debugging](#Debugging) section)
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
npx codeceptjs run github_test.js --debug
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
Run test with internal logs printed (global promises, and events).
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
npx codeceptjs run github_test.js --verbose
|
|
60
|
-
```
|
|
61
|
-
|
|
62
56
|
Select config file manually (`-c` or `--config` option)
|
|
63
57
|
|
|
64
58
|
```sh
|
|
@@ -80,6 +74,26 @@ npx codeceptjs run --reporter xunit
|
|
|
80
74
|
|
|
81
75
|
Use any of [Mocha reporters](https://github.com/mochajs/mocha/tree/master/lib/reporters) used.
|
|
82
76
|
|
|
77
|
+
#### Debugging
|
|
78
|
+
|
|
79
|
+
Run single test in debug mode
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npx codeceptjs run --debug
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Run test with internal logs printed.
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
npx codeceptjs run --verbose
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Display complete debug output including scheduled promises
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
DEBUG=codeceptjs:* npx codeceptjs run
|
|
95
|
+
```
|
|
96
|
+
|
|
83
97
|
## Run Workers
|
|
84
98
|
|
|
85
99
|
Run tests in parallel threads.
|
package/docs/configuration.md
CHANGED
|
@@ -11,7 +11,7 @@ After running `codeceptjs init` it should be saved in test root.
|
|
|
11
11
|
|
|
12
12
|
Here is an overview of available options with their defaults:
|
|
13
13
|
|
|
14
|
-
* **tests**: `"./*_test.js"` - pattern to locate tests. Allows to enter [glob pattern](https://github.com/isaacs/node-glob).
|
|
14
|
+
* **tests**: `"./*_test.js"` - pattern to locate tests. Allows to enter [glob pattern](https://github.com/isaacs/node-glob), Can either be a pattern to locate tests or an array of patterns to locate tests / test file names.
|
|
15
15
|
* **grep**: - pattern to filter tests by name
|
|
16
16
|
* **include**: `{}` - actors and page objects to be registered in DI container and included in tests. Accepts objects and module `require` paths
|
|
17
17
|
* **timeout**: `10000` - default tests timeout
|
|
@@ -47,7 +47,20 @@ exports.config = {
|
|
|
47
47
|
require: ["ts-node/register", "should"]
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
|
-
|
|
50
|
+
For array of test pattern
|
|
51
|
+
```js
|
|
52
|
+
exports.config = {
|
|
53
|
+
tests: ['./*_test.js','./sampleTest.js'],
|
|
54
|
+
timeout: 10000,
|
|
55
|
+
output: '',
|
|
56
|
+
helpers: {},
|
|
57
|
+
include: {},
|
|
58
|
+
bootstrap: false,
|
|
59
|
+
mocha: {},
|
|
60
|
+
// require modules
|
|
61
|
+
require: ["ts-node/register", "should"]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
51
64
|
## Dynamic Configuration
|
|
52
65
|
|
|
53
66
|
By default `codecept.json` is used for configuration. You can override its values in runtime by using `--override` or `-o` option in command line, passing valid JSON as a value:
|
package/docs/helpers/Appium.md
CHANGED
|
@@ -245,10 +245,12 @@ Remove an app from the device.
|
|
|
245
245
|
I.removeApp('appName', 'com.example.android.apis');
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
+
Appium: support only Android
|
|
249
|
+
|
|
248
250
|
#### Parameters
|
|
249
251
|
|
|
250
252
|
- `appId` **[string][4]**
|
|
251
|
-
- `bundleId` **[string][4]
|
|
253
|
+
- `bundleId` **[string][4]?** ID of bundle
|
|
252
254
|
|
|
253
255
|
### seeCurrentActivityIs
|
|
254
256
|
|
|
@@ -473,10 +475,12 @@ I.hideDeviceKeyboard('tapOutside');
|
|
|
473
475
|
I.hideDeviceKeyboard('pressKey', 'Done');
|
|
474
476
|
```
|
|
475
477
|
|
|
478
|
+
Appium: support Android and iOS
|
|
479
|
+
|
|
476
480
|
#### Parameters
|
|
477
481
|
|
|
478
|
-
- `strategy` **(`"tapOutside"` \| `"pressKey"`)
|
|
479
|
-
- `key`
|
|
482
|
+
- `strategy` **(`"tapOutside"` \| `"pressKey"`)?** Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
483
|
+
- `key` **[string][4]?** Optional key
|
|
480
484
|
|
|
481
485
|
### sendDeviceKeyEvent
|
|
482
486
|
|
|
@@ -685,7 +689,7 @@ Appium: support Android and iOS
|
|
|
685
689
|
|
|
686
690
|
#### Parameters
|
|
687
691
|
|
|
688
|
-
- `actions`
|
|
692
|
+
- `actions` **[Array][11]** Array of touch actions
|
|
689
693
|
|
|
690
694
|
### pullFile
|
|
691
695
|
|
|
@@ -722,7 +726,7 @@ Perform a rotation gesture centered on the specified element.
|
|
|
722
726
|
I.rotate(120, 120)
|
|
723
727
|
```
|
|
724
728
|
|
|
725
|
-
See corresponding [webdriverio reference][
|
|
729
|
+
See corresponding [webdriverio reference][12].
|
|
726
730
|
|
|
727
731
|
Appium: support only iOS
|
|
728
732
|
|
|
@@ -739,7 +743,7 @@ Appium: support only iOS
|
|
|
739
743
|
|
|
740
744
|
Set immediate value in app.
|
|
741
745
|
|
|
742
|
-
See corresponding [webdriverio reference][
|
|
746
|
+
See corresponding [webdriverio reference][13].
|
|
743
747
|
|
|
744
748
|
Appium: support only iOS
|
|
745
749
|
|
|
@@ -926,7 +930,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
926
930
|
|
|
927
931
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
928
932
|
|
|
929
|
-
Returns **[Promise][
|
|
933
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
930
934
|
|
|
931
935
|
### grabTextFrom
|
|
932
936
|
|
|
@@ -943,7 +947,58 @@ If multiple elements found returns first element.
|
|
|
943
947
|
|
|
944
948
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
945
949
|
|
|
946
|
-
Returns **[Promise][
|
|
950
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
951
|
+
|
|
952
|
+
### grabNumberOfVisibleElements
|
|
953
|
+
|
|
954
|
+
Grab number of visible elements by locator.
|
|
955
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
956
|
+
|
|
957
|
+
```js
|
|
958
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
#### Parameters
|
|
962
|
+
|
|
963
|
+
- `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
964
|
+
|
|
965
|
+
Returns **[Promise][14]<[number][8]>** number of visible elements
|
|
966
|
+
|
|
967
|
+
### grabAttributeFrom
|
|
968
|
+
|
|
969
|
+
Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
970
|
+
|
|
971
|
+
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
972
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
973
|
+
If more than one element is found - attribute of first element is returned.
|
|
974
|
+
|
|
975
|
+
```js
|
|
976
|
+
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
#### Parameters
|
|
980
|
+
|
|
981
|
+
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
982
|
+
- `attr` **[string][4]** attribute name.
|
|
983
|
+
|
|
984
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
985
|
+
|
|
986
|
+
### grabAttributeFromAll
|
|
987
|
+
|
|
988
|
+
Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
989
|
+
Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
|
|
990
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
991
|
+
|
|
992
|
+
```js
|
|
993
|
+
let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
#### Parameters
|
|
997
|
+
|
|
998
|
+
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
999
|
+
- `attr` **[string][4]** attribute name.
|
|
1000
|
+
|
|
1001
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
947
1002
|
|
|
948
1003
|
### grabValueFromAll
|
|
949
1004
|
|
|
@@ -958,7 +1013,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
958
1013
|
|
|
959
1014
|
- `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
960
1015
|
|
|
961
|
-
Returns **[Promise][
|
|
1016
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** attribute value
|
|
962
1017
|
|
|
963
1018
|
### grabValueFrom
|
|
964
1019
|
|
|
@@ -974,7 +1029,20 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
974
1029
|
|
|
975
1030
|
- `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
976
1031
|
|
|
977
|
-
Returns **[Promise][
|
|
1032
|
+
Returns **[Promise][14]<[string][4]>** attribute value
|
|
1033
|
+
|
|
1034
|
+
### saveScreenshot
|
|
1035
|
+
|
|
1036
|
+
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
1037
|
+
Filename is relative to output folder.
|
|
1038
|
+
|
|
1039
|
+
```js
|
|
1040
|
+
I.saveScreenshot('debug.png');
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
#### Parameters
|
|
1044
|
+
|
|
1045
|
+
- `fileName` **[string][4]** file name to save.
|
|
978
1046
|
|
|
979
1047
|
### scrollIntoView
|
|
980
1048
|
|
|
@@ -1075,7 +1143,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1075
1143
|
#### Parameters
|
|
1076
1144
|
|
|
1077
1145
|
- `select` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1078
|
-
- `option` **([string][4] \| [Array][
|
|
1146
|
+
- `option` **([string][4] \| [Array][11]<any>)** visible text or value of option.Supported only for web testing
|
|
1079
1147
|
|
|
1080
1148
|
### waitForElement
|
|
1081
1149
|
|
|
@@ -1418,7 +1486,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1418
1486
|
- `locator`
|
|
1419
1487
|
- `element` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1420
1488
|
|
|
1421
|
-
Returns **[Promise][
|
|
1489
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>** HTML code for an element
|
|
1422
1490
|
|
|
1423
1491
|
### grabHTMLFrom
|
|
1424
1492
|
|
|
@@ -1435,40 +1503,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1435
1503
|
- `locator`
|
|
1436
1504
|
- `element` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1437
1505
|
|
|
1438
|
-
Returns **[Promise][
|
|
1439
|
-
|
|
1440
|
-
### grabAttributeFromAll
|
|
1441
|
-
|
|
1442
|
-
Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
|
|
1443
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1444
|
-
|
|
1445
|
-
```js
|
|
1446
|
-
let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1447
|
-
```
|
|
1448
|
-
|
|
1449
|
-
#### Parameters
|
|
1450
|
-
|
|
1451
|
-
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
1452
|
-
- `attr` **[string][4]** attribute name.
|
|
1453
|
-
|
|
1454
|
-
Returns **[Promise][13]<[Array][14]<[string][4]>>** attribute valueAppium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
1455
|
-
|
|
1456
|
-
### grabAttributeFrom
|
|
1457
|
-
|
|
1458
|
-
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
1459
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1460
|
-
If more than one element is found - attribute of first element is returned.
|
|
1461
|
-
|
|
1462
|
-
```js
|
|
1463
|
-
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1464
|
-
```
|
|
1465
|
-
|
|
1466
|
-
#### Parameters
|
|
1467
|
-
|
|
1468
|
-
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
1469
|
-
- `attr` **[string][4]** attribute name.
|
|
1470
|
-
|
|
1471
|
-
Returns **[Promise][13]<[string][4]>** attribute valueAppium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
1506
|
+
Returns **[Promise][14]<[string][4]>** HTML code for an element
|
|
1472
1507
|
|
|
1473
1508
|
### seeTextEquals
|
|
1474
1509
|
|
|
@@ -1529,7 +1564,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1529
1564
|
let pageSource = await I.grabSource();
|
|
1530
1565
|
```
|
|
1531
1566
|
|
|
1532
|
-
Returns **[Promise][
|
|
1567
|
+
Returns **[Promise][14]<[string][4]>** source code
|
|
1533
1568
|
|
|
1534
1569
|
### grabBrowserLogs
|
|
1535
1570
|
|
|
@@ -1541,7 +1576,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1541
1576
|
console.log(JSON.stringify(logs))
|
|
1542
1577
|
```
|
|
1543
1578
|
|
|
1544
|
-
Returns **([Promise][
|
|
1579
|
+
Returns **([Promise][14]<[Array][11]<[object][6]>> | [undefined][19])** all browser logs
|
|
1545
1580
|
|
|
1546
1581
|
### dontSeeInSource
|
|
1547
1582
|
|
|
@@ -1597,21 +1632,6 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1597
1632
|
- `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1598
1633
|
- `attributes` **[object][6]** attributes and their values to check.
|
|
1599
1634
|
|
|
1600
|
-
### grabNumberOfVisibleElements
|
|
1601
|
-
|
|
1602
|
-
Grab number of visible elements by locator.
|
|
1603
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1604
|
-
|
|
1605
|
-
```js
|
|
1606
|
-
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1607
|
-
```
|
|
1608
|
-
|
|
1609
|
-
#### Parameters
|
|
1610
|
-
|
|
1611
|
-
- `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
|
|
1612
|
-
|
|
1613
|
-
Returns **[Promise][13]<[number][8]>** number of visible elements
|
|
1614
|
-
|
|
1615
1635
|
### scrollTo
|
|
1616
1636
|
|
|
1617
1637
|
Scrolls to element matched by locator.
|
|
@@ -1660,27 +1680,11 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1660
1680
|
- `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
|
|
1661
1681
|
- `fileName` **[string][4]** file name to save.
|
|
1662
1682
|
|
|
1663
|
-
### saveScreenshot
|
|
1664
|
-
|
|
1665
|
-
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
1666
|
-
Filename is relative to output folder.
|
|
1667
|
-
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
1668
|
-
|
|
1669
|
-
```js
|
|
1670
|
-
I.saveScreenshot('debug.png');
|
|
1671
|
-
I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
|
|
1672
|
-
```
|
|
1673
|
-
|
|
1674
|
-
#### Parameters
|
|
1675
|
-
|
|
1676
|
-
- `fileName` **[string][4]** file name to save.
|
|
1677
|
-
- `fullPage` **[boolean][20]** (optional, `false` by default) flag to enable fullscreen screenshot mode. (optional, default `false`)
|
|
1678
|
-
|
|
1679
1683
|
### type
|
|
1680
1684
|
|
|
1681
1685
|
Types out the given text into an active field.
|
|
1682
1686
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1683
|
-
_Note:_ Should be used when [`fillField`][
|
|
1687
|
+
_Note:_ Should be used when [`fillField`][20] is not an option.
|
|
1684
1688
|
|
|
1685
1689
|
```js
|
|
1686
1690
|
// passing in a string
|
|
@@ -1697,7 +1701,7 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1697
1701
|
|
|
1698
1702
|
- `keys`
|
|
1699
1703
|
- `delay` **[number][8]?** (optional) delay in ms between key presses (optional, default `null`)
|
|
1700
|
-
- `key` **([string][4] \| [Array][
|
|
1704
|
+
- `key` **([string][4] \| [Array][11]<[string][4]>)** or array of keys to type.
|
|
1701
1705
|
|
|
1702
1706
|
### dragAndDrop
|
|
1703
1707
|
|
|
@@ -1736,7 +1740,7 @@ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
|
1736
1740
|
const windows = await I.grabAllWindowHandles();
|
|
1737
1741
|
```
|
|
1738
1742
|
|
|
1739
|
-
Returns **[Promise][
|
|
1743
|
+
Returns **[Promise][14]<[Array][11]<[string][4]>>**
|
|
1740
1744
|
|
|
1741
1745
|
### grabCurrentWindowHandle
|
|
1742
1746
|
|
|
@@ -1747,7 +1751,7 @@ Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
|
1747
1751
|
const window = await I.grabCurrentWindowHandle();
|
|
1748
1752
|
```
|
|
1749
1753
|
|
|
1750
|
-
Returns **[Promise][
|
|
1754
|
+
Returns **[Promise][14]<[string][4]>**
|
|
1751
1755
|
|
|
1752
1756
|
### switchToWindow
|
|
1753
1757
|
|
|
@@ -1797,7 +1801,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1797
1801
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1798
1802
|
```
|
|
1799
1803
|
|
|
1800
|
-
Returns **[Promise][
|
|
1804
|
+
Returns **[Promise][14]<[number][8]>** number of open tabs
|
|
1801
1805
|
|
|
1802
1806
|
### scrollPageToTop
|
|
1803
1807
|
|
|
@@ -1824,7 +1828,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1824
1828
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1825
1829
|
```
|
|
1826
1830
|
|
|
1827
|
-
Returns **[Promise][
|
|
1831
|
+
Returns **[Promise][14]<PageScrollPosition>** scroll position
|
|
1828
1832
|
|
|
1829
1833
|
### setGeoLocation
|
|
1830
1834
|
|
|
@@ -1850,7 +1854,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1850
1854
|
let geoLocation = await I.grabGeoLocation();
|
|
1851
1855
|
```
|
|
1852
1856
|
|
|
1853
|
-
Returns **[Promise][
|
|
1857
|
+
Returns **[Promise][14]<{latitude: [number][8], longitude: [number][8], altitude: [number][8]}>**
|
|
1854
1858
|
|
|
1855
1859
|
### grabElementBoundingRect
|
|
1856
1860
|
|
|
@@ -1878,7 +1882,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1878
1882
|
- `prop`
|
|
1879
1883
|
- `elementSize` **[string][4]?** x, y, width or height of the given element.
|
|
1880
1884
|
|
|
1881
|
-
Returns **([Promise][
|
|
1885
|
+
Returns **([Promise][14]<DOMRect> | [Promise][14]<[number][8]>)** Element bounding rectangle
|
|
1882
1886
|
|
|
1883
1887
|
[1]: http://codecept.io/helpers/WebDriver/
|
|
1884
1888
|
|
|
@@ -1900,13 +1904,13 @@ Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][8]>)** Element
|
|
|
1900
1904
|
|
|
1901
1905
|
[10]: http://webdriver.io/api/mobile/swipe.html
|
|
1902
1906
|
|
|
1903
|
-
[11]:
|
|
1907
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1904
1908
|
|
|
1905
|
-
[12]: http://webdriver.io/api/mobile/
|
|
1909
|
+
[12]: http://webdriver.io/api/mobile/rotate.html
|
|
1906
1910
|
|
|
1907
|
-
[13]:
|
|
1911
|
+
[13]: http://webdriver.io/api/mobile/setImmediateValue.html
|
|
1908
1912
|
|
|
1909
|
-
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1913
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1910
1914
|
|
|
1911
1915
|
[15]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
1912
1916
|
|
|
@@ -1918,6 +1922,4 @@ Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][8]>)** Element
|
|
|
1918
1922
|
|
|
1919
1923
|
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
1920
1924
|
|
|
1921
|
-
[20]:
|
|
1922
|
-
|
|
1923
|
-
[21]: #fillfield
|
|
1925
|
+
[20]: #fillfield
|