codeceptjs 4.0.0-rc.2 → 4.0.0-rc.20

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