codeceptjs 2.3.4 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +28 -6
- package/bin/codecept.js +42 -0
- package/docs/advanced.md +45 -1
- package/docs/angular.md +3 -3
- package/docs/basics.md +162 -118
- package/docs/bdd.md +30 -5
- package/docs/best.md +8 -6
- package/docs/books.md +6 -1
- package/docs/build/Appium.js +95 -85
- package/docs/build/FileSystem.js +48 -3
- package/docs/build/GraphQL.js +3 -2
- package/docs/build/GraphQLDataFactory.js +1 -0
- package/docs/build/Mochawesome.js +3 -2
- package/docs/build/MockRequest.js +23 -5
- package/docs/build/Nightmare.js +87 -128
- package/docs/build/Protractor.js +107 -155
- package/docs/build/Puppeteer.js +190 -174
- package/docs/build/REST.js +13 -9
- package/docs/build/SeleniumWebdriver.js +0 -17
- package/docs/build/TestCafe.js +164 -158
- package/docs/build/WebDriver.js +236 -211
- package/docs/build/WebDriverIO.js +218 -187
- package/docs/changelog.md +57 -1
- package/docs/commands.md +41 -2
- package/docs/community-helpers.md +12 -1
- package/docs/configuration.md +5 -2
- package/docs/continuous-integration.md +22 -0
- package/docs/{helpers.md → custom-helpers.md} +16 -10
- package/docs/data.md +7 -6
- package/docs/detox.md +6 -6
- package/docs/email.md +4 -2
- package/docs/examples.md +22 -3
- package/docs/helpers/ApiDataFactory.md +15 -13
- package/docs/helpers/Appium.md +1011 -468
- package/docs/helpers/Detox.md +33 -26
- package/docs/helpers/FileSystem.md +43 -13
- package/docs/helpers/GraphQL.md +17 -15
- package/docs/helpers/GraphQLDataFactory.md +15 -13
- package/docs/helpers/Mochawesome.md +3 -1
- package/docs/helpers/MockRequest.md +37 -19
- package/docs/helpers/Nightmare.md +129 -240
- package/docs/helpers/Polly.md +1 -1
- package/docs/helpers/Protractor.md +157 -298
- package/docs/helpers/Puppeteer.md +216 -335
- package/docs/helpers/REST.md +29 -24
- package/docs/helpers/TestCafe.md +137 -235
- package/docs/helpers/WebDriver.md +250 -347
- package/docs/hooks.md +14 -10
- package/docs/index.md +112 -0
- package/docs/installation.md +3 -1
- package/docs/locators.md +19 -8
- package/docs/mobile-react-native-locators.md +2 -2
- package/docs/mobile.md +5 -3
- package/docs/nightmare.md +2 -1
- package/docs/pageobjects.md +4 -2
- package/docs/parallel.md +4 -2
- package/docs/plugins.md +41 -15
- package/docs/puppeteer.md +8 -6
- package/docs/quickstart.md +130 -0
- package/docs/react.md +4 -2
- package/docs/reports.md +6 -4
- package/docs/testcafe.md +10 -8
- package/docs/translation.md +4 -2
- package/docs/ui.md +56 -0
- package/docs/videos.md +11 -2
- package/docs/visual.md +7 -5
- package/docs/vue.md +121 -0
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +2 -2
- package/docs/webapi/dontSee.mustache +1 -2
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -1
- package/docs/webapi/executeScript.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/grabAttributeFrom.mustache +1 -1
- package/docs/webapi/grabBrowserLogs.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +2 -2
- package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
- package/docs/webapi/grabHTMLFrom.mustache +1 -1
- package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/grabPageScrollPosition.mustache +1 -1
- package/docs/webapi/grabTextFrom.mustache +2 -2
- package/docs/webapi/grabValueFrom.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +10 -0
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +8 -0
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/waitForClickable.mustache +10 -0
- package/docs/webapi/waitForDetached.mustache +2 -2
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +2 -2
- package/docs/webapi/waitForFunction.mustache +2 -2
- package/docs/webapi/waitForInvisible.mustache +2 -2
- package/docs/webapi/waitForText.mustache +2 -2
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +2 -2
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/waitToHide.mustache +2 -2
- package/docs/webapi/waitUntil.mustache +3 -2
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/docs/webdriver.md +20 -18
- package/docs/wiki/.git/FETCH_HEAD +1 -0
- package/docs/wiki/.git/HEAD +1 -0
- package/docs/wiki/.git/ORIG_HEAD +1 -0
- package/docs/wiki/.git/config +11 -0
- package/docs/wiki/.git/description +1 -0
- package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
- package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
- package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
- package/docs/wiki/.git/hooks/post-update.sample +8 -0
- package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
- package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
- package/docs/wiki/.git/hooks/pre-push.sample +53 -0
- package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
- package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
- package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
- package/docs/wiki/.git/hooks/update.sample +128 -0
- package/docs/wiki/.git/index +0 -0
- package/docs/wiki/.git/info/exclude +6 -0
- package/docs/wiki/.git/logs/HEAD +4 -0
- package/docs/wiki/.git/logs/refs/heads/master +4 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
- package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
- package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
- package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
- package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
- package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
- package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
- package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
- package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
- package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
- package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
- package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
- package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
- package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
- package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
- package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
- package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
- package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
- package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
- package/docs/wiki/.git/packed-refs +2 -0
- package/docs/wiki/.git/refs/heads/master +1 -0
- package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/refs/remotes/origin/master +1 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers.md +41 -0
- package/docs/wiki/Examples.md +138 -0
- package/docs/wiki/Home.md +11 -0
- package/docs/wiki/Release-process.md +25 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/actor.js +18 -1
- package/lib/assert/error.js +3 -3
- package/lib/codecept.js +9 -6
- package/lib/command/configMigrate.js +7 -6
- package/lib/command/definitions.js +98 -350
- package/lib/command/generate.js +22 -17
- package/lib/command/gherkin/init.js +2 -1
- package/lib/command/gherkin/snippets.js +6 -6
- package/lib/command/gherkin/steps.js +0 -1
- package/lib/command/info.js +40 -0
- package/lib/command/init.js +54 -41
- package/lib/command/run-multiple.js +5 -4
- package/lib/command/run-rerun.js +39 -0
- package/lib/command/run-workers.js +4 -6
- package/lib/command/run.js +8 -18
- package/lib/command/utils.js +23 -2
- package/lib/command/workers/runTests.js +1 -2
- package/lib/config.js +10 -4
- package/lib/container.js +31 -6
- package/lib/data/dataTableArgument.js +31 -0
- package/lib/data/table.js +4 -0
- package/lib/event.js +65 -1
- package/lib/helper/Appium.js +52 -38
- package/lib/helper/FileSystem.js +48 -3
- package/lib/helper/GraphQL.js +3 -2
- package/lib/helper/GraphQLDataFactory.js +1 -0
- package/lib/helper/Mochawesome.js +3 -2
- package/lib/helper/MockRequest.js +23 -5
- package/lib/helper/Nightmare.js +5 -6
- package/lib/helper/Protractor.js +7 -8
- package/lib/helper/Puppeteer.js +76 -20
- package/lib/helper/REST.js +13 -9
- package/lib/helper/SeleniumWebdriver.js +0 -17
- package/lib/helper/TestCafe.js +84 -36
- package/lib/helper/WebDriver.js +113 -59
- package/lib/helper/WebDriverIO.js +43 -59
- package/lib/helper/clientscripts/nightmare.js +66 -4
- package/lib/helper/scripts/isElementClickable.js +24 -0
- package/lib/helper.js +34 -10
- package/lib/history.js +1 -1
- package/lib/hooks.js +2 -1
- package/lib/index.js +19 -0
- package/lib/interfaces/bdd.js +4 -0
- package/lib/interfaces/featureConfig.js +10 -3
- package/lib/interfaces/gherkin.js +6 -2
- package/lib/interfaces/scenarioConfig.js +17 -6
- package/lib/listener/config.js +1 -1
- package/lib/listener/exit.js +6 -0
- package/lib/listener/steps.js +0 -1
- package/lib/listener/trace.js +0 -1
- package/lib/locator.js +67 -2
- package/lib/output.js +53 -0
- package/lib/parser.js +2 -71
- package/lib/pause.js +3 -2
- package/lib/plugin/allure.js +41 -22
- package/lib/plugin/autoLogin.js +4 -1
- package/lib/plugin/pauseOnFail.js +38 -0
- package/lib/plugin/puppeteerCoverage.js +8 -7
- package/lib/plugin/screenshotOnFail.js +13 -8
- package/lib/plugin/stepByStepReport.js +7 -6
- package/lib/plugin/wdio.js +2 -1
- package/lib/recorder.js +85 -7
- package/lib/rerun.js +81 -0
- package/lib/secret.js +6 -0
- package/lib/session.js +9 -2
- package/lib/step.js +37 -2
- package/lib/store.js +5 -1
- package/lib/ui.js +34 -8
- package/lib/utils.js +6 -13
- package/lib/within.js +5 -0
- package/package.json +49 -29
- package/typings/Mocha.d.ts +21 -0
- package/typings/Protractor.d.ts +16 -0
- package/typings/index.d.ts +169 -0
- package/typings/jsdoc.conf.js +34 -0
- package/typings/jsdoc.namespace.js +29 -0
- package/typings/types.d.ts +9827 -0
- package/typings/utils.d.ts +7 -0
- package/docs/acceptance.md +0 -409
- package/docs/api/codecept.md +0 -75
- package/docs/api/config.md +0 -49
- package/docs/api/container.md +0 -66
- package/docs/api/helper.md +0 -116
- package/docs/api/output.md +0 -67
- package/docs/api/recorder.md +0 -63
- package/docs/helpers/SeleniumWebdriver.md +0 -92
- package/docs/helpers/WebDriverIO.md +0 -1671
|
@@ -1,1671 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: WebDriverIO
|
|
3
|
-
title: WebDriverIO
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
7
|
-
|
|
8
|
-
## WebDriverIO
|
|
9
|
-
|
|
10
|
-
Extends Helper
|
|
11
|
-
|
|
12
|
-
WebDriverIO helper which wraps [webdriverio][1] library to
|
|
13
|
-
manipulate browser using Selenium WebDriver or PhantomJS.
|
|
14
|
-
|
|
15
|
-
WebDriverIO requires [Selenium Server and ChromeDriver/GeckoDriver to be installed][2].
|
|
16
|
-
|
|
17
|
-
### Configuration
|
|
18
|
-
|
|
19
|
-
This helper should be configured in codecept.json or codecept.conf.js
|
|
20
|
-
|
|
21
|
-
- `url`: base url of website to be tested.
|
|
22
|
-
- `browser`: browser in which to perform testing.
|
|
23
|
-
- `host`: - WebDriver host to connect.
|
|
24
|
-
- `port`: - WebDriver port to connect.
|
|
25
|
-
- `protocol`: - protocol for WebDriver server.
|
|
26
|
-
- `path`: - path to WebDriver server,
|
|
27
|
-
- `restart`: - restart browser between tests.
|
|
28
|
-
- `smartWait`: (optional) enables [SmartWait][3]; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
29
|
-
- `disableScreenshots`: - don't save screenshots on failure.
|
|
30
|
-
- `fullPageScreenshots` - make full page screenshots on failure.
|
|
31
|
-
- `uniqueScreenshotNames`: - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
32
|
-
- `keepBrowserState`: - keep browser state between tests when `restart` is set to false.
|
|
33
|
-
- `keepCookies`: - keep cookies between tests when `restart` set to false.
|
|
34
|
-
- `windowSize`: (optional) default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
35
|
-
- `waitForTimeout`: sets default wait time in _ms_ for all `wait` functions.
|
|
36
|
-
- `desiredCapabilities`: Selenium's [desired
|
|
37
|
-
capabilities][4].
|
|
38
|
-
- `manualStart`: - do not start browser before a test, start it manually inside a helper
|
|
39
|
-
with `this.helpers["WebDriverIO"]._startBrowser()`.
|
|
40
|
-
- `timeouts`: [WebDriverIO timeouts][5] defined as hash.
|
|
41
|
-
|
|
42
|
-
Example:
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"helpers": {
|
|
47
|
-
"WebDriverIO" : {
|
|
48
|
-
"smartWait": 5000,
|
|
49
|
-
"browser": "chrome",
|
|
50
|
-
"restart": false,
|
|
51
|
-
"windowSize": "maximize",
|
|
52
|
-
"timeouts": {
|
|
53
|
-
"script": 60000,
|
|
54
|
-
"page load": 10000
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Additional configuration params can be used from [webdriverio
|
|
62
|
-
website][6].
|
|
63
|
-
|
|
64
|
-
### Headless Chrome
|
|
65
|
-
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"helpers": {
|
|
69
|
-
"WebDriverIO" : {
|
|
70
|
-
"url": "http://localhost",
|
|
71
|
-
"browser": "chrome",
|
|
72
|
-
"desiredCapabilities": {
|
|
73
|
-
"chromeOptions": {
|
|
74
|
-
"args": [ "--headless", "--disable-gpu", "--window-size=800,600" ]
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Connect through proxy
|
|
83
|
-
|
|
84
|
-
CodeceptJS also provides flexible options when you want to execute tests to Selenium servers through proxy. You will
|
|
85
|
-
need to update the `helpers.WebDriverIO.desiredCapabilities.proxy` key.
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
{
|
|
89
|
-
"helpers": {
|
|
90
|
-
"WebDriverIO": {
|
|
91
|
-
"desiredCapabilities": {
|
|
92
|
-
"proxy": {
|
|
93
|
-
"proxyType": "manual|pac",
|
|
94
|
-
"proxyAutoconfigUrl": "URL TO PAC FILE",
|
|
95
|
-
"httpProxy": "PROXY SERVER",
|
|
96
|
-
"sslProxy": "PROXY SERVER",
|
|
97
|
-
"ftpProxy": "PROXY SERVER",
|
|
98
|
-
"socksProxy": "PROXY SERVER",
|
|
99
|
-
"socksUsername": "USERNAME",
|
|
100
|
-
"socksPassword": "PASSWORD",
|
|
101
|
-
"noProxy": "BYPASS ADDRESSES"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
For example,
|
|
110
|
-
|
|
111
|
-
```js
|
|
112
|
-
{
|
|
113
|
-
"helpers": {
|
|
114
|
-
"WebDriverIO": {
|
|
115
|
-
"desiredCapabilities": {
|
|
116
|
-
"proxy": {
|
|
117
|
-
"proxyType": "manual",
|
|
118
|
-
"httpProxy": "http://corporate.proxy:8080",
|
|
119
|
-
"socksUsername": "codeceptjs",
|
|
120
|
-
"socksPassword": "secret",
|
|
121
|
-
"noProxy": "127.0.0.1,localhost"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Please refer to [Selenium - Proxy Object][4] for more
|
|
130
|
-
information.
|
|
131
|
-
|
|
132
|
-
### Cloud Providers
|
|
133
|
-
|
|
134
|
-
WebDriverIO makes it possible to execute tests against services like `Sauce Labs` `BrowserStack` `TestingBot`
|
|
135
|
-
Check out their documentation on [available parameters][7]
|
|
136
|
-
|
|
137
|
-
Connecting to `BrowserStack` and `Sauce Labs` is simple. All you need to do
|
|
138
|
-
is set the `user` and `key` parameters. WebDriverIO automatically know which
|
|
139
|
-
service provider to connect to.
|
|
140
|
-
|
|
141
|
-
```js
|
|
142
|
-
{
|
|
143
|
-
"helpers":{
|
|
144
|
-
"WebDriverIO": {
|
|
145
|
-
"url": "YOUR_DESIRED_HOST",
|
|
146
|
-
"user": "YOUR_BROWSERSTACK_USER",
|
|
147
|
-
"key": "YOUR_BROWSERSTACK_KEY",
|
|
148
|
-
"desiredCapabilities": {
|
|
149
|
-
"browserName": "chrome",
|
|
150
|
-
|
|
151
|
-
// only set this if you're using BrowserStackLocal to test a local domain
|
|
152
|
-
// "browserstack.local": true,
|
|
153
|
-
|
|
154
|
-
// set this option to tell browserstack to provide addition debugging info
|
|
155
|
-
// "browserstack.debug": true,
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Multiremote Capabilities
|
|
163
|
-
|
|
164
|
-
This is a work in progress but you can control two browsers at a time right out of the box.
|
|
165
|
-
Individual control is something that is planned for a later version.
|
|
166
|
-
|
|
167
|
-
Here is the [webdriverio docs][8] on the subject
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
{
|
|
171
|
-
"helpers": {
|
|
172
|
-
"WebDriverIO": {
|
|
173
|
-
"multiremote": {
|
|
174
|
-
"MyChrome": {
|
|
175
|
-
"desiredCapabilities": {
|
|
176
|
-
"browserName": "chrome"
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
"MyFirefox": {
|
|
180
|
-
"desiredCapabilities": {
|
|
181
|
-
"browserName": "firefox"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Access From Helpers
|
|
191
|
-
|
|
192
|
-
Receive a WebDriverIO client from a custom helper by accessing `browser` property:
|
|
193
|
-
|
|
194
|
-
```js
|
|
195
|
-
this.helpers['WebDriverIO'].browser
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Parameters
|
|
199
|
-
|
|
200
|
-
- `config`
|
|
201
|
-
|
|
202
|
-
### \_locate
|
|
203
|
-
|
|
204
|
-
Get elements by different locator types, including strict locator.
|
|
205
|
-
Should be used in custom helpers:
|
|
206
|
-
|
|
207
|
-
```js
|
|
208
|
-
this.helpers['WebDriverIO']._locate({name: 'password'}).then //...
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
#### Parameters
|
|
212
|
-
|
|
213
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
214
|
-
- `smartWait`
|
|
215
|
-
|
|
216
|
-
### \_locateCheckable
|
|
217
|
-
|
|
218
|
-
Find a checkbox by providing human readable text:
|
|
219
|
-
|
|
220
|
-
```js
|
|
221
|
-
this.helpers['WebDriverIO']._locateCheckable('I agree with terms and conditions').then // ...
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
#### Parameters
|
|
225
|
-
|
|
226
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
227
|
-
|
|
228
|
-
### \_locateClickable
|
|
229
|
-
|
|
230
|
-
Find a clickable element by providing human readable text:
|
|
231
|
-
|
|
232
|
-
```js
|
|
233
|
-
this.helpers['WebDriverIO']._locateClickable('Next page').then // ...
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
#### Parameters
|
|
237
|
-
|
|
238
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
239
|
-
|
|
240
|
-
### \_locateFields
|
|
241
|
-
|
|
242
|
-
Find field elements by providing human readable text:
|
|
243
|
-
|
|
244
|
-
```js
|
|
245
|
-
this.helpers['WebDriverIO']._locateFields('Your email').then // ...
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
#### Parameters
|
|
249
|
-
|
|
250
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
251
|
-
|
|
252
|
-
### acceptPopup
|
|
253
|
-
|
|
254
|
-
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
255
|
-
Don't confuse popups with modal windows, as created by [various
|
|
256
|
-
libraries][9]. Appium: support only web testing
|
|
257
|
-
|
|
258
|
-
### amOnPage
|
|
259
|
-
|
|
260
|
-
Opens a web page in a browser. Requires relative or absolute url.
|
|
261
|
-
If url starts with `/`, opens a web page of a site defined in `url` config parameter.
|
|
262
|
-
|
|
263
|
-
```js
|
|
264
|
-
I.amOnPage('/'); // opens main page of website
|
|
265
|
-
I.amOnPage('https://github.com'); // opens github
|
|
266
|
-
I.amOnPage('/login'); // opens a login page
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
#### Parameters
|
|
270
|
-
|
|
271
|
-
- `url` [string][10] url path or global url.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Appium: support only web testing
|
|
275
|
-
|
|
276
|
-
### appendField
|
|
277
|
-
|
|
278
|
-
Appends text to a input field or textarea.
|
|
279
|
-
Field is located by name, label, CSS or XPath
|
|
280
|
-
|
|
281
|
-
```js
|
|
282
|
-
I.appendField('#myTextField', 'appended');
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
#### Parameters
|
|
286
|
-
|
|
287
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator
|
|
288
|
-
- `value` [string][10] text value to append.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
Appium: support, but it's clear a field before insert in apps
|
|
292
|
-
|
|
293
|
-
### attachFile
|
|
294
|
-
|
|
295
|
-
Attaches a file to element located by label, name, CSS or XPath
|
|
296
|
-
Path to file is relative current codecept directory (where codecept.json or codecept.conf.js is located).
|
|
297
|
-
File will be uploaded to remote system (if tests are running remotely).
|
|
298
|
-
|
|
299
|
-
```js
|
|
300
|
-
I.attachFile('Avatar', 'data/avatar.jpg');
|
|
301
|
-
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
#### Parameters
|
|
305
|
-
|
|
306
|
-
- `locator` ([string][10] \| [object][11]) field located by label|name|CSS|XPath|strict locator.
|
|
307
|
-
- `pathToFile` [string][10] local file path relative to codecept.json config file.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
Appium: not tested
|
|
311
|
-
|
|
312
|
-
### cancelPopup
|
|
313
|
-
|
|
314
|
-
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
315
|
-
Appium: support only web testing
|
|
316
|
-
|
|
317
|
-
### checkOption
|
|
318
|
-
|
|
319
|
-
Selects a checkbox or radio button.
|
|
320
|
-
Element is located by label or name or CSS or XPath.
|
|
321
|
-
|
|
322
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
323
|
-
|
|
324
|
-
```js
|
|
325
|
-
I.checkOption('#agree');
|
|
326
|
-
I.checkOption('I Agree to Terms and Conditions');
|
|
327
|
-
I.checkOption('agree', '//form');
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
#### Parameters
|
|
331
|
-
|
|
332
|
-
- `field` ([string][10] \| [object][11]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
333
|
-
- `context` [string][10] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
Appium: not tested
|
|
337
|
-
|
|
338
|
-
### clearCookie
|
|
339
|
-
|
|
340
|
-
{{> clearCookie}}
|
|
341
|
-
Appium: support only web testing
|
|
342
|
-
|
|
343
|
-
#### Parameters
|
|
344
|
-
|
|
345
|
-
- `cookie`
|
|
346
|
-
|
|
347
|
-
### clearField
|
|
348
|
-
|
|
349
|
-
{{> clearField}}
|
|
350
|
-
Appium: support
|
|
351
|
-
|
|
352
|
-
#### Parameters
|
|
353
|
-
|
|
354
|
-
- `field`
|
|
355
|
-
|
|
356
|
-
### click
|
|
357
|
-
|
|
358
|
-
Perform a click on a link or a button, given by a locator.
|
|
359
|
-
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
360
|
-
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
361
|
-
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
362
|
-
|
|
363
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
364
|
-
|
|
365
|
-
```js
|
|
366
|
-
// simple link
|
|
367
|
-
I.click('Logout');
|
|
368
|
-
// button of form
|
|
369
|
-
I.click('Submit');
|
|
370
|
-
// CSS button
|
|
371
|
-
I.click('#form input[type=submit]');
|
|
372
|
-
// XPath
|
|
373
|
-
I.click('//form/[@type=submit]');
|
|
374
|
-
// link in context
|
|
375
|
-
I.click('Logout', '#nav');
|
|
376
|
-
// using strict locator
|
|
377
|
-
I.click({css: 'nav a.login'});
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
#### Parameters
|
|
381
|
-
|
|
382
|
-
- `locator` ([string][10] \| [object][11]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
383
|
-
- `context` ([string][10] \| [object][11]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
Appium: support
|
|
387
|
-
|
|
388
|
-
### closeCurrentTab
|
|
389
|
-
|
|
390
|
-
Close current tab.
|
|
391
|
-
|
|
392
|
-
```js
|
|
393
|
-
I.closeCurrentTab();
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### closeOtherTabs
|
|
397
|
-
|
|
398
|
-
Close all tabs except for the current one.
|
|
399
|
-
Appium: support web test
|
|
400
|
-
|
|
401
|
-
```js
|
|
402
|
-
I.closeOtherTabs();
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
### defineTimeout
|
|
406
|
-
|
|
407
|
-
Set [WebDriverIO timeouts][5] in realtime.
|
|
408
|
-
Appium: support only web testing.
|
|
409
|
-
Timeouts are expected to be passed as object:
|
|
410
|
-
|
|
411
|
-
```js
|
|
412
|
-
I.defineTimeout({ script: 5000 });
|
|
413
|
-
I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
#### Parameters
|
|
417
|
-
|
|
418
|
-
- `timeouts` WebDriver timeouts object.
|
|
419
|
-
|
|
420
|
-
### dontSee
|
|
421
|
-
|
|
422
|
-
Opposite to `see`. Checks that a text is not present on a page.
|
|
423
|
-
Use context parameter to narrow down the search.
|
|
424
|
-
|
|
425
|
-
```js
|
|
426
|
-
I.dontSee('Login'); // assume we are already logged in.
|
|
427
|
-
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
#### Parameters
|
|
431
|
-
|
|
432
|
-
- `text` [string][10] which is not present.
|
|
433
|
-
- `context` ([string][10] \| [object][11]) (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
434
|
-
|
|
435
|
-
Appium: support with context in apps
|
|
436
|
-
|
|
437
|
-
### dontSeeCheckboxIsChecked
|
|
438
|
-
|
|
439
|
-
Verifies that the specified checkbox is not checked.
|
|
440
|
-
|
|
441
|
-
```js
|
|
442
|
-
I.dontSeeCheckboxIsChecked('#agree'); // located by ID
|
|
443
|
-
I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
|
|
444
|
-
I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
#### Parameters
|
|
448
|
-
|
|
449
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator.
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
Appium: not tested
|
|
453
|
-
|
|
454
|
-
### dontSeeCookie
|
|
455
|
-
|
|
456
|
-
{{> dontSeeCookie}}
|
|
457
|
-
Appium: support only web testing
|
|
458
|
-
|
|
459
|
-
#### Parameters
|
|
460
|
-
|
|
461
|
-
- `name`
|
|
462
|
-
|
|
463
|
-
### dontSeeCurrentUrlEquals
|
|
464
|
-
|
|
465
|
-
Checks that current url is not equal to provided one.
|
|
466
|
-
If a relative url provided, a configured url will be prepended to it.
|
|
467
|
-
|
|
468
|
-
```js
|
|
469
|
-
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
470
|
-
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
#### Parameters
|
|
474
|
-
|
|
475
|
-
- `url` [string][10] value to check.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
Appium: support only web testing
|
|
479
|
-
|
|
480
|
-
### dontSeeElement
|
|
481
|
-
|
|
482
|
-
{{> dontSeeElement}}
|
|
483
|
-
Appium: support
|
|
484
|
-
|
|
485
|
-
#### Parameters
|
|
486
|
-
|
|
487
|
-
- `locator`
|
|
488
|
-
|
|
489
|
-
### dontSeeElementInDOM
|
|
490
|
-
|
|
491
|
-
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
492
|
-
|
|
493
|
-
```js
|
|
494
|
-
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
#### Parameters
|
|
498
|
-
|
|
499
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|Strict locator.
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
Appium: support
|
|
503
|
-
|
|
504
|
-
### dontSeeInCurrentUrl
|
|
505
|
-
|
|
506
|
-
Checks that current url does not contain a provided fragment.
|
|
507
|
-
|
|
508
|
-
#### Parameters
|
|
509
|
-
|
|
510
|
-
- `url` [string][10] value to check.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
Appium: support only web testing
|
|
514
|
-
|
|
515
|
-
### dontSeeInField
|
|
516
|
-
|
|
517
|
-
Checks that value of input field or textarea doesn't equal to given value
|
|
518
|
-
Opposite to `seeInField`.
|
|
519
|
-
|
|
520
|
-
```js
|
|
521
|
-
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
522
|
-
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
#### Parameters
|
|
526
|
-
|
|
527
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator.
|
|
528
|
-
- `value` [string][10] value to check.
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
Appium: support only web testing
|
|
532
|
-
|
|
533
|
-
### dontSeeInSource
|
|
534
|
-
|
|
535
|
-
Checks that the current page does not contains the given string in its raw source code.
|
|
536
|
-
|
|
537
|
-
```js
|
|
538
|
-
I.dontSeeInSource('<!--'); // no comments in source
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
#### Parameters
|
|
542
|
-
|
|
543
|
-
- `text`
|
|
544
|
-
- `value` [string][10] to check.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
Appium: support
|
|
548
|
-
|
|
549
|
-
### dontSeeInTitle
|
|
550
|
-
|
|
551
|
-
Checks that title does not contain text.
|
|
552
|
-
|
|
553
|
-
```js
|
|
554
|
-
I.dontSeeInTitle('Error');
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
#### Parameters
|
|
558
|
-
|
|
559
|
-
- `text` [string][10] value to check.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
Appium: support only web testing
|
|
563
|
-
|
|
564
|
-
### doubleClick
|
|
565
|
-
|
|
566
|
-
Performs a double-click on an element matched by link|button|label|CSS or XPath.
|
|
567
|
-
Context can be specified as second parameter to narrow search.
|
|
568
|
-
|
|
569
|
-
```js
|
|
570
|
-
I.doubleClick('Edit');
|
|
571
|
-
I.doubleClick('Edit', '.actions');
|
|
572
|
-
I.doubleClick({css: 'button.accept'});
|
|
573
|
-
I.doubleClick('.btn.edit');
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
#### Parameters
|
|
577
|
-
|
|
578
|
-
- `locator` ([string][10] \| [object][11]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
579
|
-
- `context` ([string][10] \| [object][11]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
Appium: support only web testing
|
|
583
|
-
|
|
584
|
-
### dragAndDrop
|
|
585
|
-
|
|
586
|
-
Drag an item to a destination element.
|
|
587
|
-
|
|
588
|
-
```js
|
|
589
|
-
I.dragAndDrop('#dragHandle', '#container');
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
#### Parameters
|
|
593
|
-
|
|
594
|
-
- `srcElement` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
595
|
-
- `destElement` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
Appium: not tested
|
|
599
|
-
|
|
600
|
-
### executeAsyncScript
|
|
601
|
-
|
|
602
|
-
Executes async script on page.
|
|
603
|
-
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
604
|
-
|
|
605
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][12].
|
|
606
|
-
|
|
607
|
-
```js
|
|
608
|
-
I.executeAsyncScript(function(done) {
|
|
609
|
-
Vue.nextTick(done); // waiting for next tick
|
|
610
|
-
});
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
By passing value to `done()` function you can return values.
|
|
614
|
-
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.
|
|
615
|
-
|
|
616
|
-
```js
|
|
617
|
-
let val = await I.executeAsyncScript(function(url, done) {
|
|
618
|
-
// in browser context
|
|
619
|
-
$.ajax(url, { success: (data) => done(data); }
|
|
620
|
-
}, 'http://ajax.callback.url/');
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
#### Parameters
|
|
624
|
-
|
|
625
|
-
- `fn` ([string][10] \| [function][13]) function to be executed in browser context.
|
|
626
|
-
|
|
627
|
-
### executeScript
|
|
628
|
-
|
|
629
|
-
Executes sync script on a page.
|
|
630
|
-
Pass arguments to function as additional parameters.
|
|
631
|
-
Will return execution result to a test.
|
|
632
|
-
In this case you should use async function and await to receive results.
|
|
633
|
-
|
|
634
|
-
Example with jQuery DatePicker:
|
|
635
|
-
|
|
636
|
-
```js
|
|
637
|
-
// change date of jQuery DatePicker
|
|
638
|
-
I.executeScript(function() {
|
|
639
|
-
// now we are inside browser context
|
|
640
|
-
$('date').datetimepicker('setDate', new Date());
|
|
641
|
-
});
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
Can return values. Don't forget to use `await` to get them.
|
|
645
|
-
|
|
646
|
-
```js
|
|
647
|
-
let date = await I.executeScript(function(el) {
|
|
648
|
-
// only basic types can be returned
|
|
649
|
-
return $(el).datetimepicker('getDate').toString();
|
|
650
|
-
}, '#date'); // passing jquery selector
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
#### Parameters
|
|
654
|
-
|
|
655
|
-
- `fn` ([string][10] \| [function][13]) function to be executed in browser context.
|
|
656
|
-
|
|
657
|
-
### fillField
|
|
658
|
-
|
|
659
|
-
Fills a text field or textarea, after clearing its value, with the given string.
|
|
660
|
-
Field is located by name, label, CSS, or XPath.
|
|
661
|
-
|
|
662
|
-
```js
|
|
663
|
-
// by label
|
|
664
|
-
I.fillField('Email', 'hello@world.com');
|
|
665
|
-
// by name
|
|
666
|
-
I.fillField('password', secret('123456'));
|
|
667
|
-
// by CSS
|
|
668
|
-
I.fillField('form#login input[name=username]', 'John');
|
|
669
|
-
// or by strict locator
|
|
670
|
-
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
#### Parameters
|
|
674
|
-
|
|
675
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator.
|
|
676
|
-
- `value` [string][10] text value to fill.
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
Appium: support
|
|
680
|
-
|
|
681
|
-
### grabAttributeFrom
|
|
682
|
-
|
|
683
|
-
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
684
|
-
An array as a result will be returned if there are more than one matched element.
|
|
685
|
-
Resumes test execution, so should be used inside async with `await` operator.
|
|
686
|
-
|
|
687
|
-
```js
|
|
688
|
-
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
689
|
-
```
|
|
690
|
-
|
|
691
|
-
#### Parameters
|
|
692
|
-
|
|
693
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
694
|
-
- `attr` [string][10] attribute name.
|
|
695
|
-
|
|
696
|
-
Returns [Promise][14]<[string][10]> attribute value
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
700
|
-
|
|
701
|
-
### grabBrowserLogs
|
|
702
|
-
|
|
703
|
-
Get JS log from browser. Log buffer is reset after each request.
|
|
704
|
-
|
|
705
|
-
```js
|
|
706
|
-
let logs = await I.grabBrowserLogs();
|
|
707
|
-
console.log(JSON.stringify(logs))
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
### grabCookie
|
|
711
|
-
|
|
712
|
-
{{> grabCookie}}
|
|
713
|
-
Appium: support only web testing
|
|
714
|
-
|
|
715
|
-
#### Parameters
|
|
716
|
-
|
|
717
|
-
- `name`
|
|
718
|
-
|
|
719
|
-
### grabCssPropertyFrom
|
|
720
|
-
|
|
721
|
-
Grab CSS property for given locator
|
|
722
|
-
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
723
|
-
|
|
724
|
-
```js
|
|
725
|
-
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
#### Parameters
|
|
729
|
-
|
|
730
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
731
|
-
- `cssProperty` [string][10] CSS property name.
|
|
732
|
-
|
|
733
|
-
Returns [Promise][14]<[string][10]> CSS value
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
### grabCurrentUrl
|
|
738
|
-
|
|
739
|
-
Get current URL from browser.
|
|
740
|
-
Resumes test execution, so should be used inside an async function.
|
|
741
|
-
|
|
742
|
-
```js
|
|
743
|
-
let url = await I.grabCurrentUrl();
|
|
744
|
-
console.log(`Current URL is [${url}]`);
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
Returns [Promise][14]<[string][10]> current URL
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
### grabHTMLFrom
|
|
752
|
-
|
|
753
|
-
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
754
|
-
Resumes test execution, so should be used inside async function with `await` operator.
|
|
755
|
-
If more than one element is found - an array of HTMLs returned.
|
|
756
|
-
|
|
757
|
-
```js
|
|
758
|
-
let postHTML = await I.grabHTMLFrom('#post');
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
#### Parameters
|
|
762
|
-
|
|
763
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
764
|
-
|
|
765
|
-
Returns [Promise][14]<[string][10]> HTML code for an element
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
Appium: support only web testing
|
|
769
|
-
|
|
770
|
-
### grabNumberOfOpenTabs
|
|
771
|
-
|
|
772
|
-
Grab number of open tabs.
|
|
773
|
-
|
|
774
|
-
```js
|
|
775
|
-
let tabs = await I.grabNumberOfOpenTabs();
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
Returns [Promise][14]<[number][15]> number of open tabs
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
### grabNumberOfVisibleElements
|
|
783
|
-
|
|
784
|
-
Grab number of visible elements by locator.
|
|
785
|
-
|
|
786
|
-
```js
|
|
787
|
-
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
#### Parameters
|
|
791
|
-
|
|
792
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
793
|
-
|
|
794
|
-
Returns [Promise][14]<[number][15]> number of visible elements
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
### grabPageScrollPosition
|
|
799
|
-
|
|
800
|
-
{{> grabPageScrollPosition}}
|
|
801
|
-
|
|
802
|
-
### grabPopupText
|
|
803
|
-
|
|
804
|
-
Grab the text within the popup. If no popup is visible then it will return null.
|
|
805
|
-
|
|
806
|
-
```js
|
|
807
|
-
await I.grabPopupText();
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
### grabSource
|
|
811
|
-
|
|
812
|
-
Retrieves page source and returns it to test.
|
|
813
|
-
Resumes test execution, so should be used inside an async function.
|
|
814
|
-
|
|
815
|
-
```js
|
|
816
|
-
let pageSource = await I.grabSource();
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
Returns [Promise][14]<[string][10]> source code
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
Appium: support
|
|
823
|
-
|
|
824
|
-
### grabTextFrom
|
|
825
|
-
|
|
826
|
-
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
827
|
-
Resumes test execution, so should be used inside async with `await` operator.
|
|
828
|
-
|
|
829
|
-
```js
|
|
830
|
-
let pin = await I.grabTextFrom('#pin');
|
|
831
|
-
```
|
|
832
|
-
|
|
833
|
-
If multiple elements found returns an array of texts.
|
|
834
|
-
|
|
835
|
-
#### Parameters
|
|
836
|
-
|
|
837
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
838
|
-
|
|
839
|
-
Returns [Promise][14]<[string][10]> attribute value
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
Appium: support
|
|
843
|
-
|
|
844
|
-
### grabTitle
|
|
845
|
-
|
|
846
|
-
Retrieves a page title and returns it to test.
|
|
847
|
-
Resumes test execution, so should be used inside async with `await` operator.
|
|
848
|
-
|
|
849
|
-
```js
|
|
850
|
-
let title = await I.grabTitle();
|
|
851
|
-
```
|
|
852
|
-
|
|
853
|
-
Returns [Promise][14]<[string][10]> title
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
Appium: support only web testing
|
|
857
|
-
|
|
858
|
-
### grabValueFrom
|
|
859
|
-
|
|
860
|
-
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
861
|
-
Resumes test execution, so should be used inside async function with `await` operator.
|
|
862
|
-
|
|
863
|
-
```js
|
|
864
|
-
let email = await I.grabValueFrom('input[name=email]');
|
|
865
|
-
```
|
|
866
|
-
|
|
867
|
-
#### Parameters
|
|
868
|
-
|
|
869
|
-
- `locator` ([string][10] \| [object][11]) field located by label|name|CSS|XPath|strict locator.
|
|
870
|
-
|
|
871
|
-
Returns [Promise][14]<[string][10]> attribute value
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
Appium: support only web testing
|
|
875
|
-
|
|
876
|
-
### moveCursorTo
|
|
877
|
-
|
|
878
|
-
{{> moveCursorTo}}
|
|
879
|
-
Appium: support only web testing
|
|
880
|
-
|
|
881
|
-
#### Parameters
|
|
882
|
-
|
|
883
|
-
- `locator`
|
|
884
|
-
- `offsetX`
|
|
885
|
-
- `offsetY`
|
|
886
|
-
|
|
887
|
-
### openNewTab
|
|
888
|
-
|
|
889
|
-
Open new tab and switch to it.
|
|
890
|
-
|
|
891
|
-
```js
|
|
892
|
-
I.openNewTab();
|
|
893
|
-
```
|
|
894
|
-
|
|
895
|
-
### pressKey
|
|
896
|
-
|
|
897
|
-
Presses a key on a focused element.
|
|
898
|
-
Special keys like 'Enter', 'Control', [etc][16]
|
|
899
|
-
will be replaced with corresponding unicode.
|
|
900
|
-
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
|
|
901
|
-
|
|
902
|
-
```js
|
|
903
|
-
I.pressKey('Enter');
|
|
904
|
-
I.pressKey(['Control','a']);
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
#### Parameters
|
|
908
|
-
|
|
909
|
-
- `key` ([string][10] \| [array][17]) key or array of keys to press.
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
{{> \_keys }}To make combinations with modifier and mouse clicks (like Ctrl+Click) press a modifier, click, then release it.
|
|
913
|
-
Appium: support, but clear field before pressing in apps:```js
|
|
914
|
-
I.pressKey('Control');
|
|
915
|
-
I.click('#someelement');
|
|
916
|
-
I.pressKey('Control');
|
|
917
|
-
```
|
|
918
|
-
|
|
919
|
-
### refreshPage
|
|
920
|
-
|
|
921
|
-
Reload the current page.
|
|
922
|
-
|
|
923
|
-
```js
|
|
924
|
-
I.refreshPage();
|
|
925
|
-
```
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
### resizeWindow
|
|
931
|
-
|
|
932
|
-
Resize the current window to provided width and height.
|
|
933
|
-
First parameter can be set to `maximize`.
|
|
934
|
-
|
|
935
|
-
#### Parameters
|
|
936
|
-
|
|
937
|
-
- `width` [number][15] width in pixels or `maximize`.
|
|
938
|
-
- `height` [number][15] height in pixels.
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
Appium: not tested in web, in apps doesn't work
|
|
942
|
-
|
|
943
|
-
### rightClick
|
|
944
|
-
|
|
945
|
-
Performs right click on a clickable element matched by semantic locator, CSS or XPath.
|
|
946
|
-
|
|
947
|
-
```js
|
|
948
|
-
// right click element with id el
|
|
949
|
-
I.rightClick('#el');
|
|
950
|
-
// right click link or button with text "Click me"
|
|
951
|
-
I.rightClick('Click me');
|
|
952
|
-
// right click button with text "Click me" inside .context
|
|
953
|
-
I.rightClick('Click me', '.context');
|
|
954
|
-
```
|
|
955
|
-
|
|
956
|
-
#### Parameters
|
|
957
|
-
|
|
958
|
-
- `locator` ([string][10] \| [object][11]) clickable element located by CSS|XPath|strict locator.
|
|
959
|
-
- `context` ([string][10] \| [object][11]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
Appium: support, but in apps works as usual click
|
|
963
|
-
|
|
964
|
-
### runInWeb
|
|
965
|
-
|
|
966
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriverIO.
|
|
967
|
-
|
|
968
|
-
#### Parameters
|
|
969
|
-
|
|
970
|
-
- `fn`
|
|
971
|
-
|
|
972
|
-
### runOnAndroid
|
|
973
|
-
|
|
974
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriverIO.
|
|
975
|
-
|
|
976
|
-
#### Parameters
|
|
977
|
-
|
|
978
|
-
- `caps`
|
|
979
|
-
- `fn`
|
|
980
|
-
|
|
981
|
-
### runOnIOS
|
|
982
|
-
|
|
983
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriverIO.
|
|
984
|
-
|
|
985
|
-
#### Parameters
|
|
986
|
-
|
|
987
|
-
- `caps`
|
|
988
|
-
- `fn`
|
|
989
|
-
|
|
990
|
-
### saveScreenshot
|
|
991
|
-
|
|
992
|
-
{{> saveScreenshot}}
|
|
993
|
-
Appium: support
|
|
994
|
-
|
|
995
|
-
#### Parameters
|
|
996
|
-
|
|
997
|
-
- `fileName`
|
|
998
|
-
- `fullPage`
|
|
999
|
-
|
|
1000
|
-
### scrollPageToBottom
|
|
1001
|
-
|
|
1002
|
-
Scroll page to the bottom.
|
|
1003
|
-
|
|
1004
|
-
```js
|
|
1005
|
-
I.scrollPageToBottom();
|
|
1006
|
-
```
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
### scrollPageToTop
|
|
1012
|
-
|
|
1013
|
-
Scroll page to the top.
|
|
1014
|
-
|
|
1015
|
-
```js
|
|
1016
|
-
I.scrollPageToTop();
|
|
1017
|
-
```
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
### scrollTo
|
|
1023
|
-
|
|
1024
|
-
Scrolls to element matched by locator.
|
|
1025
|
-
Extra shift can be set with offsetX and offsetY options.
|
|
1026
|
-
|
|
1027
|
-
```js
|
|
1028
|
-
I.scrollTo('footer');
|
|
1029
|
-
I.scrollTo('#submit', 5, 5);
|
|
1030
|
-
```
|
|
1031
|
-
|
|
1032
|
-
#### Parameters
|
|
1033
|
-
|
|
1034
|
-
- `locator` located by CSS|XPath|strict locator.
|
|
1035
|
-
- `offsetX` (optional) X-axis offset.
|
|
1036
|
-
- `offsetY` (optional) Y-axis offset.
|
|
1037
|
-
|
|
1038
|
-
### scrollTo
|
|
1039
|
-
|
|
1040
|
-
Scrolls to element matched by locator.
|
|
1041
|
-
Extra shift can be set with offsetX and offsetY options.
|
|
1042
|
-
|
|
1043
|
-
```js
|
|
1044
|
-
I.scrollTo('footer');
|
|
1045
|
-
I.scrollTo('#submit', 5, 5);
|
|
1046
|
-
```
|
|
1047
|
-
|
|
1048
|
-
#### Parameters
|
|
1049
|
-
|
|
1050
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
1051
|
-
- `offsetX` [number][15] (optional, `0` by default) X-axis offset.
|
|
1052
|
-
- `offsetY` [number][15] (optional, `0` by default) Y-axis offset.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
Appium: support only web testing
|
|
1056
|
-
|
|
1057
|
-
### see
|
|
1058
|
-
|
|
1059
|
-
Checks that a page contains a visible text.
|
|
1060
|
-
Use context parameter to narrow down the search.
|
|
1061
|
-
|
|
1062
|
-
```js
|
|
1063
|
-
I.see('Welcome'); // text welcome on a page
|
|
1064
|
-
I.see('Welcome', '.content'); // text inside .content div
|
|
1065
|
-
I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1066
|
-
```
|
|
1067
|
-
|
|
1068
|
-
#### Parameters
|
|
1069
|
-
|
|
1070
|
-
- `text` [string][10] expected on page.
|
|
1071
|
-
- `context` ([string][10] \| [object][11]) (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
Appium: support with context in apps
|
|
1075
|
-
|
|
1076
|
-
### seeAttributesOnElements
|
|
1077
|
-
|
|
1078
|
-
Checks that all elements with given locator have given attributes.
|
|
1079
|
-
|
|
1080
|
-
```js
|
|
1081
|
-
I.seeAttributesOnElements('//form', { method: "post"});
|
|
1082
|
-
```
|
|
1083
|
-
|
|
1084
|
-
#### Parameters
|
|
1085
|
-
|
|
1086
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
1087
|
-
- `attributes` [object][11] attributes and their values to check.
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
### seeCheckboxIsChecked
|
|
1092
|
-
|
|
1093
|
-
Verifies that the specified checkbox is checked.
|
|
1094
|
-
|
|
1095
|
-
```js
|
|
1096
|
-
I.seeCheckboxIsChecked('Agree');
|
|
1097
|
-
I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
1098
|
-
I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1099
|
-
```
|
|
1100
|
-
|
|
1101
|
-
#### Parameters
|
|
1102
|
-
|
|
1103
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator.
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
Appium: not tested
|
|
1107
|
-
|
|
1108
|
-
### seeCookie
|
|
1109
|
-
|
|
1110
|
-
{{> seeCookie}}
|
|
1111
|
-
Appium: support only web testing
|
|
1112
|
-
|
|
1113
|
-
#### Parameters
|
|
1114
|
-
|
|
1115
|
-
- `name`
|
|
1116
|
-
|
|
1117
|
-
### seeCssPropertiesOnElements
|
|
1118
|
-
|
|
1119
|
-
Checks that all elements with given locator have given CSS properties.
|
|
1120
|
-
|
|
1121
|
-
```js
|
|
1122
|
-
I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
1123
|
-
```
|
|
1124
|
-
|
|
1125
|
-
#### Parameters
|
|
1126
|
-
|
|
1127
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
1128
|
-
- `cssProperties` [object][11] object with CSS properties and their values to check.
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
### seeCurrentUrlEquals
|
|
1133
|
-
|
|
1134
|
-
Checks that current url is equal to provided one.
|
|
1135
|
-
If a relative url provided, a configured url will be prepended to it.
|
|
1136
|
-
So both examples will work:
|
|
1137
|
-
|
|
1138
|
-
```js
|
|
1139
|
-
I.seeCurrentUrlEquals('/register');
|
|
1140
|
-
I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
1141
|
-
```
|
|
1142
|
-
|
|
1143
|
-
#### Parameters
|
|
1144
|
-
|
|
1145
|
-
- `url` [string][10] value to check.
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
Appium: support only web testing
|
|
1149
|
-
|
|
1150
|
-
### seeElement
|
|
1151
|
-
|
|
1152
|
-
Checks that a given Element is visible
|
|
1153
|
-
Element is located by CSS or XPath.
|
|
1154
|
-
|
|
1155
|
-
```js
|
|
1156
|
-
I.seeElement('#modal');
|
|
1157
|
-
```
|
|
1158
|
-
|
|
1159
|
-
#### Parameters
|
|
1160
|
-
|
|
1161
|
-
- `locator` ([string][10] \| [object][11]) located by CSS|XPath|strict locator.
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
Appium: support
|
|
1165
|
-
|
|
1166
|
-
### seeElementInDOM
|
|
1167
|
-
|
|
1168
|
-
Checks that a given Element is present in the DOM
|
|
1169
|
-
Element is located by CSS or XPath.
|
|
1170
|
-
|
|
1171
|
-
```js
|
|
1172
|
-
I.seeElementInDOM('#modal');
|
|
1173
|
-
```
|
|
1174
|
-
|
|
1175
|
-
#### Parameters
|
|
1176
|
-
|
|
1177
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
Appium: support
|
|
1181
|
-
|
|
1182
|
-
### seeInCurrentUrl
|
|
1183
|
-
|
|
1184
|
-
Checks that current url contains a provided fragment.
|
|
1185
|
-
|
|
1186
|
-
```js
|
|
1187
|
-
I.seeInCurrentUrl('/register'); // we are on registration page
|
|
1188
|
-
```
|
|
1189
|
-
|
|
1190
|
-
#### Parameters
|
|
1191
|
-
|
|
1192
|
-
- `url` [string][10] a fragment to check
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
Appium: support only web testing
|
|
1196
|
-
|
|
1197
|
-
### seeInField
|
|
1198
|
-
|
|
1199
|
-
Checks that the given input field or textarea equals to given value.
|
|
1200
|
-
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
1201
|
-
|
|
1202
|
-
```js
|
|
1203
|
-
I.seeInField('Username', 'davert');
|
|
1204
|
-
I.seeInField({css: 'form textarea'},'Type your comment here');
|
|
1205
|
-
I.seeInField('form input[type=hidden]','hidden_value');
|
|
1206
|
-
I.seeInField('#searchform input','Search');
|
|
1207
|
-
```
|
|
1208
|
-
|
|
1209
|
-
#### Parameters
|
|
1210
|
-
|
|
1211
|
-
- `field` ([string][10] \| [object][11]) located by label|name|CSS|XPath|strict locator.
|
|
1212
|
-
- `value` [string][10] value to check.
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
Appium: support only web testing
|
|
1216
|
-
|
|
1217
|
-
### seeInPopup
|
|
1218
|
-
|
|
1219
|
-
Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the
|
|
1220
|
-
given string. Appium: support only web testing
|
|
1221
|
-
|
|
1222
|
-
#### Parameters
|
|
1223
|
-
|
|
1224
|
-
- `text` value to check.
|
|
1225
|
-
|
|
1226
|
-
### seeInSource
|
|
1227
|
-
|
|
1228
|
-
Checks that the current page contains the given string in its raw source code.
|
|
1229
|
-
|
|
1230
|
-
```js
|
|
1231
|
-
I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1232
|
-
```
|
|
1233
|
-
|
|
1234
|
-
#### Parameters
|
|
1235
|
-
|
|
1236
|
-
- `text` [string][10] value to check.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
Appium: support
|
|
1240
|
-
|
|
1241
|
-
### seeInTitle
|
|
1242
|
-
|
|
1243
|
-
Checks that title contains text.
|
|
1244
|
-
|
|
1245
|
-
```js
|
|
1246
|
-
I.seeInTitle('Home Page');
|
|
1247
|
-
```
|
|
1248
|
-
|
|
1249
|
-
#### Parameters
|
|
1250
|
-
|
|
1251
|
-
- `text` [string][10] text value to check.
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
Appium: support only web testing
|
|
1255
|
-
|
|
1256
|
-
### seeNumberOfElements
|
|
1257
|
-
|
|
1258
|
-
Asserts that an element appears a given number of times in the DOM.
|
|
1259
|
-
Element is located by label or name or CSS or XPath.
|
|
1260
|
-
Appium: support
|
|
1261
|
-
|
|
1262
|
-
```js
|
|
1263
|
-
I.seeNumberOfElements('#submitBtn', 1);
|
|
1264
|
-
```
|
|
1265
|
-
|
|
1266
|
-
#### Parameters
|
|
1267
|
-
|
|
1268
|
-
- `locator` element located by CSS|XPath|strict locator.
|
|
1269
|
-
- `num` number of elements.
|
|
1270
|
-
|
|
1271
|
-
### seeNumberOfVisibleElements
|
|
1272
|
-
|
|
1273
|
-
Asserts that an element is visible a given number of times.
|
|
1274
|
-
Element is located by CSS or XPath.
|
|
1275
|
-
|
|
1276
|
-
```js
|
|
1277
|
-
I.seeNumberOfVisibleElements('.buttons', 3);
|
|
1278
|
-
```
|
|
1279
|
-
|
|
1280
|
-
#### Parameters
|
|
1281
|
-
|
|
1282
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1283
|
-
- `num` [number][15] number of elements.
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
### seeTextEquals
|
|
1288
|
-
|
|
1289
|
-
Checks that text is equal to provided one.
|
|
1290
|
-
|
|
1291
|
-
```js
|
|
1292
|
-
I.seeTextEquals('text', 'h1');
|
|
1293
|
-
```
|
|
1294
|
-
|
|
1295
|
-
#### Parameters
|
|
1296
|
-
|
|
1297
|
-
- `text` element value to check.
|
|
1298
|
-
- `context` (optional) element located by CSS|XPath|strict locator.
|
|
1299
|
-
|
|
1300
|
-
### seeTitleEquals
|
|
1301
|
-
|
|
1302
|
-
Checks that title is equal to provided one.
|
|
1303
|
-
|
|
1304
|
-
```js
|
|
1305
|
-
I.seeTitleEquals('Test title.');
|
|
1306
|
-
```
|
|
1307
|
-
|
|
1308
|
-
#### Parameters
|
|
1309
|
-
|
|
1310
|
-
- `text` value to check.
|
|
1311
|
-
|
|
1312
|
-
### selectOption
|
|
1313
|
-
|
|
1314
|
-
{{> selectOption}}
|
|
1315
|
-
|
|
1316
|
-
#### Parameters
|
|
1317
|
-
|
|
1318
|
-
- `select`
|
|
1319
|
-
- `option`
|
|
1320
|
-
|
|
1321
|
-
### setCookie
|
|
1322
|
-
|
|
1323
|
-
{{> setCookie}}
|
|
1324
|
-
Appium: support only web testing
|
|
1325
|
-
|
|
1326
|
-
Uses Selenium's JSON [cookie
|
|
1327
|
-
format][18].
|
|
1328
|
-
|
|
1329
|
-
#### Parameters
|
|
1330
|
-
|
|
1331
|
-
- `cookie`
|
|
1332
|
-
|
|
1333
|
-
### switchTo
|
|
1334
|
-
|
|
1335
|
-
Switches frame or in case of null locator reverts to parent.
|
|
1336
|
-
|
|
1337
|
-
```js
|
|
1338
|
-
I.switchTo('iframe'); // switch to first iframe
|
|
1339
|
-
I.switchTo(); // switch back to main page
|
|
1340
|
-
```
|
|
1341
|
-
|
|
1342
|
-
#### Parameters
|
|
1343
|
-
|
|
1344
|
-
- `locator` ([string][10] \| [object][11]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
Appium: support only web testing
|
|
1348
|
-
|
|
1349
|
-
### switchToNextTab
|
|
1350
|
-
|
|
1351
|
-
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab.
|
|
1352
|
-
|
|
1353
|
-
```js
|
|
1354
|
-
I.switchToNextTab();
|
|
1355
|
-
I.switchToNextTab(2);
|
|
1356
|
-
```
|
|
1357
|
-
|
|
1358
|
-
#### Parameters
|
|
1359
|
-
|
|
1360
|
-
- `num` (optional) number of tabs to switch forward, default: 1.
|
|
1361
|
-
- `sec` (optional) time in seconds to wait.
|
|
1362
|
-
|
|
1363
|
-
### switchToPreviousTab
|
|
1364
|
-
|
|
1365
|
-
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab.
|
|
1366
|
-
|
|
1367
|
-
```js
|
|
1368
|
-
I.switchToPreviousTab();
|
|
1369
|
-
I.switchToPreviousTab(2);
|
|
1370
|
-
```
|
|
1371
|
-
|
|
1372
|
-
#### Parameters
|
|
1373
|
-
|
|
1374
|
-
- `num` (optional) number of tabs to switch backward, default: 1.
|
|
1375
|
-
- `sec` (optional) time in seconds to wait.
|
|
1376
|
-
|
|
1377
|
-
### uncheckOption
|
|
1378
|
-
|
|
1379
|
-
Unselects a checkbox or radio button.
|
|
1380
|
-
Element is located by label or name or CSS or XPath.
|
|
1381
|
-
|
|
1382
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
1383
|
-
|
|
1384
|
-
```js
|
|
1385
|
-
I.uncheckOption('#agree');
|
|
1386
|
-
I.uncheckOption('I Agree to Terms and Conditions');
|
|
1387
|
-
I.uncheckOption('agree', '//form');
|
|
1388
|
-
```
|
|
1389
|
-
|
|
1390
|
-
#### Parameters
|
|
1391
|
-
|
|
1392
|
-
- `field` ([string][10] \| [object][11]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
1393
|
-
- `context` [string][10] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
Appium: not tested
|
|
1397
|
-
|
|
1398
|
-
### wait
|
|
1399
|
-
|
|
1400
|
-
Pauses execution for a number of seconds.
|
|
1401
|
-
|
|
1402
|
-
```js
|
|
1403
|
-
I.wait(2); // wait 2 secs
|
|
1404
|
-
```
|
|
1405
|
-
|
|
1406
|
-
#### Parameters
|
|
1407
|
-
|
|
1408
|
-
- `sec` [number][15] number of second to wait.
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
Appium: support
|
|
1412
|
-
|
|
1413
|
-
### waitForDetached
|
|
1414
|
-
|
|
1415
|
-
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
1416
|
-
Element can be located by CSS or XPath.
|
|
1417
|
-
|
|
1418
|
-
```js
|
|
1419
|
-
I.waitForDetached('#popup');
|
|
1420
|
-
```
|
|
1421
|
-
|
|
1422
|
-
#### Parameters
|
|
1423
|
-
|
|
1424
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1425
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
Appium: support
|
|
1429
|
-
|
|
1430
|
-
### waitForElement
|
|
1431
|
-
|
|
1432
|
-
Waits for element to be present on page (by default waits for 1sec).
|
|
1433
|
-
Element can be located by CSS or XPath.
|
|
1434
|
-
|
|
1435
|
-
```js
|
|
1436
|
-
I.waitForElement('.btn.continue');
|
|
1437
|
-
I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
1438
|
-
```
|
|
1439
|
-
|
|
1440
|
-
#### Parameters
|
|
1441
|
-
|
|
1442
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1443
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
Appium: support
|
|
1447
|
-
|
|
1448
|
-
### waitForEnabled
|
|
1449
|
-
|
|
1450
|
-
Waits for element to become enabled (by default waits for 1sec).
|
|
1451
|
-
Element can be located by CSS or XPath.
|
|
1452
|
-
|
|
1453
|
-
#### Parameters
|
|
1454
|
-
|
|
1455
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1456
|
-
- `sec` (optional) time in seconds to wait, 1 by default.
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
Appium: support
|
|
1460
|
-
|
|
1461
|
-
### waitForFunction
|
|
1462
|
-
|
|
1463
|
-
Waits for a function to return true (waits for 1 sec by default).
|
|
1464
|
-
Running in browser context.
|
|
1465
|
-
|
|
1466
|
-
```js
|
|
1467
|
-
I.waitForFunction(fn[, [args[, timeout]])
|
|
1468
|
-
```
|
|
1469
|
-
|
|
1470
|
-
```js
|
|
1471
|
-
I.waitForFunction(() => window.requests == 0);
|
|
1472
|
-
I.waitForFunction(() => window.requests == 0, 5); // waits for 5 sec
|
|
1473
|
-
I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and wait for 5 sec
|
|
1474
|
-
```
|
|
1475
|
-
|
|
1476
|
-
#### Parameters
|
|
1477
|
-
|
|
1478
|
-
- `fn` ([string][10] \| [function][13]) to be executed in browser context.
|
|
1479
|
-
- `argsOrSec` ([array][17] \| [number][15]) (optional, `1` by default) arguments for function or seconds.
|
|
1480
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
Appium: support
|
|
1484
|
-
|
|
1485
|
-
### waitForInvisible
|
|
1486
|
-
|
|
1487
|
-
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
1488
|
-
Element can be located by CSS or XPath.
|
|
1489
|
-
|
|
1490
|
-
```js
|
|
1491
|
-
I.waitForInvisible('#popup');
|
|
1492
|
-
```
|
|
1493
|
-
|
|
1494
|
-
#### Parameters
|
|
1495
|
-
|
|
1496
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1497
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
Appium: support
|
|
1501
|
-
|
|
1502
|
-
### waitForText
|
|
1503
|
-
|
|
1504
|
-
Waits for a text to appear (by default waits for 1sec).
|
|
1505
|
-
Element can be located by CSS or XPath.
|
|
1506
|
-
Narrow down search results by providing context.
|
|
1507
|
-
|
|
1508
|
-
```js
|
|
1509
|
-
I.waitForText('Thank you, form has been submitted');
|
|
1510
|
-
I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
1511
|
-
```
|
|
1512
|
-
|
|
1513
|
-
#### Parameters
|
|
1514
|
-
|
|
1515
|
-
- `text` [string][10] to wait for.
|
|
1516
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1517
|
-
- `context` ([string][10] \| [object][11]) (optional) element located by CSS|XPath|strict locator.
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
Appium: support
|
|
1521
|
-
|
|
1522
|
-
### waitForValue
|
|
1523
|
-
|
|
1524
|
-
Waits for the specified value to be in value attribute.
|
|
1525
|
-
|
|
1526
|
-
```js
|
|
1527
|
-
I.waitForValue('//input', "GoodValue");
|
|
1528
|
-
```
|
|
1529
|
-
|
|
1530
|
-
#### Parameters
|
|
1531
|
-
|
|
1532
|
-
- `field` ([string][10] \| [object][11]) input field.
|
|
1533
|
-
- `value` [string][10] expected value.
|
|
1534
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
### waitForVisible
|
|
1539
|
-
|
|
1540
|
-
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
1541
|
-
Element can be located by CSS or XPath.
|
|
1542
|
-
|
|
1543
|
-
```js
|
|
1544
|
-
I.waitForVisible('#popup');
|
|
1545
|
-
```
|
|
1546
|
-
|
|
1547
|
-
#### Parameters
|
|
1548
|
-
|
|
1549
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1550
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
Appium: support
|
|
1554
|
-
|
|
1555
|
-
### waitInUrl
|
|
1556
|
-
|
|
1557
|
-
Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
1558
|
-
|
|
1559
|
-
```js
|
|
1560
|
-
I.waitInUrl('/info', 2);
|
|
1561
|
-
```
|
|
1562
|
-
|
|
1563
|
-
#### Parameters
|
|
1564
|
-
|
|
1565
|
-
- `urlPart` [string][10] value to check.
|
|
1566
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
### waitNumberOfVisibleElements
|
|
1571
|
-
|
|
1572
|
-
Waits for a specified number of elements on the page.
|
|
1573
|
-
|
|
1574
|
-
```js
|
|
1575
|
-
I.waitNumberOfVisibleElements('a', 3);
|
|
1576
|
-
```
|
|
1577
|
-
|
|
1578
|
-
#### Parameters
|
|
1579
|
-
|
|
1580
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1581
|
-
- `num` [number][15] number of elements.
|
|
1582
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
### waitToHide
|
|
1587
|
-
|
|
1588
|
-
Waits for an element to hide (by default waits for 1sec).
|
|
1589
|
-
Element can be located by CSS or XPath.
|
|
1590
|
-
|
|
1591
|
-
```js
|
|
1592
|
-
I.waitToHide('#popup');
|
|
1593
|
-
```
|
|
1594
|
-
|
|
1595
|
-
#### Parameters
|
|
1596
|
-
|
|
1597
|
-
- `locator` ([string][10] \| [object][11]) element located by CSS|XPath|strict locator.
|
|
1598
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
Appium: support
|
|
1602
|
-
|
|
1603
|
-
### waitUntil
|
|
1604
|
-
|
|
1605
|
-
Waits for a function to return true (waits for 1sec by default).
|
|
1606
|
-
|
|
1607
|
-
```js
|
|
1608
|
-
I.waitUntil(() => window.requests == 0);
|
|
1609
|
-
I.waitUntil(() => window.requests == 0, 5);
|
|
1610
|
-
```
|
|
1611
|
-
|
|
1612
|
-
#### Parameters
|
|
1613
|
-
|
|
1614
|
-
- `fn` ([function][13] \| [string][10]) function which is executed in browser context.
|
|
1615
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1616
|
-
- `timeoutMsg` [string][10] message to show in case of timeout fail.
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
- `interval` (optional) time in seconds between condition checks.- _Appium_: supported
|
|
1620
|
-
|
|
1621
|
-
### waitUrlEquals
|
|
1622
|
-
|
|
1623
|
-
Waits for the entire URL to match the expected
|
|
1624
|
-
|
|
1625
|
-
```js
|
|
1626
|
-
I.waitUrlEquals('/info', 2);
|
|
1627
|
-
I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
1628
|
-
```
|
|
1629
|
-
|
|
1630
|
-
#### Parameters
|
|
1631
|
-
|
|
1632
|
-
- `urlPart` [string][10] value to check.
|
|
1633
|
-
- `sec` [number][15] (optional, `1` by default) time in seconds to wait
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
[1]: http://webdriver.io/
|
|
1638
|
-
|
|
1639
|
-
[2]: http://codecept.io/quickstart/#prepare-selenium-server
|
|
1640
|
-
|
|
1641
|
-
[3]: http://codecept.io/acceptance/#smartwait
|
|
1642
|
-
|
|
1643
|
-
[4]: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
|
|
1644
|
-
|
|
1645
|
-
[5]: http://webdriver.io/guide/testrunner/timeouts.html
|
|
1646
|
-
|
|
1647
|
-
[6]: http://webdriver.io/guide/getstarted/configuration.html
|
|
1648
|
-
|
|
1649
|
-
[7]: http://webdriver.io/guide/usage/cloudservices.html
|
|
1650
|
-
|
|
1651
|
-
[8]: http://webdriver.io/guide/usage/multiremote.html
|
|
1652
|
-
|
|
1653
|
-
[9]: http://jster.net/category/windows-modals-popups
|
|
1654
|
-
|
|
1655
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1656
|
-
|
|
1657
|
-
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1658
|
-
|
|
1659
|
-
[12]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
1660
|
-
|
|
1661
|
-
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1662
|
-
|
|
1663
|
-
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1664
|
-
|
|
1665
|
-
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1666
|
-
|
|
1667
|
-
[16]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
|
|
1668
|
-
|
|
1669
|
-
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1670
|
-
|
|
1671
|
-
[18]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|