Appium is an open source tools that help you drive your mobile apps(native, hybrid, and mobile web). At a high-level appium works on client-server architecture. Appium server is Node JS based web server that exposes REST APIs and bridges command to native frameworks.
The aim of the repo is to demonstrate features of Nightwatch which will be useful for writing testcases for mobile devices.
- To run tests locally on mobile devices we need to download and setup Appium.
- Now that you have installed Appium, run the appium server using command:
$ appium
- clone the repository:
$ git clone
- Install the dependencies
$ npm install
- To run on Lambdatest
Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest. To obtain your access credentials, purchase a plan or access the Automation Dashboard.
Set LambdaTest Username
and Access Key
in environment variables.
For Linux/macOS:
export LT_USERNAME="YOUR_LAMBDATEST_USERNAME" \
export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
For Windows:
set LT_USERNAME="YOUR_LAMBDATEST_USERNAME" `
set LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
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:
Linux/macOS:
curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" \
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
--form 'name="Android_App"' \
--form 'appFile=@"/Users/macuser/Downloads/proverbial_android.apk"'
Windows:
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""
Using App URL:
Linux/macOS:
curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" \
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
--form 'name="Android_App"' \
--form 'url="https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk"'
Windows:
curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -d "{"url":"https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk","name":"sample.apk"}"
Tip:
- If you do not have any .apk or .ipa file, you can run your sample tests on LambdaTest by using our sample ๐ Android app or sample ๐ iOS app.
- 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.
We can add in a test setting in nightwatch config for appium server and then can extend for various desired target-devices/desired-capabilites(https://www.lambdatest.com/capabilities-generator/ ) to run on:
'appium': {
selenium: {
host: 'mobile-hub.lambdatest.com/wd/hub',
port: 80
},
desiredCapabilities: {
'lt:options': {
username: '${LT_USERNAME}',
accessKey: '${LT__ACCESS_KEY}'
}
},
disable_error_log: true,
webdriver: {
timeout_options: {
timeout: 150000,
retry_attempts: 3
},
keep_alive: true,
start_process: false
}
},
'appium.ios13': {
extends: 'appium',
desiredCapabilities: {
// browserName: 'Safari',
javascriptEnabled: true,
platformName: 'ios',
platformVersion: '15.0',
deviceName: 'iPhone 13',
isRealMobile: true,
user: '${LT_USERNAME}',
accessKey: '${LT__ACCESS_KEY}',
app: "lt://APP10160621161658226142499826" // path for the ios app you want to test
}
},
- Run the test
$ npm test