Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
pipeline {
agent any

environment {
LT_USERNAME = credentials('LT_USERNAME')
LT_ACCESS_KEY = credentials('LT_ACCESS_KEY')
PATH = "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
}

stages {
stage('Install Dependencies') {
steps {
sh 'npm install'
dir('android-sample') { sh 'npm install' }
dir('ios-sample') { sh 'npm install' }
}
}

stage('Mobile Automation') {
parallel {
stage('Android Suite') {
steps {
dir('android-sample') {
sh 'npx wdio android_ltOptions_w3c/android-app-single-ltOptions-w3c.conf.js --spec ../specs/android-test.js || true'
sh 'npx wdio android_ltOptions_w3c/android-web-single-ltOptions-w3c.conf.js --spec ../specs/android-web-test.js || true'
sh 'npx wdio android-parallel.conf.js --spec ../specs/android-test.js || true'
sh 'npx wdio android-web-parallel.conf.js --spec ../specs/android-web-test.js || true'
}
}
}
stage('iOS Suite') {
steps {
dir('ios-sample') {
sh 'npx wdio ios_ltOptions_w3c/ios-app-single-ltOptions-w3c.conf.js --spec ../specs/ios-test.js || true'
sh 'npx wdio ios_ltOptions_w3c/ios-web-single-ltOptions-w3c.conf.js --spec ../specs/ios-web-test.js || true'
sh 'npx wdio ios-parallel.conf.js --spec ../specs/ios-test.js || true'
sh 'npx wdio ios-web-parallel.conf.js --spec ../specs/ios-web-test.js || true'
}
}
}
}
}
}

post {
always {
archiveArtifacts artifacts: '**/errorShots/*.png', allowEmptyArchive: true
deleteDir()
}
}
}
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ set LT_ACCESS_KEY=YOUR_LAMBDATEST_ACCESS_KEY

### Upload Your Application

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:
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:

**Using App File:**

Expand Down Expand Up @@ -110,7 +110,7 @@ curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" -X POST "https://m

**Tip:**

- 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).
- 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).
- 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.

## Run Your First Test
Expand All @@ -127,7 +127,7 @@ You need to update your capabilities in `*.config.js` files. In this sample proj

<TabItem value="ios-config" label="ios-single.conf.js" default>

```javascript title="ios/ios-single.conf.js"
```javascript
exports.config = {
user: process.env.LT_USERNAME || "YOUR_USERNAME",
key: process.env.LT_ACCESS_KEY || "YOUR_ACCESS_KEY",
Expand Down Expand Up @@ -173,7 +173,7 @@ exports.config = {
</TabItem>
<TabItem value="android-config" label="android-single.conf.js" default>

```javascript title="android/android-single.conf.js"
```javascript
exports.config = {
user: process.env.LT_USERNAME || "YOUR_USERNAME",
key: process.env.LT_ACCESS_KEY || "YOUR_ACCESS_KEY",
Expand Down Expand Up @@ -222,11 +222,12 @@ exports.config = {

**Info Note:**

- You must add the generated **APP_URL** to the `"app"` capability in the config file.
- You can generate capabilities for your test requirements with the help of our inbuilt :link: **[Capabilities Generator tool](https://www.lambdatest.com/capabilities-generator/)**. A more Detailed Capability Guide is available [here :page_facing_up:](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/) .
- You must add the generated __APP_URL__ to the `"app"` capability in the config file.
- You can generate capabilities for your test requirements with the help of our inbuilt :link: __[Capabilities Generator tool](https://www.lambdatest.com/capabilities-generator/)__. A more Detailed Capability Guide is available [here :page_facing_up:](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/) .

## Executing The Tests
**Step-5:** To Run Android Test

**Step-5:** To Run Android Test

```bash
cd android-sample
Expand All @@ -242,25 +243,36 @@ npm i

**Single:**

- *MacOS/Linux*/Windows*
- *MacOS/Linux*/Windows*

```bash
npm run SingleAndroidApp
```

**Parallel:**

- *MacOS/Linux*/Windows*
- *MacOS/Linux*/Windows*

```bash
npm run parallel
```

__Info:__ 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/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-webdriverio).

**Info:** 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/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-webdriverio).
```bash
To run single web Test on android Device: npm run SingleAndroidWeb
```

```bash
To run Parallel web Test on android devices: npm run parallelWeb
```

## Additional Links

```bash

```

- [Advanced Configuration for Capabilities](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/)
- [How to test locally hosted apps](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/)
- [How to integrate LambdaTest with CI/CD](https://www.lambdatest.com/support/docs/integrations-with-ci-cd-tools/)
Expand Down Expand Up @@ -304,5 +316,5 @@ To stay updated with the latest features and product add-ons, visit [Changelog](

## We are here to help you :headphones:

- Got a query? we are available 24x7 to help. [Contact Us](mailto:support@lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-webdriverio)
- Got a query? we are available 24x7 to help. [Contact Us](mailto:support@lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-webdriverio)
- For more info, visit - [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-webdriverio)
51 changes: 27 additions & 24 deletions android-sample/android-parallel.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,38 @@ exports.config = {
key: process.env.LT_ACCESS_KEY || "YOUR_ACCESS_KEY",

updateJob: false,
specs: ["./../specs/android-test.js"],
specs: ["../specs/android-test.js"],
exclude: [],

commonCapabilities: {
build: "LT_Appium_NodeJS_WebDriverIO_App_Automation",
name: "Sample Parallel Test - WebDriverIO",
isRealMobile: true,
devicelog: true,
visual: true,
},
maxInstances: 10,

capabilities: [
{
platformName: "Android",
deviceName: ".*",
name: "Sample Parallel Test - WebDriverIO",
app: process.env.LT_APP_ID||"lt://proverbial-android",
"platformName": "Android",
"lt:options": {
deviceName: "Galaxy S22.*",
platformVersion: "12",
name: "Parallel Test - Device 1",
isRealMobile: true,
build: "LT_Appium_NodeJS_WebDriverIO_Parallel_Automation",
app: process.env.LT_APP_ID || "lt://proverbial-android",
devicelog: true,
visual: true,
}
},
{
platformName: "Android",
deviceName: ".*",
name: "Sample Parallel Test - WebDriverIO",
app: process.env.LT_APP_ID||"lt://proverbial-android",
},
"platformName": "Android",
"lt:options": {
deviceName: "Pixel 6.*",
platformVersion: "12",
name: "Parallel Test - Device 2",
isRealMobile: true,
build: "LT_Appium_NodeJS_WebDriverIO_Parallel_Automation",
app: process.env.LT_APP_ID || "lt://proverbial-android",
devicelog: true,
visual: true,
}
}
],

logLevel: "info",
Expand All @@ -37,17 +45,12 @@ exports.config = {
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
path: "/wd/hub",
hostname: process.env.LT_GRID_URL||"mobile-hub.lambdatest.com",
hostname: process.env.LT_GRID_URL || "mobile-hub.lambdatest.com",
port: 80,

framework: "mocha",
mochaOpts: {
ui: "bdd",
timeout: 20000,
},
};

exports.config.capabilities.forEach(function (caps) {
for (var i in exports.config.commonCapabilities)
caps[i] = caps[i] || exports.config.commonCapabilities[i];
});
};
47 changes: 25 additions & 22 deletions android-sample/android-web-parallel.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,35 @@ exports.config = {
key: process.env.LT_ACCESS_KEY || "YOUR_ACCESS_KEY",

updateJob: false,
specs: ["./../specs/android-web-test.js"],
specs: ["../specs/android-web-test.js"],
exclude: [],

commonCapabilities: {
build: "LT_Appium_NodeJS_WebDriverIO_Web_Automation",
name: "Sample Parallel Test - WebDriverIO",
isRealMobile: true,
visual: true,
},

maxInstances: 10,

capabilities: [
{
platformName: "Android",
deviceName: ".*",
name: "Sample Parallel Test - WebDriverIO",
"platformName": "Android",
"lt:options": {
deviceName: "Galaxy S22.*",
platformVersion: "12",
name: "Parallel Web Test - Device 1",
isRealMobile: true,
build: "LT_Appium_Web_Parallel_Automation",
visual: true,
w3c: true,
}
},
{
platformName: "Android",
deviceName: ".*",
name: "Sample Parallel Test - WebDriverIO",
"platformName": "Android",
"lt:options": {
deviceName: "Pixel 7.*",
platformVersion: "13",
name: "Parallel Web Test - Device 2",
isRealMobile: true,
build: "LT_Appium_Web_Parallel_Automation",
visual: true,
w3c: true,
}
},
],

Expand All @@ -34,18 +43,12 @@ exports.config = {
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
path: "/wd/hub",
hostname: process.env.LT_GRID_URL||"mobile-hub.lambdatest.com",
hostname: "mobile-hub.lambdatest.com",
port: 80,

framework: "mocha",
mochaOpts: {
ui: "bdd",
timeout: 20000,
},
};

exports.config.capabilities.forEach(function (caps) {
for (var i in exports.config.commonCapabilities)
caps[i] = caps[i] || exports.config.commonCapabilities[i];
});

};
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ exports.config = {
key: process.env.LT_ACCESS_KEY || "YOUR_ACCESS_KEY",

updateJob: false,
specs: ["./../specs/android-test.js"],
specs: ["../../specs/android-test.js"],
exclude: [],

commonCapabilities: {
build: "LT_Appium_NodeJS_WebDriverIO_ltoptions_w3_App_Automation",
devicelog: true,
visual: true,
},

capabilities: [
{
"platformName": "Android",
"lt:options": {
deviceName: ".*",
platformVersion: "13",
name: "android_ltOptions",
isRealMobile: true,
app: process.env.LT_APP_ID||"lt://proverbial-android",
platformName: "Android",
app: process.env.LT_APP_ID || "lt://proverbial-android",
build: "LT_Appium_NodeJS_WebDriverIO_ltoptions_w3_App_Automation",
devicelog: true,
visual: true,
enableCustomTranslation: true,
}
},
Expand All @@ -33,18 +31,12 @@ exports.config = {
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
path: "/wd/hub",
hostname: process.env.LT_GRID_URL||"mobile-hub.lambdatest.com",
hostname: process.env.LT_GRID_URL || "mobile-hub.lambdatest.com",
port: 80,

framework: "mocha",
mochaOpts: {
ui: "bdd",
timeout: 20000,
},
};

exports.config.capabilities.forEach(function (caps) {
for (var i in exports.config.commonCapabilities)
caps[i] = caps[i] || exports.config.commonCapabilities[i];
});

};
Loading