codeceptjs 3.1.0 â 3.2.0
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 +129 -3
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +94 -60
- package/docs/basics.md +1 -1
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +106 -34
- package/docs/build/FileSystem.js +1 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +97 -94
- package/docs/build/Protractor.js +68 -81
- package/docs/build/Puppeteer.js +91 -93
- package/docs/build/REST.js +1 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +71 -95
- package/docs/changelog.md +144 -2
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/custom-helpers.md +1 -36
- package/docs/helpers/Appium.md +97 -95
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Playwright.md +16 -18
- package/docs/helpers/Puppeteer.md +18 -18
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +3 -19
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/playwright.md +40 -0
- package/docs/plugins.md +185 -68
- package/docs/reports.md +23 -5
- package/lib/actor.js +20 -2
- package/lib/codecept.js +15 -2
- package/lib/command/info.js +1 -1
- package/lib/config.js +13 -1
- package/lib/container.js +3 -1
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +49 -4
- package/lib/helper/FileSystem.js +1 -0
- package/lib/helper/Playwright.js +35 -22
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +20 -19
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -16
- package/lib/index.js +2 -0
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/gherkin.js +7 -1
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/helpers.js +1 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +71 -0
- package/lib/locator.js +3 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/{puppeteerCoverage.js â coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +90 -0
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +21 -8
- package/lib/step.js +7 -2
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +6 -7
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +198 -82
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
package/docs/changelog.md
CHANGED
|
@@ -7,16 +7,158 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.2.0
|
|
11
|
+
|
|
12
|
+
đŠī¸ Features:
|
|
13
|
+
|
|
14
|
+
**Timeouts implemented**
|
|
15
|
+
* global timeouts (via `timeout` config option).
|
|
16
|
+
* _Breaking change:_ timeout option expects **timeout in seconds**, not in miliseconds as it was previously.
|
|
17
|
+
* test timeouts (via `Scenario` and `Feature` options)
|
|
18
|
+
* _Breaking change:_ `Feature().timeout()` and `Scenario().timeout()` calls has no effect and are deprecated
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
// set timeout for every test in suite to 10 secs
|
|
22
|
+
Feature('tests with timeout', { timeout: 10 });
|
|
23
|
+
|
|
24
|
+
// set timeout for this test to 20 secs
|
|
25
|
+
Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
* step timeouts (See [#3059](https://github.com/codeceptjs/CodeceptJS/issues/3059) by **[nikocanvacom](https://github.com/nikocanvacom)**)
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
// set step timeout to 5 secs
|
|
32
|
+
I.limitTime(5).click('Link');
|
|
33
|
+
```
|
|
34
|
+
* `stepTimeout` plugin introduced to automatically add timeouts for each step ([#3059](https://github.com/codeceptjs/CodeceptJS/issues/3059) by **[nikocanvacom](https://github.com/nikocanvacom)**).
|
|
35
|
+
|
|
36
|
+
[**retryTo**](/plugins/#retryto) plugin introduced to rerun a set of steps on failure:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
// editing in text in iframe
|
|
40
|
+
// if iframe was not loaded - retry 5 times
|
|
41
|
+
await retryTo(() => {
|
|
42
|
+
I.switchTo('#editor frame');
|
|
43
|
+
I.fillField('textarea', 'value');
|
|
44
|
+
}, 5);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
* **[Playwright]** added `locale` configuration
|
|
48
|
+
* **[WebDriver]** upgraded to webdriverio v7
|
|
49
|
+
|
|
50
|
+
đ Bugfixes:
|
|
51
|
+
|
|
52
|
+
* Fixed allure plugin "Unexpected endStep()" error in [#3098](https://github.com/codeceptjs/CodeceptJS/issues/3098) by **[abhimanyupandian](https://github.com/abhimanyupandian)**
|
|
53
|
+
* **[Puppeteer]** always close remote browser on test end. See [#3054](https://github.com/codeceptjs/CodeceptJS/issues/3054) by **[mattonem](https://github.com/mattonem)**
|
|
54
|
+
* stepbyStepReport Plugin: Disabled screenshots after test has failed. See [#3119](https://github.com/codeceptjs/CodeceptJS/issues/3119) by **[ioannisChalkias](https://github.com/ioannisChalkias)**
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## 3.1.3
|
|
58
|
+
|
|
59
|
+
đŠī¸ Features:
|
|
60
|
+
|
|
61
|
+
* BDD Improvement. Added `DataTableArgument` class to work with table data structures.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
const { DataTableArgument } = require('codeceptjs');
|
|
65
|
+
//...
|
|
66
|
+
Given('I have an employee card', (table) => {
|
|
67
|
+
const dataTableArgument = new DataTableArgument(table);
|
|
68
|
+
const hashes = dataTableArgument.hashes();
|
|
69
|
+
// hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }];
|
|
70
|
+
const rows = dataTableArgument.rows();
|
|
71
|
+
// rows = [['Harry', 'Potter', Seeker]];
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
See updated [BDD section](https://codecept.io/bdd/) for more API options. Thanks to **[EgorBodnar](https://github.com/EgorBodnar)**
|
|
75
|
+
|
|
76
|
+
* 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)**
|
|
77
|
+
* API updates: Added `test.file` and `suite.file` properties to `test` and `suite` objects to use in helpers and plugins.
|
|
78
|
+
|
|
79
|
+
đ Bugfixes:
|
|
80
|
+
|
|
81
|
+
* **[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)
|
|
82
|
+
* **[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)
|
|
83
|
+
* **[WebDriver]** Updated `webdriverio` default version to `^6.12.1`. See [#3043](https://github.com/codeceptjs/CodeceptJS/issues/3043) by **[sridhareaswaran](https://github.com/sridhareaswaran)**
|
|
84
|
+
* **[Playwright]** `I.haveRequestHeaders` affects all tabs. See [#3049](https://github.com/codeceptjs/CodeceptJS/issues/3049) by **[jancorvus](https://github.com/jancorvus)**
|
|
85
|
+
* BDD: Fixed unhandled empty feature files. Fix [#3046](https://github.com/codeceptjs/CodeceptJS/issues/3046) by **[abhimanyupandian](https://github.com/abhimanyupandian)**
|
|
86
|
+
* Fixed `RangeError: Invalid string length` in `recorder.js` when running huge amount of tests.
|
|
87
|
+
* **[Appium]** Fixed definitions for `touchPerform`, `hideDeviceKeyboard`, `removeApp` by **[mirao](https://github.com/mirao)**
|
|
88
|
+
|
|
89
|
+
đ Documentation:
|
|
90
|
+
|
|
91
|
+
* Added Testrail reporter [Reports Docs](https://codecept.io/reports/#testrail)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 3.1.2
|
|
95
|
+
|
|
96
|
+
đŠī¸ Features:
|
|
97
|
+
|
|
98
|
+
* Added `coverage` plugin to generate code coverage for Playwright & Puppeteer. By **[anirudh-modi](https://github.com/anirudh-modi)**
|
|
99
|
+
* Added `subtitle` plugin to generate subtitles for videos recorded with Playwright. By **[anirudh-modi](https://github.com/anirudh-modi)**
|
|
100
|
+
* Configuration: `config.tests` to accept array of file patterns. See [#2994](https://github.com/codeceptjs/CodeceptJS/issues/2994) by **[monsteramba](https://github.com/monsteramba)**
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
exports.config = {
|
|
104
|
+
tests: ['./*_test.js','./sampleTest.js'],
|
|
105
|
+
// ...
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
* Notification is shown for test files without `Feature()`. See [#3011](https://github.com/codeceptjs/CodeceptJS/issues/3011) by **[PeterNgTr](https://github.com/PeterNgTr)**
|
|
109
|
+
|
|
110
|
+
đ Bugfixes:
|
|
111
|
+
|
|
112
|
+
* **[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)**
|
|
113
|
+
* 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)**
|
|
114
|
+
* **[Appium]** Removed full page mode for `saveScreenshot`. See [#3002](https://github.com/codeceptjs/CodeceptJS/issues/3002) by **[nlespiaucq](https://github.com/nlespiaucq)**
|
|
115
|
+
* **[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)**
|
|
116
|
+
|
|
117
|
+
đą Other:
|
|
118
|
+
|
|
119
|
+
* Deprecated `puppeteerCoverage` plugin in favor of `coverage` plugin.
|
|
120
|
+
|
|
121
|
+
## 3.1.1
|
|
122
|
+
|
|
123
|
+
* **[Appium]** Fixed [#2759](https://github.com/codeceptjs/CodeceptJS/issues/2759)
|
|
124
|
+
`grabNumberOfVisibleElements`, `grabAttributeFrom`, `grabAttributeFromAll` to allow id locators.
|
|
125
|
+
|
|
126
|
+
## 3.1.0
|
|
127
|
+
|
|
128
|
+
* **[Plawyright]** Updated to Playwright 1.13
|
|
129
|
+
* **[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.
|
|
130
|
+
* **[Puppeteer]** Updated to Puppeteer 10.2.
|
|
131
|
+
* **[Protractor]** Helper deprecated
|
|
132
|
+
|
|
133
|
+
đŠī¸ Features:
|
|
134
|
+
|
|
135
|
+
* **[Playwright]** Added recording of [video](https://codecept.io/playwright/#video) and [traces](https://codecept.io/playwright/#trace) by **[davertmik](https://github.com/davertmik)**
|
|
136
|
+
* **[Playwritght]** [Mocking requests](https://codecept.io/playwright/#mocking-network-requests) implemented via `route` API of Playwright by **[davertmik](https://github.com/davertmik)**
|
|
137
|
+
* **[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)**
|
|
138
|
+
|
|
139
|
+
đ Bugfixes:
|
|
140
|
+
|
|
141
|
+
* **[Puppeteer]** Fixed [#2244](https://github.com/codeceptjs/CodeceptJS/issues/2244) `els[0]._clickablePoint is not a function` by **[karunandrii](https://github.com/karunandrii)**.
|
|
142
|
+
* **[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)**
|
|
143
|
+
* **[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)**
|
|
144
|
+
* Fixed running Gherkin features with `run-multiple` using chunks. See [#2900](https://github.com/codeceptjs/CodeceptJS/issues/2900) by **[andrenoberto](https://github.com/andrenoberto)**
|
|
145
|
+
* Fixed [#2937](https://github.com/codeceptjs/CodeceptJS/issues/2937) broken typings for subfolders on Windows by **[jancorvus](https://github.com/jancorvus)**
|
|
146
|
+
* Fixed issue where cucumberJsonReporter not working with fakerTransform plugin. See [#2942](https://github.com/codeceptjs/CodeceptJS/issues/2942) by **[ilangv](https://github.com/ilangv)**
|
|
147
|
+
* 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)**
|
|
148
|
+
|
|
149
|
+
|
|
10
150
|
## 3.0.7
|
|
11
151
|
|
|
12
|
-
Documentation fixes:
|
|
152
|
+
đ Documentation fixes:
|
|
153
|
+
|
|
13
154
|
* Remove broken link from `Nightmare helper`. See [#2860](https://github.com/codeceptjs/CodeceptJS/issues/2860) by **[Arhell](https://github.com/Arhell)**
|
|
14
155
|
* Fixed broken links in `playwright.md`. See [#2848](https://github.com/codeceptjs/CodeceptJS/issues/2848) by **[johnhoodjr](https://github.com/johnhoodjr)**
|
|
15
156
|
* Fix mocha-multi config example. See [#2881](https://github.com/codeceptjs/CodeceptJS/issues/2881) by **[rimesc](https://github.com/rimesc)**
|
|
16
157
|
* Fix small errors in email documentation file. See [#2884](https://github.com/codeceptjs/CodeceptJS/issues/2884) by **[mkrtchian](https://github.com/mkrtchian)**
|
|
17
158
|
* Improve documentation for `Sharing Data Between Workers` section. See [#2891](https://github.com/codeceptjs/CodeceptJS/issues/2891) by **[ngraf](https://github.com/ngraf)**
|
|
18
159
|
|
|
19
|
-
Features:
|
|
160
|
+
đŠī¸ Features:
|
|
161
|
+
|
|
20
162
|
* **[WebDriver]** Shadow DOM Support for `Webdriver`. See [#2741](https://github.com/codeceptjs/CodeceptJS/issues/2741) by **[gkushang](https://github.com/gkushang)**
|
|
21
163
|
* [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
164
|
* 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/custom-helpers.md
CHANGED
|
@@ -108,7 +108,7 @@ If you need to get access to web elements, it is recommended to implement operat
|
|
|
108
108
|
|
|
109
109
|
To get access for elements, connect to a corresponding helper and use `_locate` function to match web elements by CSS or XPath, like you usually do:
|
|
110
110
|
|
|
111
|
-
###
|
|
111
|
+
### Accessing Elements in WebDriver
|
|
112
112
|
|
|
113
113
|
```js
|
|
114
114
|
// inside a custom helper
|
|
@@ -304,38 +304,3 @@ class MyHelper extends Helper {
|
|
|
304
304
|
|
|
305
305
|
module.exports = MyHelper;
|
|
306
306
|
```
|
|
307
|
-
|
|
308
|
-
### Protractor Example
|
|
309
|
-
|
|
310
|
-
Protractor example demonstrates usage of global `element` and `by` objects.
|
|
311
|
-
However `browser` should be accessed from a helper instance via `this.helpers['Protractor']`;
|
|
312
|
-
We also use `chai-as-promised` library to have nice assertions with promises.
|
|
313
|
-
|
|
314
|
-
```js
|
|
315
|
-
const Helper = require('@codeceptjs/helper');
|
|
316
|
-
|
|
317
|
-
// use any assertion library you like
|
|
318
|
-
const chai = require('chai');
|
|
319
|
-
const chaiAsPromised = require('chai-as-promised');
|
|
320
|
-
chai.use(chaiAsPromised);
|
|
321
|
-
const expect = chai.expect;
|
|
322
|
-
|
|
323
|
-
class MyHelper extends Helper {
|
|
324
|
-
/**
|
|
325
|
-
* checks that authentication cookie is set
|
|
326
|
-
*/
|
|
327
|
-
seeInHistory(historyPosition, value) {
|
|
328
|
-
// access browser instance from Protractor helper
|
|
329
|
-
this.helpers['Protractor'].browser.refresh();
|
|
330
|
-
|
|
331
|
-
// you can use `element` as well as in protractor
|
|
332
|
-
const history = element.all(by.repeater('result in memory'));
|
|
333
|
-
|
|
334
|
-
// use chai as promised for better assertions
|
|
335
|
-
// end your method with `return` to handle promises
|
|
336
|
-
return expect(history.get(historyPosition).getText()).to.eventually.equal(value);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
module.exports = MyHelper;
|
|
341
|
-
```
|
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
|
|
|
@@ -1247,7 +1315,7 @@ I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
|
|
|
1247
1315
|
|
|
1248
1316
|
#### Parameters
|
|
1249
1317
|
|
|
1250
|
-
- `timeouts` **
|
|
1318
|
+
- `timeouts` **any** WebDriver timeouts object.
|
|
1251
1319
|
|
|
1252
1320
|
### amOnPage
|
|
1253
1321
|
|
|
@@ -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
|