├── Android.js ├── IOS.js └── README.md /Android.js: -------------------------------------------------------------------------------- 1 | var wd = require("wd") 2 | var assert = require("assert"); 3 | var asserter = wd.asserters; 4 | 5 | username = (process.env.LT_USERNAME == undefined) ? "username" //Enter the username here 6 | : process.env.LT_USERNAME 7 | accesskey = (process.env.LT_ACCESS_KEY == undefined) ? "access_key" //Enter the access_key here 8 | : process.env.LT_ACCESS_KEY 9 | 10 | desired_capabilities = { 11 | 'deviceName':'Galaxy S20', 12 | 'platformVersion':'11', 13 | 'platformName':'android', 14 | 'isRealMobile':true, 15 | 'app':'lt://', //Enter the app_url here 16 | 'visual':true, 17 | 'video': true, 18 | 19 | // ADD THE APP URL OF OTHER APPS THAT YOU'D LIKE TO INSTALL ON THE SAME DEVICE 20 | 'otherApps':['lt:// ', 'lt:// '] //ENTER THE OTHER APP URLs HERE IN AN ARRAY FORMAT 21 | 22 | } 23 | 24 | driver = wd.promiseRemote(`https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub`) 25 | 26 | async function Androidtest(){ 27 | 28 | try { 29 | 30 | driver.init(desired_capabilities) 31 | .then(function(){ 32 | return driver.waitForElementById('color',10000) 33 | }) 34 | .then(function(colorButton){ 35 | return colorButton.click(); 36 | }) 37 | .then(function(){ 38 | return driver.waitForElementById('Text',10000) 39 | }) 40 | .then(function(text){ 41 | text.click() 42 | return driver.waitForElementById('toast',10000) 43 | }) 44 | .then(function(toast){ 45 | toast.click() 46 | return driver.waitForElementById('notification',10000) 47 | }) 48 | 49 | .then(function(find){ 50 | find.click() 51 | driver.quit() 52 | }) 53 | 54 | } 55 | catch (e) { 56 | driver.quit() 57 | } 58 | } 59 | 60 | Androidtest(); -------------------------------------------------------------------------------- /IOS.js: -------------------------------------------------------------------------------- 1 | var wd = require("wd") 2 | var assert = require("assert"); 3 | var asserter = wd.asserters; 4 | 5 | username = (process.env.LT_USERNAME == undefined) ? "username" //Enter the username here 6 | : process.env.LT_USERNAME 7 | accesskey = (process.env.LT_ACCESS_KEY == undefined) ? "access_key" //Enter the access_key here 8 | : process.env.LT_ACCESS_KEY 9 | 10 | desired_capabilities = { 11 | 'deviceName':'iPhone 12', 12 | 'platformVersion':'14', 13 | 'platformName':'iOS', 14 | 'isRealMobile':true, 15 | 'app':'lt://', //Enter the app_url here 16 | 'visual':true, 17 | 'video': true, 18 | 'build':'NodeJS Vanilla - iOS', 19 | 'name': 'Sample Test - NodeJS', 20 | 21 | // ADD THE APP URL OF OTHER APPS THAT YOU'D LIKE TO INSTALL ON THE SAME DEVICE 22 | 'otherApps':['lt:// ', 'lt:// '] //ENTER THE OTHER APP URLs HERE IN AN ARRAY FORMAT 23 | 24 | } 25 | 26 | driver = wd.promiseRemote(`https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub`) 27 | 28 | async function iOStest(){ 29 | 30 | try { 31 | 32 | driver.init(desired_capabilities) 33 | .then(function(){ 34 | return driver.waitForElementById('color',10000) 35 | }) 36 | .then(function(color){ 37 | return color.click(); 38 | }) 39 | .then(function(){ 40 | return driver.waitForElementById('Text',10000) 41 | }) 42 | .then(function(text){ 43 | text.click() 44 | return driver.waitForElementById('toast',10000) 45 | }) 46 | .then(function(toast){ 47 | toast.click() 48 | return driver.waitForElementById('notification',10000) 49 | }) 50 | .then(function(find){ 51 | find.click() 52 | driver.quit() 53 | }) 54 | } 55 | catch (e) { 56 | driver.quit() 57 | } 58 | } 59 | 60 | iOStest(); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # How to install multiple apps in Real Devices on [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-multipleApps) using the Appium & NodeJS Language 2 | 3 | While performing app automation testing with appium on LambdaTest Grid, you might face a scenario where the APP1 that you are testing needs to interact with a few other applications APP2, APP3. In this scenario, LambdaTest offers an easy way out where you can just [upload your apps](https://www.lambdatest.com/support/docs/appium-java/#upload-your-application) & add them to the multiple apps array. 4 | It becomes extremely convenient now where you can just add those URLs & run your tests with ease. 5 | 6 | # Steps: 7 | 8 | You can add the app URLs fetched by [uploading your apps](https://www.lambdatest.com/support/docs/appium-java/#upload-your-application) in the ```otherApps``` capability. 9 | 10 | Below is the ```Android.js``` example shown: 11 | 12 | ```js 13 | var wd = require("wd") 14 | var assert = require("assert"); 15 | var asserter = wd.asserters; 16 | username = (process.env.LT_USERNAME == undefined) ? "username" //Enter the username here 17 | : process.env.LT_USERNAME 18 | accesskey = (process.env.LT_ACCESS_KEY == undefined) ? "access_key" //Enter the access_key here 19 | : process.env.LT_ACCESS_KEY 20 | desired_capabilities = { 21 | 'deviceName':'Galaxy S20', 22 | 'platformVersion':'11', 23 | 'platformName':'android', 24 | 'isRealMobile':true, 25 | 'app':'lt://', //Enter the app_url here 26 | 'visual':true, 27 | 'video': true, 28 | // ADD THE APP URL OF OTHER APPS THAT YOU'D LIKE TO INSTALL ON THE SAME DEVICE 29 | 'otherApps':['lt:// ', 'lt:// '] //ENTER THE OTHER APP URLs HERE IN AN ARRAY FORMAT 30 | } 31 | driver = wd.promiseRemote(`https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub`) 32 | async function Androidtest(){ 33 | try { 34 | driver.init(desired_capabilities) 35 | .then(function(){ 36 | return driver.waitForElementById('color',10000) 37 | }) 38 | .then(function(colorButton){ 39 | return colorButton.click(); 40 | }) 41 | .then(function(){ 42 | return driver.waitForElementById('Text',10000) 43 | }) 44 | .then(function(text){ 45 | text.click() 46 | return driver.waitForElementById('toast',10000) 47 | }) 48 | .then(function(toast){ 49 | toast.click() 50 | return driver.waitForElementById('notification',10000) 51 | }) 52 | .then(function(find){ 53 | find.click() 54 | driver.quit() 55 | }) 56 | } 57 | catch (e) { 58 | driver.quit() 59 | } 60 | } 61 | Androidtest(); 62 | ``` 63 | 64 | ## Executing The Tests 65 | 66 | 67 | 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. 68 | 69 | Execute the following command to run your test on LambdaTest platform: 70 | 71 | ```bash 72 | node android.js 73 | ``` 74 | 75 | 76 | If you are using an **android** app, the cURL command will generate an app URL for the corresponding Android app and install the same for running the tests. You can either use our sample :link: [Android app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk) or upload your own app as discussed earlier. 77 | 78 | Execute the following command to run your test on LambdaTest platform: 79 | 80 | ```bash 81 | node ios.js 82 | ``` 83 | 84 | 85 | Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on the [LambdaTest App Automation Dashboard](https://appautomation.lambdatest.com/build). 86 | 87 | ## Additional Links 88 | 89 | - [Advanced Configuration for Capabilities](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/) 90 | - [How to test locally hosted apps](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/) 91 | - [How to integrate LambdaTest with CI/CD](https://www.lambdatest.com/support/docs/integrations-with-ci-cd-tools/) 92 | 93 | ## Documentation & Resources :books: 94 | 95 | Visit the following links to learn more about LambdaTest's features, setup and tutorials around test automation, mobile app testing, responsive testing, and manual testing. 96 | 97 | * [LambdaTest Documentation](https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-python) 98 | * [LambdaTest Blog](https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-python) 99 | * [LambdaTest Learning Hub](https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-python) 100 | * [LambdaTest Community](http://community.lambdatest.com/) 101 | 102 | ## LambdaTest Community :busts_in_silhouette: 103 | 104 | The [LambdaTest Community](https://community.lambdatest.com/) allows people to interact with tech enthusiasts. Connect, ask questions, and learn from tech-savvy people. Discuss best practises in web development, testing, and DevOps with professionals from across the globe 🌎 105 | 106 | ## What's New At LambdaTest ❓ 107 | 108 | To stay updated with the latest features and product add-ons, visit [Changelog](https://changelog.lambdatest.com/) 109 | 110 | ## About LambdaTest 111 | 112 | [LambdaTest](https://www.lambdatest.com) is a leading test execution and orchestration platform that is fast, reliable, scalable, and secure. It allows users to run both manual and automated testing of web and mobile apps across 3000+ different browsers, operating systems, and real device combinations. Using LambdaTest, businesses can ensure quicker developer feedback and hence achieve faster go to market. Over 500 enterprises and 1 Million + users across 130+ countries rely on LambdaTest for their testing needs. 113 | 114 | ### Features 115 | 116 | * Run Selenium, Cypress, Puppeteer, Playwright, and Appium automation tests across 3000+ real desktop and mobile environments. 117 | * Real-time cross browser testing on 3000+ environments. 118 | * Test on Real device cloud 119 | * Blazing fast test automation with HyperExecute 120 | * Accelerate testing, shorten job times and get faster feedback on code changes with Test At Scale. 121 | * Smart Visual Regression Testing on cloud 122 | * 120+ third-party integrations with your favorite tool for CI/CD, Project Management, Codeless Automation, and more. 123 | * Automated Screenshot testing across multiple browsers in a single click. 124 | * Local testing of web and mobile apps. 125 | * Online Accessibility Testing across 3000+ desktop and mobile browsers, browser versions, and operating systems. 126 | * Geolocation testing of web and mobile apps across 53+ countries. 127 | * LT Browser - for responsive testing across 50+ pre-installed mobile, tablets, desktop, and laptop viewports 128 | 129 | [](https://accounts.lambdatest.com/register) 130 | 131 | ## We are here to help you :headphones: 132 | 133 | * Got a query? we are available 24x7 to help. [Contact Us](support@lambdatest.com) 134 | * For more info, visit - [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-nodejs-multipleApps) --------------------------------------------------------------------------------