|
1 | 1 | # LT-appium-nodejs-webdriverio |
2 | | -LT-appium-nodejs-webdriverio repo |
| 2 | +Sample repo to run app automation on real device on LambdaTest. |
| 3 | + |
| 4 | +## Pre-requisites |
| 5 | + |
| 6 | +- Download and install **NodeJS**. You should be having **NodeJS v6** or newer. Click [here](https://nodejs.org/en/) to download. |
| 7 | +- Make sure you are using the latest version of **JavaScript**. |
| 8 | +- Install **npm** from the official website by clicking [here](https://www.npmjs.com/). |
| 9 | + |
| 10 | +### Clone The Sample Project |
| 11 | + |
| 12 | +**Step-1:** Clone the LambdaTest’s [LT-appium-nodejs-webdriverio](https://github.com/LambdaTest/LT-appium-nodejs-webdriverio) and navigate to the code directory as shown below: |
| 13 | + |
| 14 | +```bash |
| 15 | +git clone https://github.com/LambdaTest/LT-appium-nodejs-webdriverio |
| 16 | +cd LT-appium-nodejs-webdriverio |
| 17 | +``` |
| 18 | + |
| 19 | +### Setting Up Your Authentication |
| 20 | + |
| 21 | +Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest. To obtain your access credentials, [purchase a plan](https://billing.lambdatest.com/billing/plans) or access the [Automation Dashboard](https://appautomation.lambdatest.com/). |
| 22 | + |
| 23 | +**Step-2:** Set LambdaTest `Username` and `Access Key` in environment variables. |
| 24 | + |
| 25 | +```bash |
| 26 | +export LT_USERNAME="YOUR_LAMBDATEST_USERNAME" |
| 27 | +export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY" |
| 28 | +``` |
| 29 | + |
| 30 | +### Upload Your Application |
| 31 | + |
| 32 | +**Step-3:** Upload your **_iOS_** application (.ipa file) or **_android_** application (.apk file) to the LambdaTest servers using our **REST API**. You need to provide your **Username** and **AccessKey** in the format `Username:AccessKey` in the **cURL** command for authentication. Make sure to add the path of the **appFile** in the cURL request. Here is an example cURL request to upload your app using our REST API: |
| 33 | + |
| 34 | +For Linux / MacOS: |
| 35 | + |
| 36 | +```bash |
| 37 | +curl -u "YOUR_LAMBDATEST_USERNAME":"YOUR_LAMBDATEST_ACCESS_KEY" \ |
| 38 | +--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \ |
| 39 | +--form 'name="Android_App"' \ |
| 40 | +--form 'appFile=@"/Users/macuser/Downloads/proverbial_android.apk"' |
| 41 | +``` |
| 42 | +For Windows: |
| 43 | + |
| 44 | +```bash |
| 45 | +curl -u "YOUR_LAMBDATEST_USERNAME":"YOUR_LAMBDATEST_ACCESS_KEY" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "appFile=@"/Users/macuser/Downloads/proverbial_android.apk"" |
| 46 | +``` |
| 47 | +> Note: |
| 48 | +> - If you do not have any **.apk** or **.ipa** file, you can run your sample tests on LambdaTest by using our sample :link: [Android app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk) or sample :link: [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa). |
| 49 | +> - Response of above cURL will be a **JSON** object containing the `App URL` of the format - <lt://APP123456789123456789> and will be used in the next step. |
| 50 | +
|
| 51 | +### Executing The Tests |
| 52 | + |
| 53 | +If you are using an **iOS** app, the cURL command will generate an app URL for the corresponding iOS app and install the same for running the tests. You can either use our sample :link: [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa) or upload your own app as discussed earlier. |
| 54 | + |
| 55 | +**Step-4:** Navigate to the corresponding directory based on your app. |
| 56 | + |
| 57 | + - For android: |
| 58 | + ```bash |
| 59 | + cd android-sample |
| 60 | + ``` |
| 61 | +- For ios: |
| 62 | + ```bash |
| 63 | + cd ios-sample |
| 64 | + ``` |
| 65 | + |
| 66 | +**Step-5:** Install the required dependencies using the following command: |
| 67 | + |
| 68 | +```bash |
| 69 | +npm i |
| 70 | +``` |
| 71 | + |
| 72 | +**Step-6:** Execute the following command to run your test on LambdaTest platform: |
| 73 | + |
| 74 | +```bash |
| 75 | +npm run single |
| 76 | +``` |
| 77 | +> Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on the :link: [LambdaTest App Automation Dashboard](https://appautomation.lambdatest.com/build). |
| 78 | + |
0 commit comments