codeceptjs 3.4.1 → 3.5.1-2.beta.7

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 (281) hide show
  1. package/README.md +31 -30
  2. package/bin/codecept.js +1 -1
  3. package/lib/actor.js +6 -3
  4. package/lib/ai.js +180 -0
  5. package/lib/cli.js +13 -3
  6. package/lib/codecept.js +8 -0
  7. package/lib/colorUtils.js +10 -0
  8. package/lib/command/definitions.js +2 -7
  9. package/lib/command/dryRun.js +11 -2
  10. package/lib/command/generate.js +46 -3
  11. package/lib/command/info.js +24 -0
  12. package/lib/command/init.js +64 -6
  13. package/lib/command/interactive.js +15 -1
  14. package/lib/command/run-multiple/collection.js +17 -5
  15. package/lib/command/run-multiple.js +4 -2
  16. package/lib/command/run-workers.js +68 -5
  17. package/lib/command/run.js +7 -0
  18. package/lib/command/workers/runTests.js +39 -0
  19. package/lib/container.js +13 -3
  20. package/lib/data/context.js +14 -6
  21. package/lib/event.js +4 -0
  22. package/lib/helper/ApiDataFactory.js +2 -1
  23. package/lib/helper/Appium.js +116 -29
  24. package/lib/helper/Expect.js +422 -0
  25. package/lib/helper/FileSystem.js +1 -1
  26. package/lib/helper/GraphQL.js +25 -0
  27. package/lib/helper/JSONResponse.js +4 -4
  28. package/lib/helper/Nightmare.js +10 -5
  29. package/lib/helper/OpenAI.js +126 -0
  30. package/lib/helper/Playwright.js +1298 -229
  31. package/lib/helper/Protractor.js +12 -7
  32. package/lib/helper/Puppeteer.js +204 -64
  33. package/lib/helper/REST.js +15 -5
  34. package/lib/helper/TestCafe.js +45 -10
  35. package/lib/helper/WebDriver.js +252 -83
  36. package/lib/helper/errors/ElementNotFound.js +2 -1
  37. package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
  38. package/lib/helper/scripts/blurElement.js +17 -0
  39. package/lib/helper/scripts/focusElement.js +17 -0
  40. package/lib/helper/scripts/highlightElement.js +20 -0
  41. package/lib/html.js +258 -0
  42. package/lib/interfaces/bdd.js +1 -1
  43. package/lib/interfaces/gherkin.js +37 -3
  44. package/lib/interfaces/scenarioConfig.js +1 -0
  45. package/lib/listener/retry.js +2 -1
  46. package/lib/locator.js +17 -4
  47. package/lib/mochaFactory.js +2 -1
  48. package/lib/output.js +1 -1
  49. package/lib/pause.js +78 -19
  50. package/lib/plugin/autoLogin.js +45 -10
  51. package/lib/plugin/debugErrors.js +67 -0
  52. package/lib/plugin/fakerTransform.js +4 -6
  53. package/lib/plugin/heal.js +209 -0
  54. package/lib/plugin/retryFailedStep.js +10 -1
  55. package/lib/plugin/retryTo.js +2 -4
  56. package/lib/plugin/screenshotOnFail.js +11 -2
  57. package/lib/plugin/selenoid.js +6 -1
  58. package/lib/plugin/standardActingHelpers.js +0 -2
  59. package/lib/plugin/stepByStepReport.js +2 -2
  60. package/lib/plugin/tryTo.js +5 -7
  61. package/lib/plugin/wdio.js +0 -1
  62. package/lib/recorder.js +22 -11
  63. package/lib/secret.js +5 -4
  64. package/lib/session.js +1 -1
  65. package/lib/step.js +36 -12
  66. package/lib/ui.js +5 -3
  67. package/lib/utils.js +22 -1
  68. package/lib/workers.js +83 -10
  69. package/package.json +117 -95
  70. package/translations/de-DE.js +5 -0
  71. package/translations/fr-FR.js +14 -1
  72. package/translations/it-IT.js +1 -0
  73. package/translations/ja-JP.js +14 -9
  74. package/translations/pl-PL.js +5 -0
  75. package/translations/pt-BR.js +1 -0
  76. package/translations/ru-RU.js +1 -0
  77. package/translations/zh-CN.js +5 -0
  78. package/translations/zh-TW.js +5 -0
  79. package/typings/index.d.ts +51 -15
  80. package/typings/promiseBasedTypes.d.ts +864 -802
  81. package/typings/types.d.ts +1339 -744
  82. package/CHANGELOG.md +0 -2427
  83. package/docs/advanced.md +0 -351
  84. package/docs/api.md +0 -323
  85. package/docs/basics.md +0 -980
  86. package/docs/bdd.md +0 -535
  87. package/docs/best.md +0 -237
  88. package/docs/books.md +0 -37
  89. package/docs/bootstrap.md +0 -135
  90. package/docs/build/ApiDataFactory.js +0 -409
  91. package/docs/build/Appium.js +0 -1938
  92. package/docs/build/FileSystem.js +0 -228
  93. package/docs/build/GraphQL.js +0 -204
  94. package/docs/build/GraphQLDataFactory.js +0 -309
  95. package/docs/build/JSONResponse.js +0 -338
  96. package/docs/build/Mochawesome.js +0 -71
  97. package/docs/build/Nightmare.js +0 -2145
  98. package/docs/build/Playwright.js +0 -3986
  99. package/docs/build/Polly.js +0 -42
  100. package/docs/build/Protractor.js +0 -2699
  101. package/docs/build/Puppeteer.js +0 -3710
  102. package/docs/build/REST.js +0 -334
  103. package/docs/build/SeleniumWebdriver.js +0 -76
  104. package/docs/build/TestCafe.js +0 -2057
  105. package/docs/build/WebDriver.js +0 -4017
  106. package/docs/changelog.md +0 -2436
  107. package/docs/commands.md +0 -254
  108. package/docs/community-helpers.md +0 -58
  109. package/docs/configuration.md +0 -157
  110. package/docs/continuous-integration.md +0 -22
  111. package/docs/custom-helpers.md +0 -306
  112. package/docs/data.md +0 -375
  113. package/docs/detox.md +0 -235
  114. package/docs/docker.md +0 -137
  115. package/docs/email.md +0 -183
  116. package/docs/examples.md +0 -149
  117. package/docs/helpers/ApiDataFactory.md +0 -266
  118. package/docs/helpers/Appium.md +0 -1312
  119. package/docs/helpers/Detox.md +0 -586
  120. package/docs/helpers/FileSystem.md +0 -152
  121. package/docs/helpers/GraphQL.md +0 -130
  122. package/docs/helpers/GraphQLDataFactory.md +0 -226
  123. package/docs/helpers/JSONResponse.md +0 -254
  124. package/docs/helpers/Mochawesome.md +0 -8
  125. package/docs/helpers/MockRequest.md +0 -377
  126. package/docs/helpers/Nightmare.md +0 -1256
  127. package/docs/helpers/Playwright.md +0 -2208
  128. package/docs/helpers/Polly.md +0 -44
  129. package/docs/helpers/Puppeteer-firefox.md +0 -86
  130. package/docs/helpers/Puppeteer.md +0 -2141
  131. package/docs/helpers/REST.md +0 -217
  132. package/docs/helpers/TestCafe.md +0 -1222
  133. package/docs/helpers/WebDriver.md +0 -2319
  134. package/docs/hooks.md +0 -340
  135. package/docs/index.md +0 -111
  136. package/docs/installation.md +0 -75
  137. package/docs/internal-api.md +0 -265
  138. package/docs/locators.md +0 -331
  139. package/docs/mobile-react-native-locators.md +0 -67
  140. package/docs/mobile.md +0 -297
  141. package/docs/nightmare.md +0 -223
  142. package/docs/pageobjects.md +0 -291
  143. package/docs/parallel.md +0 -232
  144. package/docs/playwright.md +0 -609
  145. package/docs/plugins.md +0 -1171
  146. package/docs/puppeteer.md +0 -316
  147. package/docs/quickstart.md +0 -163
  148. package/docs/react.md +0 -69
  149. package/docs/reports.md +0 -392
  150. package/docs/secrets.md +0 -30
  151. package/docs/shadow.md +0 -68
  152. package/docs/shared/keys.mustache +0 -31
  153. package/docs/shared/react.mustache +0 -1
  154. package/docs/testcafe.md +0 -174
  155. package/docs/translation.md +0 -247
  156. package/docs/tutorial.md +0 -271
  157. package/docs/typescript.md +0 -180
  158. package/docs/ui.md +0 -59
  159. package/docs/videos.md +0 -28
  160. package/docs/visual.md +0 -202
  161. package/docs/vue.md +0 -121
  162. package/docs/webapi/amOnPage.mustache +0 -11
  163. package/docs/webapi/appendField.mustache +0 -9
  164. package/docs/webapi/attachFile.mustache +0 -12
  165. package/docs/webapi/checkOption.mustache +0 -13
  166. package/docs/webapi/clearCookie.mustache +0 -10
  167. package/docs/webapi/clearField.mustache +0 -9
  168. package/docs/webapi/click.mustache +0 -25
  169. package/docs/webapi/clickLink.mustache +0 -8
  170. package/docs/webapi/closeCurrentTab.mustache +0 -7
  171. package/docs/webapi/closeOtherTabs.mustache +0 -8
  172. package/docs/webapi/dontSee.mustache +0 -11
  173. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +0 -10
  174. package/docs/webapi/dontSeeCookie.mustache +0 -8
  175. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +0 -10
  176. package/docs/webapi/dontSeeElement.mustache +0 -8
  177. package/docs/webapi/dontSeeElementInDOM.mustache +0 -8
  178. package/docs/webapi/dontSeeInCurrentUrl.mustache +0 -4
  179. package/docs/webapi/dontSeeInField.mustache +0 -11
  180. package/docs/webapi/dontSeeInSource.mustache +0 -8
  181. package/docs/webapi/dontSeeInTitle.mustache +0 -8
  182. package/docs/webapi/doubleClick.mustache +0 -13
  183. package/docs/webapi/downloadFile.mustache +0 -12
  184. package/docs/webapi/dragAndDrop.mustache +0 -9
  185. package/docs/webapi/dragSlider.mustache +0 -11
  186. package/docs/webapi/executeAsyncScript.mustache +0 -24
  187. package/docs/webapi/executeScript.mustache +0 -26
  188. package/docs/webapi/fillField.mustache +0 -16
  189. package/docs/webapi/forceClick.mustache +0 -28
  190. package/docs/webapi/forceRightClick.mustache +0 -18
  191. package/docs/webapi/grabAllWindowHandles.mustache +0 -7
  192. package/docs/webapi/grabAttributeFrom.mustache +0 -10
  193. package/docs/webapi/grabAttributeFromAll.mustache +0 -9
  194. package/docs/webapi/grabBrowserLogs.mustache +0 -9
  195. package/docs/webapi/grabCookie.mustache +0 -11
  196. package/docs/webapi/grabCssPropertyFrom.mustache +0 -11
  197. package/docs/webapi/grabCssPropertyFromAll.mustache +0 -10
  198. package/docs/webapi/grabCurrentUrl.mustache +0 -9
  199. package/docs/webapi/grabCurrentWindowHandle.mustache +0 -6
  200. package/docs/webapi/grabDataFromPerformanceTiming.mustache +0 -20
  201. package/docs/webapi/grabElementBoundingRect.mustache +0 -20
  202. package/docs/webapi/grabGeoLocation.mustache +0 -8
  203. package/docs/webapi/grabHTMLFrom.mustache +0 -10
  204. package/docs/webapi/grabHTMLFromAll.mustache +0 -9
  205. package/docs/webapi/grabNumberOfOpenTabs.mustache +0 -8
  206. package/docs/webapi/grabNumberOfVisibleElements.mustache +0 -9
  207. package/docs/webapi/grabPageScrollPosition.mustache +0 -8
  208. package/docs/webapi/grabPopupText.mustache +0 -5
  209. package/docs/webapi/grabSource.mustache +0 -8
  210. package/docs/webapi/grabTextFrom.mustache +0 -10
  211. package/docs/webapi/grabTextFromAll.mustache +0 -9
  212. package/docs/webapi/grabTitle.mustache +0 -8
  213. package/docs/webapi/grabValueFrom.mustache +0 -9
  214. package/docs/webapi/grabValueFromAll.mustache +0 -8
  215. package/docs/webapi/moveCursorTo.mustache +0 -12
  216. package/docs/webapi/openNewTab.mustache +0 -7
  217. package/docs/webapi/pressKey.mustache +0 -12
  218. package/docs/webapi/pressKeyDown.mustache +0 -12
  219. package/docs/webapi/pressKeyUp.mustache +0 -12
  220. package/docs/webapi/pressKeyWithKeyNormalization.mustache +0 -60
  221. package/docs/webapi/refreshPage.mustache +0 -6
  222. package/docs/webapi/resizeWindow.mustache +0 -6
  223. package/docs/webapi/rightClick.mustache +0 -14
  224. package/docs/webapi/saveElementScreenshot.mustache +0 -10
  225. package/docs/webapi/saveScreenshot.mustache +0 -12
  226. package/docs/webapi/say.mustache +0 -10
  227. package/docs/webapi/scrollIntoView.mustache +0 -11
  228. package/docs/webapi/scrollPageToBottom.mustache +0 -6
  229. package/docs/webapi/scrollPageToTop.mustache +0 -6
  230. package/docs/webapi/scrollTo.mustache +0 -12
  231. package/docs/webapi/see.mustache +0 -11
  232. package/docs/webapi/seeAttributesOnElements.mustache +0 -9
  233. package/docs/webapi/seeCheckboxIsChecked.mustache +0 -10
  234. package/docs/webapi/seeCookie.mustache +0 -8
  235. package/docs/webapi/seeCssPropertiesOnElements.mustache +0 -9
  236. package/docs/webapi/seeCurrentUrlEquals.mustache +0 -11
  237. package/docs/webapi/seeElement.mustache +0 -8
  238. package/docs/webapi/seeElementInDOM.mustache +0 -8
  239. package/docs/webapi/seeInCurrentUrl.mustache +0 -8
  240. package/docs/webapi/seeInField.mustache +0 -12
  241. package/docs/webapi/seeInPopup.mustache +0 -8
  242. package/docs/webapi/seeInSource.mustache +0 -7
  243. package/docs/webapi/seeInTitle.mustache +0 -8
  244. package/docs/webapi/seeNumberOfElements.mustache +0 -11
  245. package/docs/webapi/seeNumberOfVisibleElements.mustache +0 -10
  246. package/docs/webapi/seeTextEquals.mustache +0 -9
  247. package/docs/webapi/seeTitleEquals.mustache +0 -8
  248. package/docs/webapi/selectOption.mustache +0 -21
  249. package/docs/webapi/setCookie.mustache +0 -16
  250. package/docs/webapi/setGeoLocation.mustache +0 -12
  251. package/docs/webapi/switchTo.mustache +0 -9
  252. package/docs/webapi/switchToNextTab.mustache +0 -10
  253. package/docs/webapi/switchToPreviousTab.mustache +0 -10
  254. package/docs/webapi/type.mustache +0 -18
  255. package/docs/webapi/uncheckOption.mustache +0 -13
  256. package/docs/webapi/wait.mustache +0 -8
  257. package/docs/webapi/waitForClickable.mustache +0 -11
  258. package/docs/webapi/waitForDetached.mustache +0 -10
  259. package/docs/webapi/waitForElement.mustache +0 -11
  260. package/docs/webapi/waitForEnabled.mustache +0 -6
  261. package/docs/webapi/waitForFunction.mustache +0 -17
  262. package/docs/webapi/waitForInvisible.mustache +0 -10
  263. package/docs/webapi/waitForText.mustache +0 -13
  264. package/docs/webapi/waitForValue.mustache +0 -10
  265. package/docs/webapi/waitForVisible.mustache +0 -10
  266. package/docs/webapi/waitInUrl.mustache +0 -9
  267. package/docs/webapi/waitNumberOfVisibleElements.mustache +0 -10
  268. package/docs/webapi/waitToHide.mustache +0 -10
  269. package/docs/webapi/waitUrlEquals.mustache +0 -10
  270. package/docs/webdriver.md +0 -657
  271. package/docs/wiki/Books-&-Posts.md +0 -27
  272. package/docs/wiki/Community-Helpers-&-Plugins.md +0 -49
  273. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -29
  274. package/docs/wiki/Examples.md +0 -139
  275. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
  276. package/docs/wiki/Home.md +0 -16
  277. package/docs/wiki/Release-Process.md +0 -24
  278. package/docs/wiki/Roadmap.md +0 -23
  279. package/docs/wiki/Tests.md +0 -1393
  280. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
  281. package/docs/wiki/Videos.md +0 -19
@@ -1,1312 +0,0 @@
1
- <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2
-
3
- ## Appium
4
-
5
- **Extends Webdriver**
6
-
7
- Appium helper extends [Webriver][1] helper.
8
- It supports all browser methods and also includes special methods for mobile apps testing.
9
- You can use this helper to test Web on desktop and mobile devices and mobile apps.
10
-
11
- ## Appium Installation
12
-
13
- Appium is an open source test automation framework for use with native, hybrid and mobile web apps that implements the WebDriver protocol.
14
- It allows you to run Selenium tests on mobile devices and also test native, hybrid and mobile web apps.
15
-
16
- Download and install [Appium][2]
17
-
18
- ```sh
19
- npm install -g appium
20
- ```
21
-
22
- Launch the daemon: `appium`
23
-
24
- ## Helper configuration
25
-
26
- This helper should be configured in codecept.conf.ts or codecept.conf.js
27
-
28
- - `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage
29
- - `host`: (default: 'localhost') Appium host
30
- - `port`: (default: '4723') Appium port
31
- - `platform`: (Android or IOS), which mobile OS to use; alias to desiredCapabilities.platformName
32
- - `restart`: restart browser or app between tests (default: true), if set to false cookies will be cleaned but browser window will be kept and for apps nothing will be changed.
33
- - `desiredCapabilities`: \[], Appium capabilities, see below
34
- - `platformName` - Which mobile OS platform to use
35
- - `appPackage` - Java package of the Android app you want to run
36
- - `appActivity` - Activity name for the Android activity you want to launch from your package.
37
- - `deviceName`: The kind of mobile device or emulator to use
38
- - `platformVersion`: Mobile OS version
39
- - `app` - The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first.
40
- - `browserName`: Name of mobile web browser to automate. Should be an empty string if automating an app instead.
41
-
42
- Example Android App:
43
-
44
- ```js
45
- {
46
- helpers: {
47
- Appium: {
48
- platform: "Android",
49
- desiredCapabilities: {
50
- appPackage: "com.example.android.myApp",
51
- appActivity: "MainActivity",
52
- deviceName: "OnePlus3",
53
- platformVersion: "6.0.1"
54
- }
55
- }
56
- }
57
- }
58
- ```
59
-
60
- Example iOS Mobile Web with local Appium:
61
-
62
- ```js
63
- {
64
- helpers: {
65
- Appium: {
66
- platform: "iOS",
67
- url: "https://the-internet.herokuapp.com/",
68
- desiredCapabilities: {
69
- deviceName: "iPhone X",
70
- platformVersion: "12.0",
71
- browserName: "safari"
72
- }
73
- }
74
- }
75
- }
76
- ```
77
-
78
- Example iOS Mobile Web on BrowserStack:
79
-
80
- ```js
81
- {
82
- helpers: {
83
- Appium: {
84
- host: "hub-cloud.browserstack.com",
85
- port: 4444,
86
- user: process.env.BROWSERSTACK_USER,
87
- key: process.env.BROWSERSTACK_KEY,
88
- platform: "iOS",
89
- url: "https://the-internet.herokuapp.com/",
90
- desiredCapabilities: {
91
- realMobile: "true",
92
- device: "iPhone 8",
93
- os_version: "12",
94
- browserName: "safari"
95
- }
96
- }
97
- }
98
- }
99
- ```
100
-
101
- Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][3]
102
-
103
- ## Access From Helpers
104
-
105
- Receive a Appium client from a custom helper by accessing `browser` property:
106
-
107
- ```js
108
- let browser = this.helpers['Appium'].browser
109
- ```
110
-
111
- ## Methods
112
-
113
- ### Parameters
114
-
115
- - `config`
116
-
117
- ### runOnIOS
118
-
119
- Execute code only on iOS
120
-
121
- ```js
122
- I.runOnIOS(() => {
123
- I.click('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]');
124
- I.see('Hi, IOS', '~welcome');
125
- });
126
- ```
127
-
128
- Additional filter can be applied by checking for capabilities.
129
- For instance, this code will be executed only on iPhone 5s:
130
-
131
- ```js
132
- I.runOnIOS({deviceName: 'iPhone 5s'},() => {
133
- // ...
134
- });
135
- ```
136
-
137
- Also capabilities can be checked by a function.
138
-
139
- ```js
140
- I.runOnAndroid((caps) => {
141
- // caps is current config of desiredCapabiliites
142
- return caps.platformVersion >= 6
143
- },() => {
144
- // ...
145
- });
146
- ```
147
-
148
- #### Parameters
149
-
150
- - `caps` **any**
151
- - `fn` **any**
152
-
153
- ### runOnAndroid
154
-
155
- Execute code only on Android
156
-
157
- ```js
158
- I.runOnAndroid(() => {
159
- I.click('io.selendroid.testapp:id/buttonTest');
160
- });
161
- ```
162
-
163
- Additional filter can be applied by checking for capabilities.
164
- For instance, this code will be executed only on Android 6.0:
165
-
166
- ```js
167
- I.runOnAndroid({platformVersion: '6.0'},() => {
168
- // ...
169
- });
170
- ```
171
-
172
- Also capabilities can be checked by a function.
173
- In this case, code will be executed only on Android >= 6.
174
-
175
- ```js
176
- I.runOnAndroid((caps) => {
177
- // caps is current config of desiredCapabiliites
178
- return caps.platformVersion >= 6
179
- },() => {
180
- // ...
181
- });
182
- ```
183
-
184
- #### Parameters
185
-
186
- - `caps` **any**
187
- - `fn` **any**
188
-
189
- ### runInWeb
190
-
191
- Execute code only in Web mode.
192
-
193
- ```js
194
- I.runInWeb(() => {
195
- I.waitForElement('#data');
196
- I.seeInCurrentUrl('/data');
197
- });
198
- ```
199
-
200
- #### Parameters
201
-
202
- - `fn` **any**
203
-
204
- ### checkIfAppIsInstalled
205
-
206
- Returns app installation status.
207
-
208
- ```js
209
- I.checkIfAppIsInstalled("com.example.android.apis");
210
- ```
211
-
212
- #### Parameters
213
-
214
- - `bundleId` **[string][4]** String ID of bundled app
215
-
216
- Returns **[Promise][5]&lt;[boolean][6]>** Appium: support only Android
217
-
218
- ### seeAppIsInstalled
219
-
220
- Check if an app is installed.
221
-
222
- ```js
223
- I.seeAppIsInstalled("com.example.android.apis");
224
- ```
225
-
226
- #### Parameters
227
-
228
- - `bundleId` **[string][4]** String ID of bundled app
229
-
230
- Returns **[Promise][5]&lt;void>** Appium: support only Android
231
-
232
- ### seeAppIsNotInstalled
233
-
234
- Check if an app is not installed.
235
-
236
- ```js
237
- I.seeAppIsNotInstalled("com.example.android.apis");
238
- ```
239
-
240
- #### Parameters
241
-
242
- - `bundleId` **[string][4]** String ID of bundled app
243
-
244
- Returns **[Promise][5]&lt;void>** Appium: support only Android
245
-
246
- ### installApp
247
-
248
- Install an app on device.
249
-
250
- ```js
251
- I.installApp('/path/to/file.apk');
252
- ```
253
-
254
- #### Parameters
255
-
256
- - `path` **[string][4]** path to apk file
257
-
258
- Returns **[Promise][5]&lt;void>** Appium: support only Android
259
-
260
- ### removeApp
261
-
262
- Remove an app from the device.
263
-
264
- ```js
265
- I.removeApp('appName', 'com.example.android.apis');
266
- ```
267
-
268
- Appium: support only Android
269
-
270
- #### Parameters
271
-
272
- - `appId` **[string][4]**
273
- - `bundleId` **[string][4]?** ID of bundle
274
-
275
- ### resetApp
276
-
277
- Reset the currently running app for current session.
278
-
279
- ```js
280
- I.resetApp();
281
- ```
282
-
283
- ### seeCurrentActivityIs
284
-
285
- Check current activity on an Android device.
286
-
287
- ```js
288
- I.seeCurrentActivityIs(".HomeScreenActivity")
289
- ```
290
-
291
- #### Parameters
292
-
293
- - `currentActivity` **[string][4]**
294
-
295
- Returns **[Promise][5]&lt;void>** Appium: support only Android
296
-
297
- ### seeDeviceIsLocked
298
-
299
- Check whether the device is locked.
300
-
301
- ```js
302
- I.seeDeviceIsLocked();
303
- ```
304
-
305
- Returns **[Promise][5]&lt;void>** Appium: support only Android
306
-
307
- ### seeDeviceIsUnlocked
308
-
309
- Check whether the device is not locked.
310
-
311
- ```js
312
- I.seeDeviceIsUnlocked();
313
- ```
314
-
315
- Returns **[Promise][5]&lt;void>** Appium: support only Android
316
-
317
- ### seeOrientationIs
318
-
319
- Check the device orientation
320
-
321
- ```js
322
- I.seeOrientationIs('PORTRAIT');
323
- I.seeOrientationIs('LANDSCAPE')
324
- ```
325
-
326
- #### Parameters
327
-
328
- - `orientation` **(`"LANDSCAPE"` \| `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS
329
-
330
- Returns **[Promise][5]&lt;void>**
331
-
332
- ### setOrientation
333
-
334
- Set a device orientation. Will fail, if app will not set orientation
335
-
336
- ```js
337
- I.setOrientation('PORTRAIT');
338
- I.setOrientation('LANDSCAPE')
339
- ```
340
-
341
- #### Parameters
342
-
343
- - `orientation` **(`"LANDSCAPE"` \| `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS
344
-
345
- ### grabAllContexts
346
-
347
- Get list of all available contexts
348
-
349
- let contexts = await I.grabAllContexts();
350
-
351
- Returns **[Promise][5]&lt;[Array][7]&lt;[string][4]>>** Appium: support Android and iOS
352
-
353
- ### grabContext
354
-
355
- Retrieve current context
356
-
357
- ```js
358
- let context = await I.grabContext();
359
- ```
360
-
361
- Returns **[Promise][5]&lt;([string][4] | null)>** Appium: support Android and iOS
362
-
363
- ### grabCurrentActivity
364
-
365
- Get current device activity.
366
-
367
- ```js
368
- let activity = await I.grabCurrentActivity();
369
- ```
370
-
371
- Returns **[Promise][5]&lt;[string][4]>** Appium: support only Android
372
-
373
- ### grabNetworkConnection
374
-
375
- Get information about the current network connection (Data/WIFI/Airplane).
376
- The actual server value will be a number. However WebdriverIO additional
377
- properties to the response object to allow easier assertions.
378
-
379
- ```js
380
- let con = await I.grabNetworkConnection();
381
- ```
382
-
383
- Returns **[Promise][5]&lt;{}>** Appium: support only Android
384
-
385
- ### grabOrientation
386
-
387
- Get current orientation.
388
-
389
- ```js
390
- let orientation = await I.grabOrientation();
391
- ```
392
-
393
- Returns **[Promise][5]&lt;[string][4]>** Appium: support Android and iOS
394
-
395
- ### grabSettings
396
-
397
- Get all the currently specified settings.
398
-
399
- ```js
400
- let settings = await I.grabSettings();
401
- ```
402
-
403
- Returns **[Promise][5]&lt;[string][4]>** Appium: support Android and iOS
404
-
405
- ### \_switchToContext
406
-
407
- Switch to the specified context.
408
-
409
- #### Parameters
410
-
411
- - `context` **any** the context to switch to
412
-
413
- ### switchToWeb
414
-
415
- Switches to web context.
416
- If no context is provided switches to the first detected web context
417
-
418
- ```js
419
- // switch to first web context
420
- I.switchToWeb();
421
-
422
- // or set the context explicitly
423
- I.switchToWeb('WEBVIEW_io.selendroid.testapp');
424
- ```
425
-
426
- #### Parameters
427
-
428
- - `context` **[string][4]?**
429
-
430
- Returns **[Promise][5]&lt;void>**
431
-
432
- ### switchToNative
433
-
434
- Switches to native context.
435
- By default switches to NATIVE_APP context unless other specified.
436
-
437
- ```js
438
- I.switchToNative();
439
-
440
- // or set context explicitly
441
- I.switchToNative('SOME_OTHER_CONTEXT');
442
- ```
443
-
444
- #### Parameters
445
-
446
- - `context` **any?** (optional, default `null`)
447
-
448
- Returns **[Promise][5]&lt;void>**
449
-
450
- ### startActivity
451
-
452
- Start an arbitrary Android activity during a session.
453
-
454
- ```js
455
- I.startActivity('io.selendroid.testapp', '.RegisterUserActivity');
456
- ```
457
-
458
- Appium: support only Android
459
-
460
- #### Parameters
461
-
462
- - `appPackage` **[string][4]**
463
- - `appActivity` **[string][4]**
464
-
465
- Returns **[Promise][5]&lt;void>**
466
-
467
- ### setNetworkConnection
468
-
469
- Set network connection mode.
470
-
471
- - airplane mode
472
- - wifi mode
473
- - data data
474
-
475
- ```js
476
- I.setNetworkConnection(0) // airplane mode off, wifi off, data off
477
- I.setNetworkConnection(1) // airplane mode on, wifi off, data off
478
- I.setNetworkConnection(2) // airplane mode off, wifi on, data off
479
- I.setNetworkConnection(4) // airplane mode off, wifi off, data on
480
- I.setNetworkConnection(6) // airplane mode off, wifi on, data on
481
- ```
482
-
483
- See corresponding [webdriverio reference][8].
484
-
485
- #### Parameters
486
-
487
- - `value`
488
-
489
- Returns **[Promise][5]&lt;{}>** Appium: support only Android
490
-
491
- ### setSettings
492
-
493
- Update the current setting on the device
494
-
495
- ```js
496
- I.setSettings({cyberdelia: 'open'});
497
- ```
498
-
499
- #### Parameters
500
-
501
- - `settings` **[object][9]** objectAppium: support Android and iOS
502
-
503
- ### hideDeviceKeyboard
504
-
505
- Hide the keyboard.
506
-
507
- ```js
508
- // taps outside to hide keyboard per default
509
- I.hideDeviceKeyboard();
510
- I.hideDeviceKeyboard('tapOutside');
511
-
512
- // or by pressing key
513
- I.hideDeviceKeyboard('pressKey', 'Done');
514
- ```
515
-
516
- Appium: support Android and iOS
517
-
518
- #### Parameters
519
-
520
- - `strategy` **(`"tapOutside"` \| `"pressKey"`)?** Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
521
- - `key` **[string][4]?** Optional key
522
-
523
- ### sendDeviceKeyEvent
524
-
525
- Send a key event to the device.
526
- List of keys: [https://developer.android.com/reference/android/view/KeyEvent.html][10]
527
-
528
- ```js
529
- I.sendDeviceKeyEvent(3);
530
- ```
531
-
532
- #### Parameters
533
-
534
- - `keyValue` **[number][11]** Device specific key value
535
-
536
- Returns **[Promise][5]&lt;void>** Appium: support only Android
537
-
538
- ### openNotifications
539
-
540
- Open the notifications panel on the device.
541
-
542
- ```js
543
- I.openNotifications();
544
- ```
545
-
546
- Returns **[Promise][5]&lt;void>** Appium: support only Android
547
-
548
- ### makeTouchAction
549
-
550
- The Touch Action API provides the basis of all gestures that can be
551
- automated in Appium. At its core is the ability to chain together ad hoc
552
- individual actions, which will then be applied to an element in the
553
- application on the device.
554
- [See complete documentation][12]
555
-
556
- ```js
557
- I.makeTouchAction("~buttonStartWebviewCD", 'tap');
558
- ```
559
-
560
- #### Parameters
561
-
562
- - `locator`
563
- - `action`
564
-
565
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
566
-
567
- ### tap
568
-
569
- Taps on element.
570
-
571
- ```js
572
- I.tap("~buttonStartWebviewCD");
573
- ```
574
-
575
- Shortcut for `makeTouchAction`
576
-
577
- #### Parameters
578
-
579
- - `locator` **any**
580
-
581
- Returns **[Promise][5]&lt;void>**
582
-
583
- ### swipe
584
-
585
- Perform a swipe on the screen or an element.
586
-
587
- ```js
588
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
589
- I.swipe(locator, 800, 1200, 1000);
590
- ```
591
-
592
- [See complete reference][13]
593
-
594
- #### Parameters
595
-
596
- - `locator` **([string][4] \| [object][9])**
597
- - `xoffset` **[number][11]**
598
- - `yoffset` **[number][11]**
599
- - `speed` **[number][11]** (optional), 1000 by default (optional, default `1000`)
600
-
601
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
602
-
603
- ### performSwipe
604
-
605
- Perform a swipe on the screen.
606
-
607
- ```js
608
- I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 });
609
- ```
610
-
611
- #### Parameters
612
-
613
- - `from` **[object][9]**
614
- - `to` **[object][9]** Appium: support Android and iOS
615
-
616
- ### swipeDown
617
-
618
- Perform a swipe down on an element.
619
-
620
- ```js
621
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
622
- I.swipeDown(locator); // simple swipe
623
- I.swipeDown(locator, 500); // set speed
624
- I.swipeDown(locator, 1200, 1000); // set offset and speed
625
- ```
626
-
627
- #### Parameters
628
-
629
- - `locator` **([string][4] \| [object][9])**
630
- - `yoffset` **[number][11]?** (optional) (optional, default `1000`)
631
- - `speed` **[number][11]** (optional), 1000 by default (optional, default `1000`)
632
-
633
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
634
-
635
- ### swipeLeft
636
-
637
- Perform a swipe left on an element.
638
-
639
- ```js
640
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
641
- I.swipeLeft(locator); // simple swipe
642
- I.swipeLeft(locator, 500); // set speed
643
- I.swipeLeft(locator, 1200, 1000); // set offset and speed
644
- ```
645
-
646
- #### Parameters
647
-
648
- - `locator` **([string][4] \| [object][9])**
649
- - `xoffset` **[number][11]?** (optional) (optional, default `1000`)
650
- - `speed` **[number][11]** (optional), 1000 by default (optional, default `1000`)
651
-
652
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
653
-
654
- ### swipeRight
655
-
656
- Perform a swipe right on an element.
657
-
658
- ```js
659
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
660
- I.swipeRight(locator); // simple swipe
661
- I.swipeRight(locator, 500); // set speed
662
- I.swipeRight(locator, 1200, 1000); // set offset and speed
663
- ```
664
-
665
- #### Parameters
666
-
667
- - `locator` **([string][4] \| [object][9])**
668
- - `xoffset` **[number][11]?** (optional) (optional, default `1000`)
669
- - `speed` **[number][11]** (optional), 1000 by default (optional, default `1000`)
670
-
671
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
672
-
673
- ### swipeUp
674
-
675
- Perform a swipe up on an element.
676
-
677
- ```js
678
- let locator = "#io.selendroid.testapp:id/LinearLayout1";
679
- I.swipeUp(locator); // simple swipe
680
- I.swipeUp(locator, 500); // set speed
681
- I.swipeUp(locator, 1200, 1000); // set offset and speed
682
- ```
683
-
684
- #### Parameters
685
-
686
- - `locator` **([string][4] \| [object][9])**
687
- - `yoffset` **[number][11]?** (optional) (optional, default `1000`)
688
- - `speed` **[number][11]** (optional), 1000 by default (optional, default `1000`)
689
-
690
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
691
-
692
- ### swipeTo
693
-
694
- Perform a swipe in selected direction on an element to searchable element.
695
-
696
- ```js
697
- I.swipeTo(
698
- "android.widget.CheckBox", // searchable element
699
- "//android.widget.ScrollView/android.widget.LinearLayout", // scroll element
700
- "up", // direction
701
- 30,
702
- 100,
703
- 500);
704
- ```
705
-
706
- #### Parameters
707
-
708
- - `searchableLocator` **[string][4]**
709
- - `scrollLocator` **[string][4]**
710
- - `direction` **[string][4]**
711
- - `timeout` **[number][11]**
712
- - `offset` **[number][11]**
713
- - `speed` **[number][11]**
714
-
715
- Returns **[Promise][5]&lt;void>** Appium: support Android and iOS
716
-
717
- ### touchPerform
718
-
719
- Performs a specific touch action.
720
- The action object need to contain the action name, x/y coordinates
721
-
722
- ```js
723
- I.touchPerform([{
724
- action: 'press',
725
- options: {
726
- x: 100,
727
- y: 200
728
- }
729
- }, {action: 'release'}])
730
-
731
- I.touchPerform([{
732
- action: 'tap',
733
- options: {
734
- element: '1', // json web element was queried before
735
- x: 10, // x offset
736
- y: 20, // y offset
737
- count: 1 // number of touches
738
- }
739
- }]);
740
- ```
741
-
742
- Appium: support Android and iOS
743
-
744
- #### Parameters
745
-
746
- - `actions` **[Array][7]** Array of touch actions
747
-
748
- ### pullFile
749
-
750
- Pulls a file from the device.
751
-
752
- ```js
753
- I.pullFile('/storage/emulated/0/DCIM/logo.png', 'my/path');
754
- // save file to output dir
755
- I.pullFile('/storage/emulated/0/DCIM/logo.png', output_dir);
756
- ```
757
-
758
- #### Parameters
759
-
760
- - `path` **[string][4]**
761
- - `dest` **[string][4]**
762
-
763
- Returns **[Promise][5]&lt;[string][4]>** Appium: support Android and iOS
764
-
765
- ### shakeDevice
766
-
767
- Perform a shake action on the device.
768
-
769
- ```js
770
- I.shakeDevice();
771
- ```
772
-
773
- Returns **[Promise][5]&lt;void>** Appium: support only iOS
774
-
775
- ### rotate
776
-
777
- Perform a rotation gesture centered on the specified element.
778
-
779
- ```js
780
- I.rotate(120, 120)
781
- ```
782
-
783
- See corresponding [webdriverio reference][14].
784
-
785
- #### Parameters
786
-
787
- - `x`
788
- - `y`
789
- - `duration`
790
- - `radius`
791
- - `rotation`
792
- - `touchCount`
793
-
794
- Returns **[Promise][5]&lt;void>** Appium: support only iOS
795
-
796
- ### setImmediateValue
797
-
798
- Set immediate value in app.
799
-
800
- See corresponding [webdriverio reference][15].
801
-
802
- #### Parameters
803
-
804
- - `id`
805
- - `value`
806
-
807
- Returns **[Promise][5]&lt;void>** Appium: support only iOS
808
-
809
- ### simulateTouchId
810
-
811
- Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
812
-
813
- ```js
814
- I.touchId(); // simulates valid fingerprint
815
- I.touchId(true); // simulates valid fingerprint
816
- I.touchId(false); // simulates invalid fingerprint
817
- ```
818
-
819
- #### Parameters
820
-
821
- - `match`
822
-
823
- Returns **[Promise][5]&lt;void>** Appium: support only iOS
824
- TODO: not tested
825
-
826
- ### closeApp
827
-
828
- Close the given application.
829
-
830
- ```js
831
- I.closeApp();
832
- ```
833
-
834
- Returns **[Promise][5]&lt;void>** Appium: support only iOS
835
-
836
- ### appendField
837
-
838
- Appends text to a input field or textarea.
839
- Field is located by name, label, CSS or XPath
840
-
841
- ```js
842
- I.appendField('#myTextField', 'appended');
843
- ```
844
-
845
- #### Parameters
846
-
847
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator
848
- - `value` **[string][4]** text value to append.
849
- ⚠️ returns a _promise_ which is synchronized internally by recorder
850
-
851
- ### checkOption
852
-
853
- Selects a checkbox or radio button.
854
- Element is located by label or name or CSS or XPath.
855
-
856
- The second parameter is a context (CSS or XPath locator) to narrow the search.
857
-
858
- ```js
859
- I.checkOption('#agree');
860
- I.checkOption('I Agree to Terms and Conditions');
861
- I.checkOption('agree', '//form');
862
- ```
863
-
864
- #### Parameters
865
-
866
- - `field` **([string][4] \| [object][9])** checkbox located by label | name | CSS | XPath | strict locator.
867
- - `context` **([string][4]? | [object][9])** (optional, `null` by default) element located by CSS | XPath | strict locator.
868
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
869
-
870
- ### click
871
-
872
- Perform a click on a link or a button, given by a locator.
873
- If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
874
- For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
875
- For images, the "alt" attribute and inner text of any parent links are searched.
876
-
877
- The second parameter is a context (CSS or XPath locator) to narrow the search.
878
-
879
- ```js
880
- // simple link
881
- I.click('Logout');
882
- // button of form
883
- I.click('Submit');
884
- // CSS button
885
- I.click('#form input[type=submit]');
886
- // XPath
887
- I.click('//form/*[@type=submit]');
888
- // link in context
889
- I.click('Logout', '#nav');
890
- // using strict locator
891
- I.click({css: 'nav a.login'});
892
- ```
893
-
894
- #### Parameters
895
-
896
- - `locator` **([string][4] \| [object][9])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
897
- - `context` **([string][4]? | [object][9] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
898
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
899
-
900
- ### dontSeeCheckboxIsChecked
901
-
902
- Verifies that the specified checkbox is not checked.
903
-
904
- ```js
905
- I.dontSeeCheckboxIsChecked('#agree'); // located by ID
906
- I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
907
- I.dontSeeCheckboxIsChecked('agree'); // located by name
908
- ```
909
-
910
- #### Parameters
911
-
912
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator.
913
- ⚠️ returns a _promise_ which is synchronized internally by recorder
914
-
915
- ### dontSeeElement
916
-
917
- Opposite to `seeElement`. Checks that element is not visible (or in DOM)
918
-
919
- ```js
920
- I.dontSeeElement('.modal'); // modal is not shown
921
- ```
922
-
923
- #### Parameters
924
-
925
- - `locator` **([string][4] \| [object][9])** located by CSS|XPath|Strict locator.
926
- ⚠️ returns a _promise_ which is synchronized internally by recorder
927
-
928
- ### dontSeeInField
929
-
930
- Checks that value of input field or textarea doesn't equal to given value
931
- Opposite to `seeInField`.
932
-
933
- ```js
934
- I.dontSeeInField('email', 'user@user.com'); // field by name
935
- I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
936
- ```
937
-
938
- #### Parameters
939
-
940
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator.
941
- - `value` **[string][4]** value to check.
942
- ⚠️ returns a _promise_ which is synchronized internally by recorder
943
-
944
- ### dontSee
945
-
946
- Opposite to `see`. Checks that a text is not present on a page.
947
- Use context parameter to narrow down the search.
948
-
949
- ```js
950
- I.dontSee('Login'); // assume we are already logged in.
951
- I.dontSee('Login', '.nav'); // no login inside .nav element
952
- ```
953
-
954
- #### Parameters
955
-
956
- - `text` **[string][4]** which is not present.
957
- - `context` **([string][4] \| [object][9])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
958
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
959
-
960
- ### fillField
961
-
962
- Fills a text field or textarea, after clearing its value, with the given string.
963
- Field is located by name, label, CSS, or XPath.
964
-
965
- ```js
966
- // by label
967
- I.fillField('Email', 'hello@world.com');
968
- // by name
969
- I.fillField('password', secret('123456'));
970
- // by CSS
971
- I.fillField('form#login input[name=username]', 'John');
972
- // or by strict locator
973
- I.fillField({css: 'form#login input[name=username]'}, 'John');
974
- ```
975
-
976
- #### Parameters
977
-
978
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator.
979
- - `value` **([string][4] \| [object][9])** text value to fill.
980
- ⚠️ returns a _promise_ which is synchronized internally by recorder
981
-
982
- ### grabTextFromAll
983
-
984
- Retrieves all texts from an element located by CSS or XPath and returns it to test.
985
- Resumes test execution, so **should be used inside async with `await`** operator.
986
-
987
- ```js
988
- let pins = await I.grabTextFromAll('#pin li');
989
- ```
990
-
991
- #### Parameters
992
-
993
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
994
-
995
- Returns **[Promise][5]&lt;[Array][7]&lt;[string][4]>>** attribute value
996
-
997
- ### grabTextFrom
998
-
999
- Retrieves a text from an element located by CSS or XPath and returns it to test.
1000
- Resumes test execution, so **should be used inside async with `await`** operator.
1001
-
1002
- ```js
1003
- let pin = await I.grabTextFrom('#pin');
1004
- ```
1005
-
1006
- If multiple elements found returns first element.
1007
-
1008
- #### Parameters
1009
-
1010
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1011
-
1012
- Returns **[Promise][5]&lt;[string][4]>** attribute value
1013
-
1014
- ### grabNumberOfVisibleElements
1015
-
1016
- Grab number of visible elements by locator.
1017
- Resumes test execution, so **should be used inside async function with `await`** operator.
1018
-
1019
- ```js
1020
- let numOfElements = await I.grabNumberOfVisibleElements('p');
1021
- ```
1022
-
1023
- #### Parameters
1024
-
1025
- - `locator` **([string][4] \| [object][9])** located by CSS|XPath|strict locator.
1026
-
1027
- Returns **[Promise][5]&lt;[number][11]>** number of visible elements
1028
-
1029
- ### grabAttributeFrom
1030
-
1031
- Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
1032
-
1033
- Retrieves an attribute from an element located by CSS or XPath and returns it to test.
1034
- Resumes test execution, so **should be used inside async with `await`** operator.
1035
- If more than one element is found - attribute of first element is returned.
1036
-
1037
- ```js
1038
- let hint = await I.grabAttributeFrom('#tooltip', 'title');
1039
- ```
1040
-
1041
- #### Parameters
1042
-
1043
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1044
- - `attr` **[string][4]** attribute name.
1045
-
1046
- Returns **[Promise][5]&lt;[string][4]>** attribute value
1047
-
1048
- ### grabAttributeFromAll
1049
-
1050
- Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
1051
- Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
1052
- Resumes test execution, so **should be used inside async with `await`** operator.
1053
-
1054
- ```js
1055
- let hints = await I.grabAttributeFromAll('.tooltip', 'title');
1056
- ```
1057
-
1058
- #### Parameters
1059
-
1060
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1061
- - `attr` **[string][4]** attribute name.
1062
-
1063
- Returns **[Promise][5]&lt;[Array][7]&lt;[string][4]>>** attribute value
1064
-
1065
- ### grabValueFromAll
1066
-
1067
- Retrieves an array of value from a form located by CSS or XPath and returns it to test.
1068
- Resumes test execution, so **should be used inside async function with `await`** operator.
1069
-
1070
- ```js
1071
- let inputs = await I.grabValueFromAll('//form/input');
1072
- ```
1073
-
1074
- #### Parameters
1075
-
1076
- - `locator` **([string][4] \| [object][9])** field located by label|name|CSS|XPath|strict locator.
1077
-
1078
- Returns **[Promise][5]&lt;[Array][7]&lt;[string][4]>>** attribute value
1079
-
1080
- ### grabValueFrom
1081
-
1082
- Retrieves a value from a form element located by CSS or XPath and returns it to test.
1083
- Resumes test execution, so **should be used inside async function with `await`** operator.
1084
- If more than one element is found - value of first element is returned.
1085
-
1086
- ```js
1087
- let email = await I.grabValueFrom('input[name=email]');
1088
- ```
1089
-
1090
- #### Parameters
1091
-
1092
- - `locator` **([string][4] \| [object][9])** field located by label|name|CSS|XPath|strict locator.
1093
-
1094
- Returns **[Promise][5]&lt;[string][4]>** attribute value
1095
-
1096
- ### saveScreenshot
1097
-
1098
- Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
1099
- Filename is relative to output folder.
1100
-
1101
- ```js
1102
- I.saveScreenshot('debug.png');
1103
- ```
1104
-
1105
- #### Parameters
1106
-
1107
- - `fileName` **[string][4]** file name to save.
1108
-
1109
- Returns **[Promise][5]&lt;void>**
1110
-
1111
- ### scrollIntoView
1112
-
1113
- Scroll element into viewport.
1114
-
1115
- ```js
1116
- I.scrollIntoView('#submit');
1117
- I.scrollIntoView('#submit', true);
1118
- I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
1119
- ```
1120
-
1121
- #### Parameters
1122
-
1123
- - `locator` **([string][4] \| [object][9])** located by CSS|XPath|strict locator.
1124
- - `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][16].
1125
- ⚠️ returns a _promise_ which is synchronized internally by recorderSupported only for web testing
1126
-
1127
- ### seeCheckboxIsChecked
1128
-
1129
- Verifies that the specified checkbox is checked.
1130
-
1131
- ```js
1132
- I.seeCheckboxIsChecked('Agree');
1133
- I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
1134
- I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1135
- ```
1136
-
1137
- #### Parameters
1138
-
1139
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator.
1140
- ⚠️ returns a _promise_ which is synchronized internally by recorder
1141
-
1142
- ### seeElement
1143
-
1144
- Checks that a given Element is visible
1145
- Element is located by CSS or XPath.
1146
-
1147
- ```js
1148
- I.seeElement('#modal');
1149
- ```
1150
-
1151
- #### Parameters
1152
-
1153
- - `locator` **([string][4] \| [object][9])** located by CSS|XPath|strict locator.
1154
- ⚠️ returns a _promise_ which is synchronized internally by recorder
1155
-
1156
- ### seeInField
1157
-
1158
- Checks that the given input field or textarea equals to given value.
1159
- For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
1160
-
1161
- ```js
1162
- I.seeInField('Username', 'davert');
1163
- I.seeInField({css: 'form textarea'},'Type your comment here');
1164
- I.seeInField('form input[type=hidden]','hidden_value');
1165
- I.seeInField('#searchform input','Search');
1166
- ```
1167
-
1168
- #### Parameters
1169
-
1170
- - `field` **([string][4] \| [object][9])** located by label|name|CSS|XPath|strict locator.
1171
- - `value` **[string][4]** value to check.
1172
- ⚠️ returns a _promise_ which is synchronized internally by recorder
1173
-
1174
- ### see
1175
-
1176
- Checks that a page contains a visible text.
1177
- Use context parameter to narrow down the search.
1178
-
1179
- ```js
1180
- I.see('Welcome'); // text welcome on a page
1181
- I.see('Welcome', '.content'); // text inside .content div
1182
- I.see('Register', {css: 'form.register'}); // use strict locator
1183
- ```
1184
-
1185
- #### Parameters
1186
-
1187
- - `text` **[string][4]** expected on page.
1188
- - `context` **([string][4]? | [object][9])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
1189
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
1190
-
1191
- ### selectOption
1192
-
1193
- Selects an option in a drop-down select.
1194
- Field is searched by label | name | CSS | XPath.
1195
- Option is selected by visible text or by value.
1196
-
1197
- ```js
1198
- I.selectOption('Choose Plan', 'Monthly'); // select by label
1199
- I.selectOption('subscription', 'Monthly'); // match option by text
1200
- I.selectOption('subscription', '0'); // or by value
1201
- I.selectOption('//form/select[@name=account]','Premium');
1202
- I.selectOption('form select[name=account]', 'Premium');
1203
- I.selectOption({css: 'form select[name=account]'}, 'Premium');
1204
- ```
1205
-
1206
- Provide an array for the second argument to select multiple options.
1207
-
1208
- ```js
1209
- I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1210
- ```
1211
-
1212
- #### Parameters
1213
-
1214
- - `select` **([string][4] \| [object][9])** field located by label|name|CSS|XPath|strict locator.
1215
- - `option` **([string][4] \| [Array][7]&lt;any>)** visible text or value of option.
1216
- ⚠️ returns a _promise_ which is synchronized internally by recorderSupported only for web testing
1217
-
1218
- ### waitForElement
1219
-
1220
- Waits for element to be present on page (by default waits for 1sec).
1221
- Element can be located by CSS or XPath.
1222
-
1223
- ```js
1224
- I.waitForElement('.btn.continue');
1225
- I.waitForElement('.btn.continue', 5); // wait for 5 secs
1226
- ```
1227
-
1228
- #### Parameters
1229
-
1230
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1231
- - `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
1232
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
1233
-
1234
- ### waitForVisible
1235
-
1236
- Waits for an element to become visible on a page (by default waits for 1sec).
1237
- Element can be located by CSS or XPath.
1238
-
1239
- ```js
1240
- I.waitForVisible('#popup');
1241
- ```
1242
-
1243
- #### Parameters
1244
-
1245
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1246
- - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1247
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `1`)
1248
-
1249
- ### waitForInvisible
1250
-
1251
- Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
1252
- Element can be located by CSS or XPath.
1253
-
1254
- ```js
1255
- I.waitForInvisible('#popup');
1256
- ```
1257
-
1258
- #### Parameters
1259
-
1260
- - `locator` **([string][4] \| [object][9])** element located by CSS|XPath|strict locator.
1261
- - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1262
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `1`)
1263
-
1264
- ### waitForText
1265
-
1266
- Waits for a text to appear (by default waits for 1sec).
1267
- Element can be located by CSS or XPath.
1268
- Narrow down search results by providing context.
1269
-
1270
- ```js
1271
- I.waitForText('Thank you, form has been submitted');
1272
- I.waitForText('Thank you, form has been submitted', 5, '#modal');
1273
- ```
1274
-
1275
- #### Parameters
1276
-
1277
- - `text` **[string][4]** to wait for.
1278
- - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
1279
- - `context` **([string][4] \| [object][9])?** (optional) element located by CSS|XPath|strict locator.
1280
- ⚠️ returns a _promise_ which is synchronized internally by recorder (optional, default `null`)
1281
-
1282
- [1]: http://codecept.io/helpers/WebDriver/
1283
-
1284
- [2]: http://appium.io/
1285
-
1286
- [3]: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
1287
-
1288
- [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1289
-
1290
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1291
-
1292
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
1293
-
1294
- [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1295
-
1296
- [8]: http://webdriver.io/api/mobile/setNetworkConnection.html
1297
-
1298
- [9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
1299
-
1300
- [10]: https://developer.android.com/reference/android/view/KeyEvent.html
1301
-
1302
- [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1303
-
1304
- [12]: http://webdriver.io/api/mobile/touchAction.html
1305
-
1306
- [13]: http://webdriver.io/api/mobile/swipe.html
1307
-
1308
- [14]: http://webdriver.io/api/mobile/rotate.html
1309
-
1310
- [15]: http://webdriver.io/api/mobile/setImmediateValue.html
1311
-
1312
- [16]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView