diff --git a/docs/helpers/Appium.md b/docs/helpers/Appium.md index 16eb79e8a..ecb62a558 100644 --- a/docs/helpers/Appium.md +++ b/docs/helpers/Appium.md @@ -4,7 +4,7 @@ **Extends Webdriver** -Appium helper extends [Webriver][1] helper. +Appium helper extends [Webdriver][1] helper. It supports all browser methods and also includes special methods for mobile apps testing. You can use this helper to test Web on desktop and mobile devices and mobile apps. @@ -25,7 +25,7 @@ Launch the daemon: `appium` This helper should be configured in codecept.conf.ts or codecept.conf.js -- `appiumV2`: set this to true if you want to run tests with Appiumv2. See more how to setup [here][3] +- `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here][3] - `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 - `host`: (default: 'localhost') Appium host - `port`: (default: '4723') Appium port @@ -99,7 +99,7 @@ helpers: { } ``` -Example Android App using Appiumv2 on BrowserStack: +Example Android App using AppiumV2 on BrowserStack: ```js { @@ -136,7 +136,7 @@ helpers: { } ``` -Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][4] +Additional configuration params can be used from [https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md][4] ## Access From Helpers @@ -1321,11 +1321,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal'); [1]: http://codecept.io/helpers/WebDriver/ -[2]: http://appium.io/ +[2]: https://appium.io/docs/en/2.1/ [3]: https://codecept.io/mobile/#setting-up -[4]: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md +[4]: https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String diff --git a/docs/mobile.md b/docs/mobile.md index 2f127e794..5f940d3d5 100644 --- a/docs/mobile.md +++ b/docs/mobile.md @@ -24,13 +24,13 @@ I.seeElement({ }); ``` -This test is easy to read and write. Also it will work both on iOS and Android devices. +This test is easy to read and write. Also, it will work both on iOS and Android devices. Doesn't it sound cool? ## Setting Up Ensure that you have [CodeceptJS installed](https://codecept.io/installation/). -You will also need to install [Appium](https://appium.io/). +You will also need to install [Appium](https://appium.io/docs/en/2.1/). We suggest to use [appium-doctor](https://www.npmjs.com/package/appium-doctor) to check if your system is ready for mobile testing. ```sh @@ -45,13 +45,12 @@ To install Appium use npm: npm i -g appium ``` -To use Appium 2.x: -```sh -npm i -g appium@next -``` -Appium 2x (still beta) reenvisions Appium as a platform where “drivers” and “plugins” can be easily created and shared independently. +Appium 2x reenvisions Appium as a platform where “drivers” and “plugins” can be easily created and shared independently. + +** Note: ** Appium v1 is no longer maintained, so it's advised to migrate to Appium v2. + Install an Appium driver and its dependencies -To install the Appium driver and its dependencies, we'll be using the uiautomator2 (Android), XCUITest (iOS) drivers. +To install the Appium driver and its dependencies, we'll be using the `uiautomator2` (Android), `XCUITest` (iOS) drivers. ``` appium driver install xcuitest @@ -79,11 +78,6 @@ It should be packed into apk (for Android) or .ipa (for iOS) or zip. Next, is to launch the emulator or connect a physical device. Once they are prepared, launch Appium: -```sh -appium -``` - -To use Appium 2.x: ```sh tth~$npx appium --base-path=/wd/hub [Appium] Welcome to Appium v2.0.0-beta.57 (REV 3e675c32ae71dc0b00749d5d29213e2ea5b53c5b) @@ -102,7 +96,9 @@ tth~$npx appium --base-path=/wd/hub [Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use. ``` -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. +** 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. + +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. CodeceptJS should be installed with webdriverio support: @@ -135,7 +131,7 @@ You will also be asked for the platform and the application package. ``` Check the newly created `codecept.conf.js` configuration file. -You may want to set some additional Appium settings via [desiredCapabilities](https://appium.io/docs/en/writing-running-appium/caps/) +You may want to set some additional Appium settings via [desiredCapabilities](https://appium.io/docs/en/2.1/guides/caps/) ```js helpers: { @@ -147,7 +143,7 @@ helpers: { } ``` -Once you configured Appium, create the first test by running +Once you configured Appium, create the first test by running: ```sh npx codeceptjs gt @@ -219,7 +215,7 @@ To start writing a test it is important to understand how to locate elements for In both Android and iPhone elements are defined in XML format and can be searched by XPath locators. ```js -I.seeElement('//android.widget.ScrollView/android.widget.LinearLayout')' +I.seeElement('//android.widget.ScrollView/android.widget.LinearLayout') ``` > 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'); ``` Elements can also have ids, which can be located with `#` prefix. -On Android it it is important to keep full package name in id locator: +On Android, it is important to keep full package name in id locator: ```js I.seeElement('#io.selendroid.testapp:id/inputUsername'); @@ -258,9 +254,9 @@ I.click('Click me!'); Native iOS/Android locators can be used with `android=` and `ios=` prefixes. [Learn more](https://webdriver.io/guide/usage/selectors.html#Mobile-Selectors). -But how to get all those locators? We recommend to use [Appium Inspector](https://github.com/appium/appium-desktop). +But how to get all those locators? We recommend to use [Appium Inspector](https://github.com/appium/appium-inspector). -For Android you can use **UI Automator Viewer** bundled with Android SDK: +For Android, you can use **UI Automator Viewer** bundled with Android SDK: ![](https://user-images.githubusercontent.com/220264/27566310-1f631604-5aed-11e7-8b92-1ffe9e9f14f9.png) @@ -284,7 +280,7 @@ Inside WebView all browser features are enabled: CSS locators, JavaScript, etc. To set a specific context use `{ web: 'webview.context' }` instead: ```js -within({webview: 'MyWEBVIEW_com.my.app'}, () => ); +within({webview: 'MyWEBVIEW_com.my.app'}, () => {}); ``` Alternatively use `switchToWeb` or `switchToNative` methods to switch between contexts. diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index 55c467f5f..bfc25deea 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -22,7 +22,7 @@ const vendorPrefix = { }; /** - * Appium helper extends [Webriver](http://codecept.io/helpers/WebDriver/) helper. + * Appium helper extends [Webdriver](http://codecept.io/helpers/WebDriver/) helper. * It supports all browser methods and also includes special methods for mobile apps testing. * You can use this helper to test Web on desktop and mobile devices and mobile apps. * @@ -31,7 +31,7 @@ const vendorPrefix = { * Appium is an open source test automation framework for use with native, hybrid and mobile web apps that implements the WebDriver protocol. * It allows you to run Selenium tests on mobile devices and also test native, hybrid and mobile web apps. * - * Download and install [Appium](http://appium.io/) + * Download and install [Appium](https://appium.io/docs/en/2.1/) * * ```sh * npm install -g appium @@ -43,7 +43,7 @@ const vendorPrefix = { * * This helper should be configured in codecept.conf.ts or codecept.conf.js * - * * `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) + * * `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) * * `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 * * `host`: (default: 'localhost') Appium host * * `port`: (default: '4723') Appium port @@ -117,7 +117,7 @@ const vendorPrefix = { * } * ``` * - * Example Android App using Appiumv2 on BrowserStack: + * Example Android App using AppiumV2 on BrowserStack: * * ```js * { @@ -154,7 +154,7 @@ const vendorPrefix = { * } * ``` * - * Additional configuration params can be used from + * Additional configuration params can be used from * * ## Access From Helpers *