Skip to content

Commit 8f9aebf

Browse files
authored
docs(appium): update to v2 (#3932)
1 parent 73663de commit 8f9aebf

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

docs/helpers/Appium.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Extends Webdriver**
66

7-
Appium helper extends [Webriver][1] helper.
7+
Appium helper extends [Webdriver][1] helper.
88
It supports all browser methods and also includes special methods for mobile apps testing.
99
You can use this helper to test Web on desktop and mobile devices and mobile apps.
1010

@@ -25,7 +25,7 @@ Launch the daemon: `appium`
2525

2626
This helper should be configured in codecept.conf.ts or codecept.conf.js
2727

28-
- `appiumV2`: set this to true if you want to run tests with Appiumv2. See more how to setup [here][3]
28+
- `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here][3]
2929
- `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
3030
- `host`: (default: 'localhost') Appium host
3131
- `port`: (default: '4723') Appium port
@@ -99,7 +99,7 @@ helpers: {
9999
}
100100
```
101101

102-
Example Android App using Appiumv2 on BrowserStack:
102+
Example Android App using AppiumV2 on BrowserStack:
103103

104104
```js
105105
{
@@ -136,7 +136,7 @@ helpers: {
136136
}
137137
```
138138

139-
Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][4]
139+
Additional configuration params can be used from [https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md][4]
140140

141141
## Access From Helpers
142142

@@ -1321,11 +1321,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
13211321

13221322
[1]: http://codecept.io/helpers/WebDriver/
13231323

1324-
[2]: http://appium.io/
1324+
[2]: https://appium.io/docs/en/2.1/
13251325

13261326
[3]: https://codecept.io/mobile/#setting-up
13271327

1328-
[4]: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
1328+
[4]: https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md
13291329

13301330
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
13311331

docs/mobile.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ I.seeElement({
2424
});
2525
```
2626

27-
This test is easy to read and write. Also it will work both on iOS and Android devices.
27+
This test is easy to read and write. Also, it will work both on iOS and Android devices.
2828
Doesn't it sound cool?
2929

3030
## Setting Up
3131

3232
Ensure that you have [CodeceptJS installed](https://codecept.io/installation/).
33-
You will also need to install [Appium](https://appium.io/).
33+
You will also need to install [Appium](https://appium.io/docs/en/2.1/).
3434
We suggest to use [appium-doctor](https://www.npmjs.com/package/appium-doctor) to check if your system is ready for mobile testing.
3535

3636
```sh
@@ -45,13 +45,12 @@ To install Appium use npm:
4545
npm i -g appium
4646
```
4747

48-
To use Appium 2.x:
49-
```sh
50-
npm i -g appium@next
51-
```
52-
Appium 2x (still beta) reenvisions Appium as a platform where “drivers” and “plugins” can be easily created and shared independently.
48+
Appium 2x reenvisions Appium as a platform where “drivers” and “plugins” can be easily created and shared independently.
49+
50+
** Note: ** Appium v1 is no longer maintained, so it's advised to migrate to Appium v2.
51+
5352
Install an Appium driver and its dependencies
54-
To install the Appium driver and its dependencies, we'll be using the uiautomator2 (Android), XCUITest (iOS) drivers.
53+
To install the Appium driver and its dependencies, we'll be using the `uiautomator2` (Android), `XCUITest` (iOS) drivers.
5554

5655
```
5756
appium driver install xcuitest
@@ -79,11 +78,6 @@ It should be packed into apk (for Android) or .ipa (for iOS) or zip.
7978
Next, is to launch the emulator or connect a physical device.
8079
Once they are prepared, launch Appium:
8180

82-
```sh
83-
appium
84-
```
85-
86-
To use Appium 2.x:
8781
```sh
8882
tth~$npx appium --base-path=/wd/hub
8983
[Appium] Welcome to Appium v2.0.0-beta.57 (REV 3e675c32ae71dc0b00749d5d29213e2ea5b53c5b)
@@ -102,7 +96,9 @@ tth~$npx appium --base-path=/wd/hub
10296
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
10397
```
10498
105-
To run mobile test you need either an device emulator (available with Android SDK or iOS), real device connected for mobile testing. Alternatively, you may execute Appium with device emulator inside Docker container.
99+
** Note: ** Appium v2 doesn't use the same base path as Appium v1, hence if you want to use the same base path you should pass `--base-path=/wd/hub` when launching the Appium server.
100+
101+
To run mobile test you need either a device emulator (available with Android SDK or iOS) or real device connected for mobile testing. Alternatively, you may execute Appium with device emulator inside Docker container.
106102
107103
CodeceptJS should be installed with webdriverio support:
108104
@@ -135,7 +131,7 @@ You will also be asked for the platform and the application package.
135131
```
136132
137133
Check the newly created `codecept.conf.js` configuration file.
138-
You may want to set some additional Appium settings via [desiredCapabilities](https://appium.io/docs/en/writing-running-appium/caps/)
134+
You may want to set some additional Appium settings via [desiredCapabilities](https://appium.io/docs/en/2.1/guides/caps/)
139135
140136
```js
141137
helpers: {
@@ -147,7 +143,7 @@ helpers: {
147143
}
148144
```
149145
150-
Once you configured Appium, create the first test by running
146+
Once you configured Appium, create the first test by running:
151147
152148
```sh
153149
npx codeceptjs gt
@@ -219,7 +215,7 @@ To start writing a test it is important to understand how to locate elements for
219215
In both Android and iPhone elements are defined in XML format and can be searched by XPath locators.
220216
221217
```js
222-
I.seeElement('//android.widget.ScrollView/android.widget.LinearLayout')'
218+
I.seeElement('//android.widget.ScrollView/android.widget.LinearLayout')
223219
```
224220
225221
> Despite showing XPath in this guide we **do not recommend using XPath for testing iOS native apps. XPath runs very slow on iOS. Consider using ID or Accessibility ID locators instead.
@@ -243,7 +239,7 @@ I.seeElement('~startUserRegistrationButton');
243239
```
244240
245241
Elements can also have ids, which can be located with `#` prefix.
246-
On Android it it is important to keep full package name in id locator:
242+
On Android, it is important to keep full package name in id locator:
247243
248244
```js
249245
I.seeElement('#io.selendroid.testapp:id/inputUsername');
@@ -258,9 +254,9 @@ I.click('Click me!');
258254
259255
Native iOS/Android locators can be used with `android=` and `ios=` prefixes. [Learn more](https://webdriver.io/guide/usage/selectors.html#Mobile-Selectors).
260256
261-
But how to get all those locators? We recommend to use [Appium Inspector](https://github.com/appium/appium-desktop).
257+
But how to get all those locators? We recommend to use [Appium Inspector](https://github.com/appium/appium-inspector).
262258
263-
For Android you can use **UI Automator Viewer** bundled with Android SDK:
259+
For Android, you can use **UI Automator Viewer** bundled with Android SDK:
264260
265261
![](https://user-images.githubusercontent.com/220264/27566310-1f631604-5aed-11e7-8b92-1ffe9e9f14f9.png)
266262
@@ -284,7 +280,7 @@ Inside WebView all browser features are enabled: CSS locators, JavaScript, etc.
284280
To set a specific context use `{ web: 'webview.context' }` instead:
285281
286282
```js
287-
within({webview: 'MyWEBVIEW_com.my.app'}, () => );
283+
within({webview: 'MyWEBVIEW_com.my.app'}, () => {});
288284
```
289285
290286
Alternatively use `switchToWeb` or `switchToNative` methods to switch between contexts.

lib/helper/Appium.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const vendorPrefix = {
2222
};
2323

2424
/**
25-
* Appium helper extends [Webriver](http://codecept.io/helpers/WebDriver/) helper.
25+
* Appium helper extends [Webdriver](http://codecept.io/helpers/WebDriver/) helper.
2626
* It supports all browser methods and also includes special methods for mobile apps testing.
2727
* You can use this helper to test Web on desktop and mobile devices and mobile apps.
2828
*
@@ -31,7 +31,7 @@ const vendorPrefix = {
3131
* Appium is an open source test automation framework for use with native, hybrid and mobile web apps that implements the WebDriver protocol.
3232
* It allows you to run Selenium tests on mobile devices and also test native, hybrid and mobile web apps.
3333
*
34-
* Download and install [Appium](http://appium.io/)
34+
* Download and install [Appium](https://appium.io/docs/en/2.1/)
3535
*
3636
* ```sh
3737
* npm install -g appium
@@ -43,7 +43,7 @@ const vendorPrefix = {
4343
*
4444
* This helper should be configured in codecept.conf.ts or codecept.conf.js
4545
*
46-
* * `appiumV2`: set this to true if you want to run tests with Appiumv2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
46+
* * `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
4747
* * `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
4848
* * `host`: (default: 'localhost') Appium host
4949
* * `port`: (default: '4723') Appium port
@@ -117,7 +117,7 @@ const vendorPrefix = {
117117
* }
118118
* ```
119119
*
120-
* Example Android App using Appiumv2 on BrowserStack:
120+
* Example Android App using AppiumV2 on BrowserStack:
121121
*
122122
* ```js
123123
* {
@@ -154,7 +154,7 @@ const vendorPrefix = {
154154
* }
155155
* ```
156156
*
157-
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md>
157+
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md>
158158
*
159159
* ## Access From Helpers
160160
*

0 commit comments

Comments
 (0)