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.
Files changed (269) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +28 -6
  3. package/bin/codecept.js +42 -0
  4. package/docs/advanced.md +45 -1
  5. package/docs/angular.md +3 -3
  6. package/docs/basics.md +162 -118
  7. package/docs/bdd.md +30 -5
  8. package/docs/best.md +8 -6
  9. package/docs/books.md +6 -1
  10. package/docs/build/Appium.js +95 -85
  11. package/docs/build/FileSystem.js +48 -3
  12. package/docs/build/GraphQL.js +3 -2
  13. package/docs/build/GraphQLDataFactory.js +1 -0
  14. package/docs/build/Mochawesome.js +3 -2
  15. package/docs/build/MockRequest.js +23 -5
  16. package/docs/build/Nightmare.js +87 -128
  17. package/docs/build/Protractor.js +107 -155
  18. package/docs/build/Puppeteer.js +190 -174
  19. package/docs/build/REST.js +13 -9
  20. package/docs/build/SeleniumWebdriver.js +0 -17
  21. package/docs/build/TestCafe.js +164 -158
  22. package/docs/build/WebDriver.js +236 -211
  23. package/docs/build/WebDriverIO.js +218 -187
  24. package/docs/changelog.md +57 -1
  25. package/docs/commands.md +41 -2
  26. package/docs/community-helpers.md +12 -1
  27. package/docs/configuration.md +5 -2
  28. package/docs/continuous-integration.md +22 -0
  29. package/docs/{helpers.md → custom-helpers.md} +16 -10
  30. package/docs/data.md +7 -6
  31. package/docs/detox.md +6 -6
  32. package/docs/email.md +4 -2
  33. package/docs/examples.md +22 -3
  34. package/docs/helpers/ApiDataFactory.md +15 -13
  35. package/docs/helpers/Appium.md +1011 -468
  36. package/docs/helpers/Detox.md +33 -26
  37. package/docs/helpers/FileSystem.md +43 -13
  38. package/docs/helpers/GraphQL.md +17 -15
  39. package/docs/helpers/GraphQLDataFactory.md +15 -13
  40. package/docs/helpers/Mochawesome.md +3 -1
  41. package/docs/helpers/MockRequest.md +37 -19
  42. package/docs/helpers/Nightmare.md +129 -240
  43. package/docs/helpers/Polly.md +1 -1
  44. package/docs/helpers/Protractor.md +157 -298
  45. package/docs/helpers/Puppeteer.md +216 -335
  46. package/docs/helpers/REST.md +29 -24
  47. package/docs/helpers/TestCafe.md +137 -235
  48. package/docs/helpers/WebDriver.md +250 -347
  49. package/docs/hooks.md +14 -10
  50. package/docs/index.md +112 -0
  51. package/docs/installation.md +3 -1
  52. package/docs/locators.md +19 -8
  53. package/docs/mobile-react-native-locators.md +2 -2
  54. package/docs/mobile.md +5 -3
  55. package/docs/nightmare.md +2 -1
  56. package/docs/pageobjects.md +4 -2
  57. package/docs/parallel.md +4 -2
  58. package/docs/plugins.md +41 -15
  59. package/docs/puppeteer.md +8 -6
  60. package/docs/quickstart.md +130 -0
  61. package/docs/react.md +4 -2
  62. package/docs/reports.md +6 -4
  63. package/docs/testcafe.md +10 -8
  64. package/docs/translation.md +4 -2
  65. package/docs/ui.md +56 -0
  66. package/docs/videos.md +11 -2
  67. package/docs/visual.md +7 -5
  68. package/docs/vue.md +121 -0
  69. package/docs/webapi/appendField.mustache +1 -1
  70. package/docs/webapi/attachFile.mustache +1 -1
  71. package/docs/webapi/checkOption.mustache +2 -2
  72. package/docs/webapi/clearCookie.mustache +1 -1
  73. package/docs/webapi/click.mustache +2 -2
  74. package/docs/webapi/clickLink.mustache +2 -2
  75. package/docs/webapi/dontSee.mustache +1 -2
  76. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  77. package/docs/webapi/dontSeeElement.mustache +1 -1
  78. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  79. package/docs/webapi/dontSeeInField.mustache +1 -1
  80. package/docs/webapi/doubleClick.mustache +2 -2
  81. package/docs/webapi/downloadFile.mustache +1 -1
  82. package/docs/webapi/dragSlider.mustache +1 -1
  83. package/docs/webapi/executeAsyncScript.mustache +2 -1
  84. package/docs/webapi/executeScript.mustache +2 -1
  85. package/docs/webapi/fillField.mustache +1 -1
  86. package/docs/webapi/grabAttributeFrom.mustache +1 -1
  87. package/docs/webapi/grabBrowserLogs.mustache +1 -1
  88. package/docs/webapi/grabCookie.mustache +2 -2
  89. package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
  90. package/docs/webapi/grabHTMLFrom.mustache +1 -1
  91. package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
  92. package/docs/webapi/grabPageScrollPosition.mustache +1 -1
  93. package/docs/webapi/grabTextFrom.mustache +2 -2
  94. package/docs/webapi/grabValueFrom.mustache +1 -1
  95. package/docs/webapi/moveCursorTo.mustache +3 -3
  96. package/docs/webapi/pressKey.mustache +1 -1
  97. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  98. package/docs/webapi/rightClick.mustache +2 -2
  99. package/docs/webapi/saveScreenshot.mustache +1 -1
  100. package/docs/webapi/scrollIntoView.mustache +10 -0
  101. package/docs/webapi/scrollTo.mustache +3 -3
  102. package/docs/webapi/see.mustache +1 -1
  103. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  104. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  105. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  106. package/docs/webapi/seeElement.mustache +1 -1
  107. package/docs/webapi/seeElementInDOM.mustache +1 -1
  108. package/docs/webapi/seeInField.mustache +1 -1
  109. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  110. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  111. package/docs/webapi/seeTextEquals.mustache +8 -0
  112. package/docs/webapi/selectOption.mustache +2 -2
  113. package/docs/webapi/switchTo.mustache +1 -1
  114. package/docs/webapi/uncheckOption.mustache +2 -2
  115. package/docs/webapi/waitForClickable.mustache +10 -0
  116. package/docs/webapi/waitForDetached.mustache +2 -2
  117. package/docs/webapi/waitForElement.mustache +2 -2
  118. package/docs/webapi/waitForEnabled.mustache +2 -2
  119. package/docs/webapi/waitForFunction.mustache +2 -2
  120. package/docs/webapi/waitForInvisible.mustache +2 -2
  121. package/docs/webapi/waitForText.mustache +2 -2
  122. package/docs/webapi/waitForValue.mustache +1 -1
  123. package/docs/webapi/waitForVisible.mustache +2 -2
  124. package/docs/webapi/waitInUrl.mustache +1 -1
  125. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
  126. package/docs/webapi/waitToHide.mustache +2 -2
  127. package/docs/webapi/waitUntil.mustache +3 -2
  128. package/docs/webapi/waitUrlEquals.mustache +1 -1
  129. package/docs/webdriver.md +20 -18
  130. package/docs/wiki/.git/FETCH_HEAD +1 -0
  131. package/docs/wiki/.git/HEAD +1 -0
  132. package/docs/wiki/.git/ORIG_HEAD +1 -0
  133. package/docs/wiki/.git/config +11 -0
  134. package/docs/wiki/.git/description +1 -0
  135. package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
  136. package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
  137. package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
  138. package/docs/wiki/.git/hooks/post-update.sample +8 -0
  139. package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
  140. package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
  141. package/docs/wiki/.git/hooks/pre-push.sample +53 -0
  142. package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
  143. package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
  144. package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
  145. package/docs/wiki/.git/hooks/update.sample +128 -0
  146. package/docs/wiki/.git/index +0 -0
  147. package/docs/wiki/.git/info/exclude +6 -0
  148. package/docs/wiki/.git/logs/HEAD +4 -0
  149. package/docs/wiki/.git/logs/refs/heads/master +4 -0
  150. package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
  151. package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
  152. package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
  153. package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
  154. package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
  155. package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
  156. package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
  157. package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
  158. package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
  159. package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
  160. package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
  161. package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
  162. package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
  163. package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
  164. package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
  165. package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
  166. package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
  167. package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
  168. package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
  169. package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
  170. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
  171. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
  172. package/docs/wiki/.git/packed-refs +2 -0
  173. package/docs/wiki/.git/refs/heads/master +1 -0
  174. package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
  175. package/docs/wiki/.git/refs/remotes/origin/master +1 -0
  176. package/docs/wiki/Books-&-Posts.md +27 -0
  177. package/docs/wiki/Community-Helpers.md +41 -0
  178. package/docs/wiki/Examples.md +138 -0
  179. package/docs/wiki/Home.md +11 -0
  180. package/docs/wiki/Release-process.md +25 -0
  181. package/docs/wiki/Roadmap.md +23 -0
  182. package/docs/wiki/Videos.md +19 -0
  183. package/lib/actor.js +18 -1
  184. package/lib/assert/error.js +3 -3
  185. package/lib/codecept.js +9 -6
  186. package/lib/command/configMigrate.js +7 -6
  187. package/lib/command/definitions.js +98 -350
  188. package/lib/command/generate.js +22 -17
  189. package/lib/command/gherkin/init.js +2 -1
  190. package/lib/command/gherkin/snippets.js +6 -6
  191. package/lib/command/gherkin/steps.js +0 -1
  192. package/lib/command/info.js +40 -0
  193. package/lib/command/init.js +54 -41
  194. package/lib/command/run-multiple.js +5 -4
  195. package/lib/command/run-rerun.js +39 -0
  196. package/lib/command/run-workers.js +4 -6
  197. package/lib/command/run.js +8 -18
  198. package/lib/command/utils.js +23 -2
  199. package/lib/command/workers/runTests.js +1 -2
  200. package/lib/config.js +10 -4
  201. package/lib/container.js +31 -6
  202. package/lib/data/dataTableArgument.js +31 -0
  203. package/lib/data/table.js +4 -0
  204. package/lib/event.js +65 -1
  205. package/lib/helper/Appium.js +52 -38
  206. package/lib/helper/FileSystem.js +48 -3
  207. package/lib/helper/GraphQL.js +3 -2
  208. package/lib/helper/GraphQLDataFactory.js +1 -0
  209. package/lib/helper/Mochawesome.js +3 -2
  210. package/lib/helper/MockRequest.js +23 -5
  211. package/lib/helper/Nightmare.js +5 -6
  212. package/lib/helper/Protractor.js +7 -8
  213. package/lib/helper/Puppeteer.js +76 -20
  214. package/lib/helper/REST.js +13 -9
  215. package/lib/helper/SeleniumWebdriver.js +0 -17
  216. package/lib/helper/TestCafe.js +84 -36
  217. package/lib/helper/WebDriver.js +113 -59
  218. package/lib/helper/WebDriverIO.js +43 -59
  219. package/lib/helper/clientscripts/nightmare.js +66 -4
  220. package/lib/helper/scripts/isElementClickable.js +24 -0
  221. package/lib/helper.js +34 -10
  222. package/lib/history.js +1 -1
  223. package/lib/hooks.js +2 -1
  224. package/lib/index.js +19 -0
  225. package/lib/interfaces/bdd.js +4 -0
  226. package/lib/interfaces/featureConfig.js +10 -3
  227. package/lib/interfaces/gherkin.js +6 -2
  228. package/lib/interfaces/scenarioConfig.js +17 -6
  229. package/lib/listener/config.js +1 -1
  230. package/lib/listener/exit.js +6 -0
  231. package/lib/listener/steps.js +0 -1
  232. package/lib/listener/trace.js +0 -1
  233. package/lib/locator.js +67 -2
  234. package/lib/output.js +53 -0
  235. package/lib/parser.js +2 -71
  236. package/lib/pause.js +3 -2
  237. package/lib/plugin/allure.js +41 -22
  238. package/lib/plugin/autoLogin.js +4 -1
  239. package/lib/plugin/pauseOnFail.js +38 -0
  240. package/lib/plugin/puppeteerCoverage.js +8 -7
  241. package/lib/plugin/screenshotOnFail.js +13 -8
  242. package/lib/plugin/stepByStepReport.js +7 -6
  243. package/lib/plugin/wdio.js +2 -1
  244. package/lib/recorder.js +85 -7
  245. package/lib/rerun.js +81 -0
  246. package/lib/secret.js +6 -0
  247. package/lib/session.js +9 -2
  248. package/lib/step.js +37 -2
  249. package/lib/store.js +5 -1
  250. package/lib/ui.js +34 -8
  251. package/lib/utils.js +6 -13
  252. package/lib/within.js +5 -0
  253. package/package.json +49 -29
  254. package/typings/Mocha.d.ts +21 -0
  255. package/typings/Protractor.d.ts +16 -0
  256. package/typings/index.d.ts +169 -0
  257. package/typings/jsdoc.conf.js +34 -0
  258. package/typings/jsdoc.namespace.js +29 -0
  259. package/typings/types.d.ts +9827 -0
  260. package/typings/utils.d.ts +7 -0
  261. package/docs/acceptance.md +0 -409
  262. package/docs/api/codecept.md +0 -75
  263. package/docs/api/config.md +0 -49
  264. package/docs/api/container.md +0 -66
  265. package/docs/api/helper.md +0 -116
  266. package/docs/api/output.md +0 -67
  267. package/docs/api/recorder.md +0 -63
  268. package/docs/helpers/SeleniumWebdriver.md +0 -92
  269. package/docs/helpers/WebDriverIO.md +0 -1671
@@ -1,13 +1,8 @@
1
- ---
2
- id: Appium
3
- title: Appium
4
- ---
5
-
6
1
  <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
7
2
 
8
3
  ## Appium
9
4
 
10
- Extends Webdriver
5
+ **Extends Webdriver**
11
6
 
12
7
  Appium helper extends [Webriver][1] helper.
13
8
  It supports all browser methods and also includes special methods for mobile apps testing.
@@ -119,176 +114,199 @@ let browser = this.helpers['Appium'].browser
119
114
 
120
115
  - `config`
121
116
 
122
- ### \_switchToContext
117
+ ### runOnIOS
123
118
 
124
- Switch to the specified context.
119
+ Execute code only on iOS
125
120
 
126
- #### Parameters
121
+ ```js
122
+ I.runOnIOS(() => {
123
+ I.click('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]');
124
+ I.see('Hi, IOS', '~welcome');
125
+ });
126
+ ```
127
127
 
128
- - `context` the context to switch to
128
+ Additional filter can be applied by checking for capabilities.
129
+ For instance, this code will be executed only on iPhone 5s:
129
130
 
130
- ### appendField
131
+ ```js
132
+ I.runOnIOS({deviceName: 'iPhone 5s'},() => {
133
+ // ...
134
+ });
135
+ ```
131
136
 
132
- Appends text to a input field or textarea.
133
- Field is located by name, label, CSS or XPath
137
+ Also capabilities can be checked by a function.
134
138
 
135
139
  ```js
136
- I.appendField('#myTextField', 'appended');
140
+ I.runOnAndroid((caps) => {
141
+ // caps is current config of desiredCapabiliites
142
+ return caps.platformVersion >= 6
143
+ },() => {
144
+ // ...
145
+ });
137
146
  ```
138
147
 
139
148
  #### Parameters
140
149
 
141
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator
142
- - `value` [string][4] text value to append.
143
-
150
+ - `caps` **any**
151
+ - `fn` **any**
144
152
 
153
+ ### runOnAndroid
145
154
 
146
- ### checkOption
155
+ Execute code only on Android
147
156
 
148
- Selects a checkbox or radio button.
149
- Element is located by label or name or CSS or XPath.
157
+ ```js
158
+ I.runOnAndroid(() => {
159
+ I.click('io.selendroid.testapp:id/buttonTest');
160
+ });
161
+ ```
150
162
 
151
- The second parameter is a context (CSS or XPath locator) to narrow the search.
163
+ Additional filter can be applied by checking for capabilities.
164
+ For instance, this code will be executed only on Android 6.0:
152
165
 
153
166
  ```js
154
- I.checkOption('#agree');
155
- I.checkOption('I Agree to Terms and Conditions');
156
- I.checkOption('agree', '//form');
167
+ I.runOnAndroid({platformVersion: '6.0'},() => {
168
+ // ...
169
+ });
157
170
  ```
158
171
 
159
- #### Parameters
172
+ Also capabilities can be checked by a function.
173
+ In this case, code will be executed only on Android >= 6.
160
174
 
161
- - `field` ([string][4] \| [object][5]) checkbox located by label | name | CSS | XPath | strict locator.
162
- - `context` [string][4] (optional, `null` by default) element located by CSS | XPath | strict locator.
163
-
175
+ ```js
176
+ I.runOnAndroid((caps) => {
177
+ // caps is current config of desiredCapabiliites
178
+ return caps.platformVersion >= 6
179
+ },() => {
180
+ // ...
181
+ });
182
+ ```
164
183
 
184
+ #### Parameters
165
185
 
166
- ### click
186
+ - `caps` **any**
187
+ - `fn` **any**
167
188
 
168
- Perform a click on a link or a button, given by a locator.
169
- If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
170
- For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
171
- For images, the "alt" attribute and inner text of any parent links are searched.
189
+ ### runInWeb
172
190
 
173
- The second parameter is a context (CSS or XPath locator) to narrow the search.
191
+ Execute code only in Web mode.
174
192
 
175
193
  ```js
176
- // simple link
177
- I.click('Logout');
178
- // button of form
179
- I.click('Submit');
180
- // CSS button
181
- I.click('#form input[type=submit]');
182
- // XPath
183
- I.click('//form/[@type=submit]');
184
- // link in context
185
- I.click('Logout', '#nav');
186
- // using strict locator
187
- I.click({css: 'nav a.login'});
194
+ I.runInWeb(() => {
195
+ I.waitForElement('#data');
196
+ I.seeInCurrentUrl('/data');
197
+ });
188
198
  ```
189
199
 
190
200
  #### Parameters
191
201
 
192
- - `locator` ([string][4] \| [object][5]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
193
- - `context` ([string][4] \| [object][5]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
194
-
202
+ - `fn` **any**
195
203
 
204
+ ### seeAppIsInstalled
196
205
 
197
- ### closeApp
198
-
199
- Close the given application.
206
+ Check if an app is installed.
200
207
 
201
208
  ```js
202
- I.closeApp();
209
+ I.seeAppIsInstalled("com.example.android.apis");
203
210
  ```
204
211
 
205
- Appium: support only iOS
212
+ #### Parameters
206
213
 
207
- ### dontSee
214
+ - `bundleId` **[string][4]** String ID of bundled appAppium: support only Android
208
215
 
209
- Opposite to `see`. Checks that a text is not present on a page.
210
- Use context parameter to narrow down the search.
216
+ ### seeAppIsNotInstalled
217
+
218
+ Check if an app is not installed.
211
219
 
212
220
  ```js
213
- I.dontSee('Login'); // assume we are already logged in.
214
- I.dontSee('Login', '.nav'); // no login inside .nav element
221
+ I.seeAppIsNotInstalled("com.example.android.apis");
215
222
  ```
216
223
 
217
224
  #### Parameters
218
225
 
219
- - `text` [string][4] which is not present.
220
- - `context` ([string][4] \| [object][5]) (optional) element located by CSS|XPath|strict locator in which to perfrom search.
221
-
226
+ - `bundleId` **[string][4]** String ID of bundled appAppium: support only Android
222
227
 
223
- ### dontSeeCheckboxIsChecked
228
+ ### installApp
224
229
 
225
- Verifies that the specified checkbox is not checked.
230
+ Install an app on device.
226
231
 
227
232
  ```js
228
- I.dontSeeCheckboxIsChecked('#agree'); // located by ID
229
- I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
230
- I.dontSeeCheckboxIsChecked('agree'); // located by name
233
+ I.installApp('/path/to/file.apk');
231
234
  ```
232
235
 
233
236
  #### Parameters
234
237
 
235
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator.
236
-
238
+ - `path` **[string][4]** path to apk fileAppium: support only Android
237
239
 
240
+ ### removeApp
238
241
 
239
- ### dontSeeElement
240
-
241
- Opposite to `seeElement`. Checks that element is not visible (or in DOM)
242
+ Remove an app from the device.
242
243
 
243
244
  ```js
244
- I.dontSeeElement('.modal'); // modal is not shown
245
+ I.removeApp('appName', 'com.example.android.apis');
245
246
  ```
246
247
 
247
248
  #### Parameters
248
249
 
249
- - `locator` ([string][4] \| [object][5]) located by CSS|XPath|Strict locator.
250
-
251
-
250
+ - `appId` **[string][4]**
251
+ - `bundleId` **[string][4]** String ID of bundleAppium: support only Android
252
252
 
253
- ### dontSeeInField
253
+ ### seeCurrentActivityIs
254
254
 
255
- Checks that value of input field or textarea doesn't equal to given value
256
- Opposite to `seeInField`.
255
+ Check current activity on an Android device.
257
256
 
258
257
  ```js
259
- I.dontSeeInField('email', 'user@user.com'); // field by name
260
- I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
258
+ I.seeCurrentActivityIs(".HomeScreenActivity")
261
259
  ```
262
260
 
263
261
  #### Parameters
264
262
 
265
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator.
266
- - `value` [string][4] value to check.
267
-
263
+ - `currentActivity` **[string][4]** Appium: support only Android
268
264
 
265
+ ### seeDeviceIsLocked
269
266
 
270
- ### fillField
267
+ Check whether the device is locked.
271
268
 
272
- Fills a text field or textarea, after clearing its value, with the given string.
273
- Field is located by name, label, CSS, or XPath.
269
+ ```js
270
+ I.seeDeviceIsLocked();
271
+ ```
272
+
273
+ Appium: support only Android
274
+
275
+ ### seeDeviceIsUnlocked
276
+
277
+ Check whether the device is not locked.
274
278
 
275
279
  ```js
276
- // by label
277
- I.fillField('Email', 'hello@world.com');
278
- // by name
279
- I.fillField('password', secret('123456'));
280
- // by CSS
281
- I.fillField('form#login input[name=username]', 'John');
282
- // or by strict locator
283
- I.fillField({css: 'form#login input[name=username]'}, 'John');
280
+ I.seeDeviceIsUnlocked();
281
+ ```
282
+
283
+ Appium: support only Android
284
+
285
+ ### seeOrientationIs
286
+
287
+ Check the device orientation
288
+
289
+ ```js
290
+ I.seeOrientationIs('PORTRAIT');
291
+ I.seeOrientationIs('LANDSCAPE')
284
292
  ```
285
293
 
286
294
  #### Parameters
287
295
 
288
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator.
289
- - `value` [string][4] text value to fill.
290
-
296
+ - `orientation` **(`"LANDSCAPE"` \| `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS
291
297
 
298
+ ### setOrientation
299
+
300
+ Set a device orientation. Will fail, if app will not set orientation
301
+
302
+ ```js
303
+ I.setOrientation('PORTRAIT');
304
+ I.setOrientation('LANDSCAPE')
305
+ ```
306
+
307
+ #### Parameters
308
+
309
+ - `orientation` **(`"LANDSCAPE"` \| `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS
292
310
 
293
311
  ### grabAllContexts
294
312
 
@@ -350,41 +368,97 @@ let settings = await I.grabSettings();
350
368
 
351
369
  Appium: support Android and iOS
352
370
 
353
- ### grabTextFrom
371
+ ### \_switchToContext
354
372
 
355
- Retrieves a text from an element located by CSS or XPath and returns it to test.
356
- Resumes test execution, so should be used inside async with `await` operator.
373
+ Switch to the specified context.
374
+
375
+ #### Parameters
376
+
377
+ - `context` **any** the context to switch to
378
+
379
+ ### switchToWeb
380
+
381
+ Switches to web context.
382
+ If no context is provided switches to the first detected web context
357
383
 
358
384
  ```js
359
- let pin = await I.grabTextFrom('#pin');
385
+ // switch to first web context
386
+ I.switchToWeb();
387
+
388
+ // or set the context explicitly
389
+ I.switchToWeb('WEBVIEW_io.selendroid.testapp');
360
390
  ```
361
391
 
362
- If multiple elements found returns an array of texts.
392
+ #### Parameters
393
+
394
+ - `context` **[string][4]?**
395
+
396
+ ### switchToNative
397
+
398
+ Switches to native context.
399
+ By default switches to NATIVE_APP context unless other specified.
400
+
401
+ ```js
402
+ I.switchToNative();
403
+
404
+ // or set context explicitly
405
+ I.switchToNative('SOME_OTHER_CONTEXT');
406
+ ```
363
407
 
364
408
  #### Parameters
365
409
 
366
- - `locator` element located by CSS|XPath|strict locator.
410
+ - `context` **any** (optional, default `null`)
411
+
412
+ ### startActivity
413
+
414
+ Start an arbitrary Android activity during a session.
415
+
416
+ ```js
417
+ I.startActivity('io.selendroid.testapp', '.RegisterUserActivity');
418
+ ```
419
+
420
+ Appium: support only Android
367
421
 
368
- Returns [Promise][6]&lt;[string][4]> attribute value
422
+ #### Parameters
369
423
 
424
+ - `appPackage`
425
+ - `appActivity`
370
426
 
427
+ ### setNetworkConnection
371
428
 
372
- ### grabValueFrom
429
+ Set network connection mode.
373
430
 
374
- Retrieves a value from a form element located by CSS or XPath and returns it to test.
375
- Resumes test execution, so should be used inside async function with `await` operator.
431
+ - airplane mode
432
+ - wifi mode
433
+ - data data
376
434
 
377
435
  ```js
378
- let email = await I.grabValueFrom('input[name=email]');
436
+ I.setNetworkConnection(0) // airplane mode off, wifi off, data off
437
+ I.setNetworkConnection(1) // airplane mode on, wifi off, data off
438
+ I.setNetworkConnection(2) // airplane mode off, wifi on, data off
439
+ I.setNetworkConnection(4) // airplane mode off, wifi off, data on
440
+ I.setNetworkConnection(6) // airplane mode off, wifi on, data on
379
441
  ```
380
442
 
443
+ See corresponding [webdriverio reference][5].
444
+
445
+ Appium: support only Android
446
+
381
447
  #### Parameters
382
448
 
383
- - `locator` ([string][4] \| [object][5]) field located by label|name|CSS|XPath|strict locator.
449
+ - `value`
450
+
451
+ ### setSettings
452
+
453
+ Update the current setting on the device
384
454
 
385
- Returns [Promise][6]&lt;[string][4]> attribute value
455
+ ```js
456
+ I.setSettings({cyberdelia: 'open'});
457
+ ```
386
458
 
459
+ #### Parameters
387
460
 
461
+ - `settings` **[object][6]** objectAppium: support Android and iOS
388
462
 
389
463
  ### hideDeviceKeyboard
390
464
 
@@ -401,31 +475,42 @@ I.hideDeviceKeyboard('pressKey', 'Done');
401
475
 
402
476
  #### Parameters
403
477
 
404
- - `strategy` desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)Appium: support Android and iOS
478
+ - `strategy` **(`"tapOutside"` \| `"pressKey"`)** desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)Appium: support Android and iOS
405
479
  - `key`
406
480
 
407
- ### installApp
481
+ ### sendDeviceKeyEvent
408
482
 
409
- Install an app on device.
483
+ Send a key event to the device.
484
+ List of keys: [https://developer.android.com/reference/android/view/KeyEvent.html][7]
410
485
 
411
486
  ```js
412
- I.installApp('/path/to/file.apk');
487
+ I.sendDeviceKeyEvent(3);
413
488
  ```
414
489
 
415
490
  #### Parameters
416
491
 
417
- - `path` path to apk fileAppium: support only Android
492
+ - `keyValue` **[number][8]** Device specific key valueAppium: support only Android
418
493
 
419
- ### makeTouchAction
494
+ ### openNotifications
420
495
 
421
- The Touch Action API provides the basis of all gestures that can be
422
- automated in Appium. At its core is the ability to chain together ad hoc
423
- individual actions, which will then be applied to an element in the
424
- application on the device.
425
- [See complete documentation][7]
496
+ Open the notifications panel on the device.
426
497
 
427
498
  ```js
428
- I.makeTouchAction("~buttonStartWebviewCD", 'tap');
499
+ I.openNotifications();
500
+ ```
501
+
502
+ Appium: support only Android
503
+
504
+ ### makeTouchAction
505
+
506
+ The Touch Action API provides the basis of all gestures that can be
507
+ automated in Appium. At its core is the ability to chain together ad hoc
508
+ individual actions, which will then be applied to an element in the
509
+ application on the device.
510
+ [See complete documentation][9]
511
+
512
+ ```js
513
+ I.makeTouchAction("~buttonStartWebviewCD", 'tap');
429
514
  ```
430
515
 
431
516
  Appium: support Android and iOS
@@ -435,15 +520,37 @@ Appium: support Android and iOS
435
520
  - `locator`
436
521
  - `action`
437
522
 
438
- ### openNotifications
523
+ ### tap
439
524
 
440
- Open the notifications panel on the device.
525
+ Taps on element.
441
526
 
442
527
  ```js
443
- I.openNotifications();
528
+ I.tap("~buttonStartWebviewCD");
444
529
  ```
445
530
 
446
- Appium: support only Android
531
+ Shortcut for `makeTouchAction`
532
+
533
+ #### Parameters
534
+
535
+ - `locator` **any**
536
+
537
+ ### swipe
538
+
539
+ Perform a swipe on the screen or an element.
540
+
541
+ ```js
542
+ let locator = "#io.selendroid.testapp:id/LinearLayout1";
543
+ I.swipe(locator, 800, 1200, 1000);
544
+ ```
545
+
546
+ [See complete reference][10]
547
+
548
+ #### Parameters
549
+
550
+ - `locator` **([string][4] \| [object][6])**
551
+ - `xoffset` **[number][8]**
552
+ - `yoffset` **[number][8]**
553
+ - `speed` **[number][8]** (optional), 1000 by defaultAppium: support Android and iOS (optional, default `1000`)
447
554
 
448
555
  ### performSwipe
449
556
 
@@ -455,8 +562,130 @@ I.performswipe(100,200);
455
562
 
456
563
  #### Parameters
457
564
 
458
- - `from`
459
- - `to` Appium: support Android and iOS
565
+ - `from` **[number][8]**
566
+ - `to` **[number][8]** Appium: support Android and iOS
567
+
568
+ ### swipeDown
569
+
570
+ Perform a swipe down on an element.
571
+
572
+ ```js
573
+ let locator = "#io.selendroid.testapp:id/LinearLayout1";
574
+ I.swipeDown(locator); // simple swipe
575
+ I.swipeDown(locator, 500); // set speed
576
+ I.swipeDown(locator, 1200, 1000); // set offset and speed
577
+ ```
578
+
579
+ #### Parameters
580
+
581
+ - `locator` **([string][4] \| [object][6])**
582
+ - `yoffset` **[number][8]?** (optional) (optional, default `1000`)
583
+ - `speed` **[number][8]** (optional), 1000 by defaultAppium: support Android and iOS (optional, default `1000`)
584
+
585
+ ### swipeLeft
586
+
587
+ Perform a swipe left on an element.
588
+
589
+ ```js
590
+ let locator = "#io.selendroid.testapp:id/LinearLayout1";
591
+ I.swipeLeft(locator); // simple swipe
592
+ I.swipeLeft(locator, 500); // set speed
593
+ I.swipeLeft(locator, 1200, 1000); // set offset and speed
594
+ ```
595
+
596
+ #### Parameters
597
+
598
+ - `locator` **([string][4] \| [object][6])**
599
+ - `xoffset` **[number][8]?** (optional) (optional, default `1000`)
600
+ - `speed` **[number][8]** (optional), 1000 by defaultAppium: support Android and iOS (optional, default `1000`)
601
+
602
+ ### swipeRight
603
+
604
+ Perform a swipe right on an element.
605
+
606
+ ```js
607
+ let locator = "#io.selendroid.testapp:id/LinearLayout1";
608
+ I.swipeRight(locator); // simple swipe
609
+ I.swipeRight(locator, 500); // set speed
610
+ I.swipeRight(locator, 1200, 1000); // set offset and speed
611
+ ```
612
+
613
+ #### Parameters
614
+
615
+ - `locator` **([string][4] \| [object][6])**
616
+ - `xoffset` **[number][8]?** (optional) (optional, default `1000`)
617
+ - `speed` **[number][8]** (optional), 1000 by defaultAppium: support Android and iOS (optional, default `1000`)
618
+
619
+ ### swipeUp
620
+
621
+ Perform a swipe up on an element.
622
+
623
+ ```js
624
+ let locator = "#io.selendroid.testapp:id/LinearLayout1";
625
+ I.swipeUp(locator); // simple swipe
626
+ I.swipeUp(locator, 500); // set speed
627
+ I.swipeUp(locator, 1200, 1000); // set offset and speed
628
+ ```
629
+
630
+ #### Parameters
631
+
632
+ - `locator` **([string][4] \| [object][6])**
633
+ - `yoffset` **[number][8]?** (optional) (optional, default `1000`)
634
+ - `speed` **[number][8]** (optional), 1000 by defaultAppium: support Android and iOS (optional, default `1000`)
635
+
636
+ ### swipeTo
637
+
638
+ Perform a swipe in selected direction on an element to searchable element.
639
+
640
+ ```js
641
+ I.swipeTo(
642
+ "android.widget.CheckBox", // searchable element
643
+ "//android.widget.ScrollView/android.widget.LinearLayout", // scroll element
644
+ "up", // direction
645
+ 30,
646
+ 100,
647
+ 500);
648
+ ```
649
+
650
+ #### Parameters
651
+
652
+ - `searchableLocator` **[string][4]**
653
+ - `scrollLocator` **[string][4]**
654
+ - `direction` **[string][4]**
655
+ - `timeout` **[number][8]**
656
+ - `offset` **[number][8]**
657
+ - `speed` **[number][8]** Appium: support Android and iOS
658
+
659
+ ### touchPerform
660
+
661
+ Performs a specific touch action.
662
+ The action object need to contain the action name, x/y coordinates
663
+
664
+ ```js
665
+ I.touchPerform([{
666
+ action: 'press',
667
+ options: {
668
+ x: 100,
669
+ y: 200
670
+ }
671
+ }, {action: 'release'}])
672
+
673
+ I.touchPerform([{
674
+ action: 'tap',
675
+ options: {
676
+ element: '1', // json web element was queried before
677
+ x: 10, // x offset
678
+ y: 20, // y offset
679
+ count: 1 // number of touches
680
+ }
681
+ }]);
682
+ ```
683
+
684
+ Appium: support Android and iOS
685
+
686
+ #### Parameters
687
+
688
+ - `actions`
460
689
 
461
690
  ### pullFile
462
691
 
@@ -475,18 +704,15 @@ Appium: support Android and iOS
475
704
  - `path`
476
705
  - `dest`
477
706
 
478
- ### removeApp
707
+ ### shakeDevice
479
708
 
480
- Remove an app from the device.
709
+ Perform a shake action on the device.
481
710
 
482
711
  ```js
483
- I.removeApp('appName', 'com.example.android.apis');
712
+ I.shakeDevice();
484
713
  ```
485
714
 
486
- #### Parameters
487
-
488
- - `appId`
489
- - `bundleId` String ID of bundleAppium: support only Android
715
+ Appium: support only iOS
490
716
 
491
717
  ### rotate
492
718
 
@@ -496,7 +722,7 @@ Perform a rotation gesture centered on the specified element.
496
722
  I.rotate(120, 120)
497
723
  ```
498
724
 
499
- See corresponding [webdriverio reference][8].
725
+ See corresponding [webdriverio reference][11].
500
726
 
501
727
  Appium: support only iOS
502
728
 
@@ -509,92 +735,275 @@ Appium: support only iOS
509
735
  - `rotation`
510
736
  - `touchCount`
511
737
 
512
- ### runInWeb
738
+ ### setImmediateValue
513
739
 
514
- Execute code only in Web mode.
740
+ Set immediate value in app.
741
+
742
+ See corresponding [webdriverio reference][12].
743
+
744
+ Appium: support only iOS
745
+
746
+ #### Parameters
747
+
748
+ - `id`
749
+ - `value`
750
+
751
+ ### simulateTouchId
752
+
753
+ Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
515
754
 
516
755
  ```js
517
- I.runInWeb(() => {
518
- I.waitForElement('#data');
519
- I.seeInCurrentUrl('/data');
520
- });
756
+ I.touchId(); // simulates valid fingerprint
757
+ I.touchId(true); // simulates valid fingerprint
758
+ I.touchId(false); // simulates invalid fingerprint
521
759
  ```
522
760
 
761
+ Appium: support only iOS
762
+ TODO: not tested
763
+
523
764
  #### Parameters
524
765
 
525
- - `fn` any
766
+ - `match`
526
767
 
527
- ### runOnAndroid
768
+ ### closeApp
528
769
 
529
- Execute code only on Android
770
+ Close the given application.
530
771
 
531
772
  ```js
532
- I.runOnAndroid(() => {
533
- I.click('io.selendroid.testapp:id/buttonTest');
534
- });
773
+ I.closeApp();
535
774
  ```
536
775
 
537
- Additional filter can be applied by checking for capabilities.
538
- For instance, this code will be executed only on Android 6.0:
776
+ Appium: support only iOS
777
+
778
+ ### appendField
779
+
780
+ Appends text to a input field or textarea.
781
+ Field is located by name, label, CSS or XPath
539
782
 
540
783
  ```js
541
- I.runOnAndroid({platformVersion: '6.0'},() => {
542
- // ...
543
- });
784
+ I.appendField('#myTextField', 'appended');
544
785
  ```
545
786
 
546
- Also capabilities can be checked by a function.
547
- In this case, code will be executed only on Android >= 6.
787
+ #### Parameters
788
+
789
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator
790
+ - `value` **[string][4]** text value to append.
791
+
792
+ ### checkOption
793
+
794
+ Selects a checkbox or radio button.
795
+ Element is located by label or name or CSS or XPath.
796
+
797
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
548
798
 
549
799
  ```js
550
- I.runOnAndroid((caps) => {
551
- // caps is current config of desiredCapabiliites
552
- return caps.platformVersion >= 6
553
- },() => {
554
- // ...
555
- });
800
+ I.checkOption('#agree');
801
+ I.checkOption('I Agree to Terms and Conditions');
802
+ I.checkOption('agree', '//form');
556
803
  ```
557
804
 
558
805
  #### Parameters
559
806
 
560
- - `caps` any
561
- - `fn` any
807
+ - `field` **([string][4] \| [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
808
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator. (optional, default `null`)
562
809
 
563
- ### runOnIOS
810
+ ### click
564
811
 
565
- Execute code only on iOS
812
+ Perform a click on a link or a button, given by a locator.
813
+ If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
814
+ For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
815
+ For images, the "alt" attribute and inner text of any parent links are searched.
816
+
817
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
566
818
 
567
819
  ```js
568
- I.runOnIOS(() => {
569
- I.click('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]');
570
- I.see('Hi, IOS', '~welcome');
571
- });
820
+ // simple link
821
+ I.click('Logout');
822
+ // button of form
823
+ I.click('Submit');
824
+ // CSS button
825
+ I.click('#form input[type=submit]');
826
+ // XPath
827
+ I.click('//form/*[@type=submit]');
828
+ // link in context
829
+ I.click('Logout', '#nav');
830
+ // using strict locator
831
+ I.click({css: 'nav a.login'});
572
832
  ```
573
833
 
574
- Additional filter can be applied by checking for capabilities.
575
- For instance, this code will be executed only on iPhone 5s:
834
+ #### Parameters
835
+
836
+ - `locator` **([string][4] \| [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
837
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
838
+
839
+ ### dontSeeCheckboxIsChecked
840
+
841
+ Verifies that the specified checkbox is not checked.
576
842
 
577
843
  ```js
578
- I.runOnIOS({deviceName: 'iPhone 5s'},() => {
579
- // ...
580
- });
844
+ I.dontSeeCheckboxIsChecked('#agree'); // located by ID
845
+ I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
846
+ I.dontSeeCheckboxIsChecked('agree'); // located by name
581
847
  ```
582
848
 
583
- Also capabilities can be checked by a function.
849
+ #### Parameters
850
+
851
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
852
+
853
+ ### dontSeeElement
854
+
855
+ Opposite to `seeElement`. Checks that element is not visible (or in DOM)
584
856
 
585
857
  ```js
586
- I.runOnAndroid((caps) => {
587
- // caps is current config of desiredCapabiliites
588
- return caps.platformVersion >= 6
589
- },() => {
590
- // ...
591
- });
858
+ I.dontSeeElement('.modal'); // modal is not shown
592
859
  ```
593
860
 
594
861
  #### Parameters
595
862
 
596
- - `caps` any
597
- - `fn` any
863
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|Strict locator.
864
+
865
+ ### dontSeeInField
866
+
867
+ Checks that value of input field or textarea doesn't equal to given value
868
+ Opposite to `seeInField`.
869
+
870
+ ```js
871
+ I.dontSeeInField('email', 'user@user.com'); // field by name
872
+ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
873
+ ```
874
+
875
+ #### Parameters
876
+
877
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
878
+ - `value` **[string][4]** value to check.
879
+
880
+ ### dontSee
881
+
882
+ Opposite to `see`. Checks that a text is not present on a page.
883
+ Use context parameter to narrow down the search.
884
+
885
+ ```js
886
+ I.dontSee('Login'); // assume we are already logged in.
887
+ I.dontSee('Login', '.nav'); // no login inside .nav element
888
+ ```
889
+
890
+ #### Parameters
891
+
892
+ - `text` **[string][4]** which is not present.
893
+ - `context` **([string][4] \| [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. (optional, default `null`)
894
+
895
+ ### fillField
896
+
897
+ Fills a text field or textarea, after clearing its value, with the given string.
898
+ Field is located by name, label, CSS, or XPath.
899
+
900
+ ```js
901
+ // by label
902
+ I.fillField('Email', 'hello@world.com');
903
+ // by name
904
+ I.fillField('password', secret('123456'));
905
+ // by CSS
906
+ I.fillField('form#login input[name=username]', 'John');
907
+ // or by strict locator
908
+ I.fillField({css: 'form#login input[name=username]'}, 'John');
909
+ ```
910
+
911
+ #### Parameters
912
+
913
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
914
+ - `value` **[string][4]** text value to fill.
915
+
916
+ ### grabTextFrom
917
+
918
+ Retrieves a text from an element located by CSS or XPath and returns it to test.
919
+ Resumes test execution, so **should be used inside async with `await`** operator.
920
+
921
+ ```js
922
+ let pin = await I.grabTextFrom('#pin');
923
+ ```
924
+
925
+ If multiple elements found returns an array of texts.
926
+
927
+ #### Parameters
928
+
929
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
930
+
931
+ Returns **[Promise][13]&lt;([string][4] \| [Array][14]&lt;[string][4]>)>** attribute value
932
+
933
+ ### grabValueFrom
934
+
935
+ Retrieves a value from a form element located by CSS or XPath and returns it to test.
936
+ Resumes test execution, so **should be used inside async function with `await`** operator.
937
+
938
+ ```js
939
+ let email = await I.grabValueFrom('input[name=email]');
940
+ ```
941
+
942
+ #### Parameters
943
+
944
+ - `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
945
+
946
+ Returns **[Promise][13]&lt;[string][4]>** attribute value
947
+
948
+ ### scrollIntoView
949
+
950
+ Scroll element into viewport.
951
+
952
+ ```js
953
+ I.scrollIntoView('#submit');
954
+ I.scrollIntoView('#submit', true);
955
+ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
956
+ ```
957
+
958
+ #### Parameters
959
+
960
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
961
+ - `scrollIntoViewOptions`
962
+ - `alignToTop` **([boolean][15] \| [object][6])** (optional) or scrollIntoViewOptions (optional), see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][16].Supported only for web testing
963
+
964
+ ### seeCheckboxIsChecked
965
+
966
+ Verifies that the specified checkbox is checked.
967
+
968
+ ```js
969
+ I.seeCheckboxIsChecked('Agree');
970
+ I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
971
+ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
972
+ ```
973
+
974
+ #### Parameters
975
+
976
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
977
+
978
+ ### seeElement
979
+
980
+ Checks that a given Element is visible
981
+ Element is located by CSS or XPath.
982
+
983
+ ```js
984
+ I.seeElement('#modal');
985
+ ```
986
+
987
+ #### Parameters
988
+
989
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
990
+
991
+ ### seeInField
992
+
993
+ Checks that the given input field or textarea equals to given value.
994
+ For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
995
+
996
+ ```js
997
+ I.seeInField('Username', 'davert');
998
+ I.seeInField({css: 'form textarea'},'Type your comment here');
999
+ I.seeInField('form input[type=hidden]','hidden_value');
1000
+ I.seeInField('#searchform input','Search');
1001
+ ```
1002
+
1003
+ #### Parameters
1004
+
1005
+ - `field` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
1006
+ - `value` **[string][4]** value to check.
598
1007
 
599
1008
  ### see
600
1009
 
@@ -609,531 +1018,657 @@ I.see('Register', {css: 'form.register'}); // use strict locator
609
1018
 
610
1019
  #### Parameters
611
1020
 
612
- - `text` [string][4] expected on page.
613
- - `context` ([string][4] \| [object][5]) (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
614
-
1021
+ - `text` **[string][4]** expected on page.
1022
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text. (optional, default `null`)
1023
+
1024
+ ### selectOption
1025
+
1026
+ Selects an option in a drop-down select.
1027
+ Field is searched by label | name | CSS | XPath.
1028
+ Option is selected by visible text or by value.
1029
+
1030
+ ```js
1031
+ I.selectOption('Choose Plan', 'Monthly'); // select by label
1032
+ I.selectOption('subscription', 'Monthly'); // match option by text
1033
+ I.selectOption('subscription', '0'); // or by value
1034
+ I.selectOption('//form/select[@name=account]','Premium');
1035
+ I.selectOption('form select[name=account]', 'Premium');
1036
+ I.selectOption({css: 'form select[name=account]'}, 'Premium');
1037
+ ```
1038
+
1039
+ Provide an array for the second argument to select multiple options.
1040
+
1041
+ ```js
1042
+ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1043
+ ```
1044
+
1045
+ #### Parameters
1046
+
1047
+ - `select` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
1048
+ - `option` **([string][4] \| [Array][14]&lt;any>)** visible text or value of option.Supported only for web testing
1049
+
1050
+ ### waitForElement
1051
+
1052
+ Waits for element to be present on page (by default waits for 1sec).
1053
+ Element can be located by CSS or XPath.
1054
+
1055
+ ```js
1056
+ I.waitForElement('.btn.continue');
1057
+ I.waitForElement('.btn.continue', 5); // wait for 5 secs
1058
+ ```
1059
+
1060
+ #### Parameters
1061
+
1062
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1063
+ - `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait (optional, default `null`)
1064
+
1065
+ ### waitForVisible
1066
+
1067
+ Waits for an element to become visible on a page (by default waits for 1sec).
1068
+ Element can be located by CSS or XPath.
1069
+
1070
+ ```js
1071
+ I.waitForVisible('#popup');
1072
+ ```
1073
+
1074
+ #### Parameters
1075
+
1076
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1077
+ - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
1078
+
1079
+ ### waitForInvisible
1080
+
1081
+ Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
1082
+ Element can be located by CSS or XPath.
1083
+
1084
+ ```js
1085
+ I.waitForInvisible('#popup');
1086
+ ```
1087
+
1088
+ #### Parameters
1089
+
1090
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1091
+ - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
1092
+
1093
+ ### waitForText
1094
+
1095
+ Waits for a text to appear (by default waits for 1sec).
1096
+ Element can be located by CSS or XPath.
1097
+ Narrow down search results by providing context.
1098
+
1099
+ ```js
1100
+ I.waitForText('Thank you, form has been submitted');
1101
+ I.waitForText('Thank you, form has been submitted', 5, '#modal');
1102
+ ```
1103
+
1104
+ #### Parameters
1105
+
1106
+ - `text` **[string][4]** to wait for.
1107
+ - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
1108
+ - `context` **([string][4] \| [object][6])?** (optional) element located by CSS|XPath|strict locator. (optional, default `null`)
1109
+
1110
+ ### \_locate
1111
+
1112
+ Get elements by different locator types, including strict locator.
1113
+ Should be used in custom helpers:
1114
+
1115
+ ```js
1116
+ this.helpers['WebDriver']._locate({name: 'password'}).then //...
1117
+ ```
1118
+
1119
+ #### Parameters
1120
+
1121
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1122
+ - `smartWait` (optional, default `false`)
1123
+
1124
+ ### \_locateCheckable
1125
+
1126
+ Find a checkbox by providing human readable text:
1127
+
1128
+ ```js
1129
+ this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').then // ...
1130
+ ```
1131
+
1132
+ #### Parameters
1133
+
1134
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1135
+
1136
+ ### \_locateClickable
1137
+
1138
+ Find a clickable element by providing human readable text:
1139
+
1140
+ ```js
1141
+ this.helpers['WebDriver']._locateClickable('Next page').then // ...
1142
+ ```
1143
+
1144
+ #### Parameters
1145
+
1146
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1147
+
1148
+ ### \_locateFields
1149
+
1150
+ Find field elements by providing human readable text:
1151
+
1152
+ ```js
1153
+ this.helpers['WebDriver']._locateFields('Your email').then // ...
1154
+ ```
1155
+
1156
+ #### Parameters
1157
+
1158
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
615
1159
 
1160
+ ### defineTimeout
616
1161
 
617
- ### seeAppIsInstalled
1162
+ Set [WebDriver timeouts][17] in realtime.
618
1163
 
619
- Check if an app is installed.
1164
+ Timeouts are expected to be passed as object:
620
1165
 
621
1166
  ```js
622
- I.seeAppIsInstalled("com.example.android.apis");
1167
+ I.defineTimeout({ script: 5000 });
1168
+ I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
623
1169
  ```
624
1170
 
625
1171
  #### Parameters
626
1172
 
627
- - `bundleId` String ID of bundled appAppium: support only Android
1173
+ - `timeouts` **WebdriverIO.Timeouts** WebDriver timeouts object.
628
1174
 
629
- ### seeAppIsNotInstalled
1175
+ ### amOnPage
630
1176
 
631
- Check if an app is not installed.
1177
+ Opens a web page in a browser. Requires relative or absolute url.
1178
+ If url starts with `/`, opens a web page of a site defined in `url` config parameter.
632
1179
 
633
1180
  ```js
634
- I.seeAppIsNotInstalled("com.example.android.apis");
1181
+ I.amOnPage('/'); // opens main page of website
1182
+ I.amOnPage('https://github.com'); // opens github
1183
+ I.amOnPage('/login'); // opens a login page
635
1184
  ```
636
1185
 
637
1186
  #### Parameters
638
1187
 
639
- - `bundleId` String ID of bundled appAppium: support only Android
1188
+ - `url` **[string][4]** url path or global url.
640
1189
 
641
- ### seeCheckboxIsChecked
1190
+ ### doubleClick
642
1191
 
643
- Verifies that the specified checkbox is checked.
1192
+ Performs a double-click on an element matched by link|button|label|CSS or XPath.
1193
+ Context can be specified as second parameter to narrow search.
644
1194
 
645
1195
  ```js
646
- I.seeCheckboxIsChecked('Agree');
647
- I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
648
- I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1196
+ I.doubleClick('Edit');
1197
+ I.doubleClick('Edit', '.actions');
1198
+ I.doubleClick({css: 'button.accept'});
1199
+ I.doubleClick('.btn.edit');
649
1200
  ```
650
1201
 
651
1202
  #### Parameters
652
1203
 
653
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator.
654
-
655
-
1204
+ - `locator` **([string][4] \| [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1205
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.{{ react }} (optional, default `null`)
656
1206
 
657
- ### seeCurrentActivityIs
1207
+ ### rightClick
658
1208
 
659
- Check current activity on an Android device.
1209
+ Performs right click on a clickable element matched by semantic locator, CSS or XPath.
660
1210
 
661
1211
  ```js
662
- I.seeCurrentActivityIs(".HomeScreenActivity")
1212
+ // right click element with id el
1213
+ I.rightClick('#el');
1214
+ // right click link or button with text "Click me"
1215
+ I.rightClick('Click me');
1216
+ // right click button with text "Click me" inside .context
1217
+ I.rightClick('Click me', '.context');
663
1218
  ```
664
1219
 
665
- Appium: support only Android
666
-
667
1220
  #### Parameters
668
1221
 
669
- - `currentActivity`
1222
+ - `locator` **([string][4] \| [object][6])** clickable element located by CSS|XPath|strict locator.
1223
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.{{ react }} (optional, default `null`)
670
1224
 
671
- ### seeDeviceIsLocked
1225
+ ### clearField
672
1226
 
673
- Check whether the device is locked.
1227
+ Clears a `<textarea>` or text `<input>` element's value.
674
1228
 
675
1229
  ```js
676
- I.seeDeviceIsLocked();
1230
+ I.clearField('Email');
1231
+ I.clearField('user[email]');
1232
+ I.clearField('#email');
677
1233
  ```
678
1234
 
679
- Appium: support only Android
1235
+ #### Parameters
680
1236
 
681
- ### seeDeviceIsUnlocked
1237
+ - `field`
1238
+ - `editable` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
682
1239
 
683
- Check whether the device is not locked.
1240
+ ### attachFile
1241
+
1242
+ Attaches a file to element located by label, name, CSS or XPath
1243
+ Path to file is relative current codecept directory (where codecept.json or codecept.conf.js is located).
1244
+ File will be uploaded to remote system (if tests are running remotely).
684
1245
 
685
1246
  ```js
686
- I.seeDeviceIsUnlocked();
1247
+ I.attachFile('Avatar', 'data/avatar.jpg');
1248
+ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
687
1249
  ```
688
1250
 
689
- Appium: support only Android
1251
+ #### Parameters
690
1252
 
691
- ### seeElement
1253
+ - `locator` **([string][4] \| [object][6])** field located by label|name|CSS|XPath|strict locator.
1254
+ - `pathToFile` **[string][4]** local file path relative to codecept.json config file.
1255
+ Appium: not tested
692
1256
 
693
- Checks that a given Element is visible
694
- Element is located by CSS or XPath.
1257
+ ### uncheckOption
1258
+
1259
+ Unselects a checkbox or radio button.
1260
+ Element is located by label or name or CSS or XPath.
1261
+
1262
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
695
1263
 
696
1264
  ```js
697
- I.seeElement('#modal');
1265
+ I.uncheckOption('#agree');
1266
+ I.uncheckOption('I Agree to Terms and Conditions');
1267
+ I.uncheckOption('agree', '//form');
698
1268
  ```
699
1269
 
700
1270
  #### Parameters
701
1271
 
702
- - `locator` ([string][4] \| [object][5]) located by CSS|XPath|strict locator.
703
-
1272
+ - `field` **([string][4] \| [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
1273
+ - `context` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
1274
+ Appium: not tested (optional, default `null`)
704
1275
 
1276
+ ### grabHTMLFrom
705
1277
 
706
- ### seeInField
707
-
708
- Checks that the given input field or textarea equals to given value.
709
- For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
1278
+ Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
1279
+ Resumes test execution, so **should be used inside async function with `await`** operator.
1280
+ If more than one element is found - an array of HTMLs returned.
710
1281
 
711
1282
  ```js
712
- I.seeInField('Username', 'davert');
713
- I.seeInField({css: 'form textarea'},'Type your comment here');
714
- I.seeInField('form input[type=hidden]','hidden_value');
715
- I.seeInField('#searchform input','Search');
1283
+ let postHTML = await I.grabHTMLFrom('#post');
716
1284
  ```
717
1285
 
718
1286
  #### Parameters
719
1287
 
720
- - `field` ([string][4] \| [object][5]) located by label|name|CSS|XPath|strict locator.
721
- - `value` [string][4] value to check.
722
-
1288
+ - `locator`
1289
+ - `element` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
723
1290
 
1291
+ Returns **[Promise][13]&lt;[string][4]>** HTML code for an element
724
1292
 
725
- ### seeOrientationIs
1293
+ ### grabAttributeFrom
726
1294
 
727
- Check the device orientation
1295
+ Retrieves an attribute from an element located by CSS or XPath and returns it to test.
1296
+ An array as a result will be returned if there are more than one matched element.
1297
+ Resumes test execution, so **should be used inside async with `await`** operator.
728
1298
 
729
1299
  ```js
730
- I.seeOrientationIs('PORTRAIT');
731
- I.seeOrientationIs('LANDSCAPE')
1300
+ let hint = await I.grabAttributeFrom('#tooltip', 'title');
732
1301
  ```
733
1302
 
734
1303
  #### Parameters
735
1304
 
736
- - `orientation` LANDSCAPE or PORTRAITAppium: support Android and iOS
1305
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1306
+ - `attr` **[string][4]** attribute name.
737
1307
 
738
- ### selectOption
1308
+ Returns **[Promise][13]&lt;[string][4]>** attribute value
1309
+ Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
739
1310
 
740
- Selects an option in a drop-down select.
741
- Field is searched by label | name | CSS | XPath.
742
- Option is selected by visible text or by value.
1311
+ ### seeTextEquals
1312
+
1313
+ Checks that text is equal to provided one.
743
1314
 
744
1315
  ```js
745
- I.selectOption('Choose Plan', 'Monthly'); // select by label
746
- I.selectOption('subscription', 'Monthly'); // match option by text
747
- I.selectOption('subscription', '0'); // or by value
748
- I.selectOption('//form/select[@name=account]','Premium');
749
- I.selectOption('form select[name=account]', 'Premium');
750
- I.selectOption({css: 'form select[name=account]'}, 'Premium');
1316
+ I.seeTextEquals('text', 'h1');
751
1317
  ```
752
1318
 
753
- Provide an array for the second argument to select multiple options.
1319
+ #### Parameters
1320
+
1321
+ - `text` **[string][4]** element value to check.
1322
+ - `context` **([string][4] \| [object][6]?)** element located by CSS|XPath|strict locator. (optional, default `null`)
1323
+
1324
+ ### seeElementInDOM
1325
+
1326
+ Checks that a given Element is present in the DOM
1327
+ Element is located by CSS or XPath.
754
1328
 
755
1329
  ```js
756
- I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1330
+ I.seeElementInDOM('#modal');
757
1331
  ```
758
1332
 
759
1333
  #### Parameters
760
1334
 
761
- - `select` ([string][4] \| [object][5]) field located by label|name|CSS|XPath|strict locator.
762
- - `option` ([string][4] \| [array][9]) visible text or value of option.
763
-
764
- - Supported on only for web testing!
1335
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
765
1336
 
766
- ### sendDeviceKeyEvent
1337
+ ### dontSeeElementInDOM
767
1338
 
768
- Send a key event to the device.
769
- List of keys: [https://developer.android.com/reference/android/view/KeyEvent.html][10]
1339
+ Opposite to `seeElementInDOM`. Checks that element is not on page.
770
1340
 
771
1341
  ```js
772
- I.sendDeviceKeyEvent(3);
1342
+ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
773
1343
  ```
774
1344
 
775
1345
  #### Parameters
776
1346
 
777
- - `keyValue` Device specific key valueAppium: support only Android
778
-
779
- ### setImmediateValue
1347
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|Strict locator.
780
1348
 
781
- Set immediate value in app.
1349
+ ### seeInSource
782
1350
 
783
- See corresponding [webdriverio reference][11].
1351
+ Checks that the current page contains the given string in its raw source code.
784
1352
 
785
- Appium: support only iOS
1353
+ ```js
1354
+ I.seeInSource('<h1>Green eggs &amp; ham</h1>');
1355
+ ```
786
1356
 
787
1357
  #### Parameters
788
1358
 
789
- - `id`
790
- - `value`
791
-
792
- ### setNetworkConnection
1359
+ - `text` **[string][4]** value to check.
793
1360
 
794
- Set network connection mode.
1361
+ ### grabSource
795
1362
 
796
- - airplane mode
797
- - wifi mode
798
- - data data
1363
+ Retrieves page source and returns it to test.
1364
+ Resumes test execution, so should be used inside an async function.
799
1365
 
800
1366
  ```js
801
- I.setNetworkConnection(0) // airplane mode off, wifi off, data off
802
- I.setNetworkConnection(1) // airplane mode on, wifi off, data off
803
- I.setNetworkConnection(2) // airplane mode off, wifi on, data off
804
- I.setNetworkConnection(4) // airplane mode off, wifi off, data on
805
- I.setNetworkConnection(6) // airplane mode off, wifi on, data on
1367
+ let pageSource = await I.grabSource();
806
1368
  ```
807
1369
 
808
- See corresponding [webdriverio reference][12].
1370
+ Returns **[Promise][13]&lt;[string][4]>** source code
809
1371
 
810
- Appium: support only Android
1372
+ ### grabBrowserLogs
811
1373
 
812
- #### Parameters
1374
+ Get JS log from browser. Log buffer is reset after each request.
813
1375
 
814
- - `value`
1376
+ ```js
1377
+ let logs = await I.grabBrowserLogs();
1378
+ console.log(JSON.stringify(logs))
1379
+ ```
815
1380
 
816
- ### setOrientation
1381
+ Returns **[Promise][13]&lt;([string][4] \| [undefined][18])>**
817
1382
 
818
- Set a device orientation. Will fail, if app will not set orientation
1383
+ ### dontSeeInSource
1384
+
1385
+ Checks that the current page does not contains the given string in its raw source code.
819
1386
 
820
1387
  ```js
821
- I.setOrientation('PORTRAIT');
822
- I.setOrientation('LANDSCAPE')
1388
+ I.dontSeeInSource('<!--'); // no comments in source
823
1389
  ```
824
1390
 
825
1391
  #### Parameters
826
1392
 
827
- - `orientation` LANDSCAPE or PORTRAITAppium: support Android and iOS
1393
+ - `text`
1394
+ - `value` **[string][4]** to check.
828
1395
 
829
- ### setSettings
1396
+ ### seeNumberOfElements
830
1397
 
831
- Update the current setting on the device
1398
+ Asserts that an element appears a given number of times in the DOM.
1399
+ Element is located by label or name or CSS or XPath.
832
1400
 
833
1401
  ```js
834
- I.setSettings({cyberdelia: 'open'});
1402
+ I.seeNumberOfElements('#submitBtn', 1);
835
1403
  ```
836
1404
 
837
1405
  #### Parameters
838
1406
 
839
- - `settings` objectAppium: support Android and iOS
1407
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1408
+ - `num` **[number][8]** number of elements.{{ react }}
840
1409
 
841
- ### shakeDevice
1410
+ ### seeNumberOfVisibleElements
842
1411
 
843
- Perform a shake action on the device.
1412
+ Asserts that an element is visible a given number of times.
1413
+ Element is located by CSS or XPath.
844
1414
 
845
1415
  ```js
846
- I.shakeDevice();
1416
+ I.seeNumberOfVisibleElements('.buttons', 3);
847
1417
  ```
848
1418
 
849
- Appium: support only iOS
1419
+ #### Parameters
850
1420
 
851
- ### simulateTouchId
1421
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1422
+ - `num` **[number][8]** number of elements.{{ react }}
852
1423
 
853
- Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
1424
+ ### seeAttributesOnElements
1425
+
1426
+ Checks that all elements with given locator have given attributes.
854
1427
 
855
1428
  ```js
856
- I.touchId(); // simulates valid fingerprint
857
- I.touchId(true); // simulates valid fingerprint
858
- I.touchId(false); // simulates invalid fingerprint
1429
+ I.seeAttributesOnElements('//form', { method: "post"});
859
1430
  ```
860
1431
 
861
- Appium: support only iOS
862
- TODO: not tested
863
-
864
1432
  #### Parameters
865
1433
 
866
- - `match`
1434
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
1435
+ - `attributes` **[object][6]** attributes and their values to check.
867
1436
 
868
- ### startActivity
1437
+ ### grabNumberOfVisibleElements
869
1438
 
870
- Start an arbitrary Android activity during a session.
1439
+ Grab number of visible elements by locator.
871
1440
 
872
1441
  ```js
873
- I.startActivity('io.selendroid.testapp', '.RegisterUserActivity');
1442
+ let numOfElements = await I.grabNumberOfVisibleElements('p');
874
1443
  ```
875
1444
 
876
- Appium: support only Android
877
-
878
1445
  #### Parameters
879
1446
 
880
- - `appPackage`
881
- - `appActivity`
1447
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
882
1448
 
883
- ### swipe
1449
+ Returns **[Promise][13]&lt;[number][8]>** number of visible elements
884
1450
 
885
- Perform a swipe on the screen or an element.
1451
+ ### scrollTo
1452
+
1453
+ Scrolls to element matched by locator.
1454
+ Extra shift can be set with offsetX and offsetY options.
886
1455
 
887
1456
  ```js
888
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
889
- I.swipe(locator, 800, 1200, 1000);
1457
+ I.scrollTo('footer');
1458
+ I.scrollTo('#submit', 5, 5);
890
1459
  ```
891
1460
 
892
- [See complete reference][13]
893
-
894
1461
  #### Parameters
895
1462
 
896
- - `locator`
897
- - `xoffset`
898
- - `yoffset`
899
- - `speed` (optional), 1000 by defaultAppium: support Android and iOS
1463
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
1464
+ - `offsetX` **[number][8]** (optional, `0` by default) X-axis offset. (optional, default `0`)
1465
+ - `offsetY` **[number][8]** (optional, `0` by default) Y-axis offset. (optional, default `0`)
900
1466
 
901
- ### swipeDown
1467
+ ### moveCursorTo
902
1468
 
903
- Perform a swipe down on an element.
1469
+ Moves cursor to element matched by locator.
1470
+ Extra shift can be set with offsetX and offsetY options.
904
1471
 
905
1472
  ```js
906
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
907
- I.swipeDown(locator); // simple swipe
908
- I.swipeDown(locator, 500); // set speed
909
- I.swipeDown(locator, 1200, 1000); // set offset and speed
1473
+ I.moveCursorTo('.tooltip');
1474
+ I.moveCursorTo('#submit', 5,5);
910
1475
  ```
911
1476
 
912
1477
  #### Parameters
913
1478
 
914
- - `locator`
915
- - `yoffset` (optional)
916
- - `speed` (optional), 1000 by defaultAppium: support Android and iOS
1479
+ - `locator` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
1480
+ - `offsetX` **[number][8]** (optional, `0` by default) X-axis offset. (optional, default `0`)
1481
+ - `offsetY` **[number][8]** (optional, `0` by default) Y-axis offset. (optional, default `0`)
917
1482
 
918
- ### swipeLeft
1483
+ ### saveScreenshot
919
1484
 
920
- Perform a swipe left on an element.
1485
+ Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
1486
+ Filename is relative to output folder.
1487
+ 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.
921
1488
 
922
1489
  ```js
923
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
924
- I.swipeLeft(locator); // simple swipe
925
- I.swipeLeft(locator, 500); // set speed
926
- I.swipeLeft(locator, 1200, 1000); // set offset and speed
1490
+ I.saveScreenshot('debug.png');
1491
+ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
927
1492
  ```
928
1493
 
929
1494
  #### Parameters
930
1495
 
931
- - `locator`
932
- - `xoffset` (optional)
933
- - `speed` (optional), 1000 by defaultAppium: support Android and iOS
1496
+ - `fileName` **[string][4]** file name to save.
1497
+ - `fullPage` **[boolean][15]** (optional, `false` by default) flag to enable fullscreen screenshot mode. (optional, default `false`)
934
1498
 
935
- ### swipeRight
1499
+ ### dragAndDrop
936
1500
 
937
- Perform a swipe right on an element.
1501
+ Drag an item to a destination element.
938
1502
 
939
1503
  ```js
940
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
941
- I.swipeRight(locator); // simple swipe
942
- I.swipeRight(locator, 500); // set speed
943
- I.swipeRight(locator, 1200, 1000); // set offset and speed
1504
+ I.dragAndDrop('#dragHandle', '#container');
944
1505
  ```
945
1506
 
946
1507
  #### Parameters
947
1508
 
948
- - `locator`
949
- - `xoffset` (optional)
950
- - `speed` (optional), 1000 by defaultAppium: support Android and iOS
1509
+ - `srcElement` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
1510
+ - `destElement` **([string][4] \| [object][6])** located by CSS|XPath|strict locator.
1511
+ Appium: not tested
951
1512
 
952
- ### swipeTo
1513
+ ### dragSlider
953
1514
 
954
- Perform a swipe in selected direction on an element to searchable element.
1515
+ Drag the scrubber of a slider to a given position
1516
+ For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
955
1517
 
956
1518
  ```js
957
- I.swipeTo(
958
- "android.widget.CheckBox", // searchable element
959
- "//android.widget.ScrollView/android.widget.LinearLayout", // scroll element
960
- "up", // direction
961
- 30,
962
- 100,
963
- 500);
1519
+ I.dragSlider('#slider', 30);
1520
+ I.dragSlider('#slider', -70);
964
1521
  ```
965
1522
 
966
1523
  #### Parameters
967
1524
 
968
- - `searchableLocator`
969
- - `scrollLocator`
970
- - `direction`
971
- - `timeout`
972
- - `offset`
973
- - `speed` Appium: support Android and iOS
1525
+ - `locator` **([string][4] \| [object][6])** located by label|name|CSS|XPath|strict locator.
1526
+ - `offsetX` **[number][8]** position to drag. (optional, default `0`)
974
1527
 
975
- ### swipeUp
1528
+ ### grabAllWindowHandles
976
1529
 
977
- Perform a swipe up on an element.
1530
+ Get all Window Handles.
1531
+ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
978
1532
 
979
1533
  ```js
980
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
981
- I.swipeUp(locator); // simple swipe
982
- I.swipeUp(locator, 500); // set speed
983
- I.swipeUp(locator, 1200, 1000); // set offset and speed
1534
+ const windows = await I.grabAllWindowHandles();
984
1535
  ```
985
1536
 
986
- #### Parameters
1537
+ ### grabCurrentWindowHandle
987
1538
 
988
- - `locator`
989
- - `yoffset` (optional)
990
- - `speed` (optional), 1000 by defaultAppium: support Android and iOS
1539
+ Get the current Window Handle.
1540
+ Useful for referencing it when calling `I.switchToWindow(handle)`
991
1541
 
992
- ### switchToNative
1542
+ ```js
1543
+ const window = await I.grabCurrentWindowHandle();
1544
+ ```
993
1545
 
994
- Switches to native context.
995
- By default switches to NATIVE_APP context unless other specified.
1546
+ ### switchToWindow
1547
+
1548
+ Switch to the window with a specified handle.
996
1549
 
997
1550
  ```js
998
- I.switchToNative();
1551
+ const windows = await I.grabAllWindowHandles();
1552
+ // ... do something
1553
+ await I.switchToWindow( windows[0] );
999
1554
 
1000
- // or set context explicitly
1001
- I.switchToNative('SOME_OTHER_CONTEXT');
1555
+ const window = await I.grabCurrentWindowHandle();
1556
+ // ... do something
1557
+ await I.switchToWindow( window );
1002
1558
  ```
1003
1559
 
1004
1560
  #### Parameters
1005
1561
 
1006
- - `context` any
1562
+ - `window`
1007
1563
 
1008
- ### switchToWeb
1564
+ ### closeOtherTabs
1009
1565
 
1010
- Switches to web context.
1011
- If no context is provided switches to the first detected web context
1566
+ Close all tabs except for the current one.
1012
1567
 
1013
1568
  ```js
1014
- // switch to first web context
1015
- I.switchToWeb();
1569
+ I.closeOtherTabs();
1570
+ ```
1016
1571
 
1017
- // or set the context explicitly
1018
- I.switchToWeb('WEBVIEW_io.selendroid.testapp');
1572
+ ### switchTo
1573
+
1574
+ Switches frame or in case of null locator reverts to parent.
1575
+
1576
+ ```js
1577
+ I.switchTo('iframe'); // switch to first iframe
1578
+ I.switchTo(); // switch back to main page
1019
1579
  ```
1020
1580
 
1021
1581
  #### Parameters
1022
1582
 
1023
- - `context` [string][4]?
1583
+ - `locator` **([string][4]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator. (optional, default `null`)
1024
1584
 
1025
- ### tap
1585
+ ### grabNumberOfOpenTabs
1026
1586
 
1027
- Taps on element.
1587
+ Grab number of open tabs.
1028
1588
 
1029
1589
  ```js
1030
- I.tap("~buttonStartWebviewCD");
1590
+ let tabs = await I.grabNumberOfOpenTabs();
1031
1591
  ```
1032
1592
 
1033
- Shortcut for `makeTouchAction`
1034
-
1035
- #### Parameters
1036
-
1037
- - `locator` any
1593
+ Returns **[Promise][13]&lt;[number][8]>** number of open tabs
1038
1594
 
1039
- ### touchPerform
1595
+ ### scrollPageToTop
1040
1596
 
1041
- Performs a specific touch action.
1042
- The action object need to contain the action name, x/y coordinates
1597
+ Scroll page to the top.
1043
1598
 
1044
1599
  ```js
1045
- I.touchPerform([{
1046
- action: 'press',
1047
- options: {
1048
- x: 100,
1049
- y: 200
1050
- }
1051
- }, {action: 'release'}])
1052
-
1053
- I.touchPerform([{
1054
- action: 'tap',
1055
- options: {
1056
- element: '1', // json web element was queried before
1057
- x: 10, // x offset
1058
- y: 20, // y offset
1059
- count: 1 // number of touches
1060
- }
1061
- }]);
1600
+ I.scrollPageToTop();
1062
1601
  ```
1063
1602
 
1064
- Appium: support Android and iOS
1603
+ ### scrollPageToBottom
1065
1604
 
1066
- #### Parameters
1605
+ Scroll page to the bottom.
1067
1606
 
1068
- - `actions`
1607
+ ```js
1608
+ I.scrollPageToBottom();
1609
+ ```
1069
1610
 
1070
- ### waitForElement
1611
+ ### grabPageScrollPosition
1071
1612
 
1072
- Waits for element to be present on page (by default waits for 1sec).
1073
- Element can be located by CSS or XPath.
1613
+ Retrieves a page scroll position and returns it to test.
1614
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
1074
1615
 
1075
1616
  ```js
1076
- I.waitForElement('.btn.continue');
1077
- I.waitForElement('.btn.continue', 5); // wait for 5 secs
1617
+ let { x, y } = await I.grabPageScrollPosition();
1078
1618
  ```
1079
1619
 
1080
- #### Parameters
1081
-
1082
- - `locator` ([string][4] \| [object][5]) element located by CSS|XPath|strict locator.
1083
- - `sec` [number][14] (optional, `1` by default) time in seconds to wait
1084
-
1085
-
1620
+ Returns **[Promise][13]&lt;[Object][6]&lt;[string][4], any>>** scroll position
1086
1621
 
1087
- ### waitForInvisible
1622
+ ### setGeoLocation
1088
1623
 
1089
- Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
1090
- Element can be located by CSS or XPath.
1624
+ Set the current geo location
1091
1625
 
1092
1626
  ```js
1093
- I.waitForInvisible('#popup');
1627
+ I.setGeoLocation(121.21, 11.56);
1628
+ I.setGeoLocation(121.21, 11.56, 10);
1094
1629
  ```
1095
1630
 
1096
1631
  #### Parameters
1097
1632
 
1098
- - `locator` ([string][4] \| [object][5]) element located by CSS|XPath|strict locator.
1099
- - `sec` [number][14] (optional, `1` by default) time in seconds to wait
1100
-
1101
-
1633
+ - `latitude` **[number][8]** to set.
1634
+ - `longitude` **[number][8]** to set
1635
+ - `altitude` **[number][8]** (optional, null by default) to set (optional, default `null`)
1102
1636
 
1103
- ### waitForText
1637
+ ### grabGeoLocation
1104
1638
 
1105
- Waits for a text to appear (by default waits for 1sec).
1106
- Element can be located by CSS or XPath.
1107
- Narrow down search results by providing context.
1639
+ Return the current geo location
1108
1640
 
1109
1641
  ```js
1110
- I.waitForText('Thank you, form has been submitted');
1111
- I.waitForText('Thank you, form has been submitted', 5, '#modal');
1642
+ let geoLocation = await I.grabGeoLocation();
1112
1643
  ```
1113
1644
 
1114
- #### Parameters
1645
+ ### grabElementBoundingRect
1115
1646
 
1116
- - `text` [string][4] to wait for.
1117
- - `sec` [number][14] (optional, `1` by default) time in seconds to wait
1118
- - `context` ([string][4] \| [object][5]) (optional) element located by CSS|XPath|strict locator.
1119
-
1120
-
1647
+ Grab the width, height, location of given locator.
1648
+ Provide `width` or `height`as second param to get your desired prop.
1649
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
1121
1650
 
1122
- ### waitForVisible
1651
+ Returns an object with `x`, `y`, `width`, `height` keys.
1123
1652
 
1124
- Waits for an element to become visible on a page (by default waits for 1sec).
1125
- Element can be located by CSS or XPath.
1653
+ ```js
1654
+ const value = await I.grabElementBoundingRect('h3');
1655
+ // value is like { x: 226.5, y: 89, width: 527, height: 220 }
1656
+ ```
1657
+
1658
+ To get only one metric use second parameter:
1126
1659
 
1127
1660
  ```js
1128
- I.waitForVisible('#popup');
1661
+ const width = await I.grabElementBoundingRect('h3', 'width');
1662
+ // width == 527
1129
1663
  ```
1130
1664
 
1131
1665
  #### Parameters
1132
1666
 
1133
- - `locator` ([string][4] \| [object][5]) element located by CSS|XPath|strict locator.
1134
- - `sec` [number][14] (optional, `1` by default) time in seconds to wait
1135
-
1136
-
1667
+ - `locator` **([string][4] \| [object][6])** element located by CSS|XPath|strict locator.
1668
+ - `prop`
1669
+ - `elementSize` **[string][4]** x, y, width or height of the given element.
1670
+
1671
+ Returns **[object][6]** Element bounding rectangle
1137
1672
 
1138
1673
  [1]: http://codecept.io/helpers/WebDriver/
1139
1674
 
@@ -1143,22 +1678,30 @@ I.waitForVisible('#popup');
1143
1678
 
1144
1679
  [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1145
1680
 
1146
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
1681
+ [5]: http://webdriver.io/api/mobile/setNetworkConnection.html
1682
+
1683
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
1684
+
1685
+ [7]: https://developer.android.com/reference/android/view/KeyEvent.html
1686
+
1687
+ [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1688
+
1689
+ [9]: http://webdriver.io/api/mobile/touchAction.html
1147
1690
 
1148
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1691
+ [10]: http://webdriver.io/api/mobile/swipe.html
1149
1692
 
1150
- [7]: http://webdriver.io/api/mobile/touchAction.html
1693
+ [11]: http://webdriver.io/api/mobile/rotate.html
1151
1694
 
1152
- [8]: http://webdriver.io/api/mobile/rotate.html
1695
+ [12]: http://webdriver.io/api/mobile/setImmediateValue.html
1153
1696
 
1154
- [9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1697
+ [13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1155
1698
 
1156
- [10]: https://developer.android.com/reference/android/view/KeyEvent.html
1699
+ [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1157
1700
 
1158
- [11]: http://webdriver.io/api/mobile/setImmediateValue.html
1701
+ [15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
1159
1702
 
1160
- [12]: http://webdriver.io/api/mobile/setNetworkConnection.html
1703
+ [16]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
1161
1704
 
1162
- [13]: http://webdriver.io/api/mobile/swipe.html
1705
+ [17]: https://webdriver.io/docs/timeouts.html
1163
1706
 
1164
- [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1707
+ [18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined