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