Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Experitest cloud platform lets you execute Appium tests on remotely located devices. If you have existing Appium tests written in javascript that you have been running locally, or if you want to start testing using javascript and Node.js then you've come to the right place. This page discusses how to prepare and execute Appium tests using javascript and Node.js.

You could make use of our sample tests in our git repository by forking it or using the sample tests below.

SEO Metadata
titleJavascript

This page discusses how to prepare and execute Appium tests using javascript and Node.js.

Info
titleSet Experitest Url

Please make sure you replace <EXPERITEST_URL> with appropriate URL in the sample tests below.

Code Block
languagejs
titleAndroid App Testing using Javascript
collapsetrue
"use strict";
var webdriverio = require('webdriverio');
 
function main() {
 
  let options = {
    host: 'cloud.seetest.io',
    protocol: 'https',
    port: 443,
    path: '', 
    desiredCapabilities: {
        accessKey: "<ACCESS_KEY>",
        platformName: 'android',
        //udid: "<UDID OF SPECIFIC DEVICE>", optional
        app: "http://d242m5chux1g9j.cloudfront.net/eribank.apk", // if you have the app in your project you can do cloud:com.pacakge.name
        appPackage: "com.experitest.ExperiBank",
        appActivity: ".LoginActivity",
        testName: "Javascript Android App Test"
      }
  };
 
  webdriverio
    .remote(options)
    .init()
    .setValue("//*[@id='usernameTextField']", "company")
    .setValue("//*[@id='passwordTextField']", "company")
    .click("//*[@id='loginButton']")
    .click("//*[@id='makePaymentButton']")
    .setValue("//*[@id='phoneTextField']", "123456")
    .setValue("//*[@id='nameTextField']", "Test")
    .setValue("//*[@id='amountTextField']", "10")
    .setValue("//*[@id='countryTextField']", "US")
    .click("//*[@id='sendPaymentButton']")
    .click("//*[@id='button1']")
    .click("//*[@id='logoutButton']")
    .end()
    .catch(function (err) {
        console.log(err);
    });
  }
 
main();
Code Block
languagejs
titleIOS App Testing using Javascript
collapsetrue
"use strict";
var webdriverio = require('webdriverio');
 
function main() {
 
  let options = {
    host: 'cloud.seetest.io',
    protocol: 'https',
    port: 443,
    path: '', 
    desiredCapabilities: {
        accessKey: "<ACCESS_KEY>",
        platformName: 'ios',
        //udid: "<UDID OF SPECIFIC DEVICE>", optional
        app: "http://d242m5chux1g9j.cloudfront.net/EriBank.ipa", // if you have the app in your project you can do cloud:com.pacakge.name
        bundleId: "com.experitest.ExperiBank", // would be appPackage and appActivity for Android
        testName: "Javascript iOS App Test"
      }
  };
 
  webdriverio
    .remote(options)
    .init()
    .setValue("//*[@id='usernameTextField']", "company")
    .setValue("//*[@id='passwordTextField']", "company")
    .click("//*[@id='loginButton']")
    .click("//*[@id='makePaymentButton']")
    .setValue("//*[@id='phoneTextField']", "123456")
    .setValue("//*[@id='nameTextField']", "Test")
    .setValue("//*[@id='amountTextField']", "10")
    .setValue("//*[@id='countryTextField']", "US")
    .click("//*[@id='sendPaymentButton']")
    .click("//*[@id='Yes']")
    .click("//*[@id='logoutButton']")
    .end()
    .catch(function (err) {
        console.log(err);
    });
  }
 
main();
Code Block
languagejs
titleChrome on Android Test using JavaJavascript
collapsetrue
"use strict";
var webdriverio = require('webdriverio');
 
function main() {
 
  let options = {
    host: 'cloud.seetest.io',
    protocol: 'https',
    port: 443,
    path: '', 
    desiredCapabilities: {
        accessKey: "<ACCESS_KEY>",
        platformName: 'iosandroid',
        //udid: "<UDID OF SPECIFIC DEVICE>", optionalbrowserName: 'chrome',
         app: "http://d242m5chux1g9j.cloudfront.net/EriBank.ipa", // if you have the app in your project you can do cloud:com.pacakge.name
        bundleId: "com.experitest.ExperiBank", // would be appPackage and appActivity for Android//udid: "<UDID OF SPECIFIC DEVICE>", optional
          testName: "Javascript iOSAndroid AppWeb Test"
      }
  };
 
  webdriverio
    .remote(options)
    .init()
    .setValueurl("https://*[@id='usernameTextField']", "company"ebay.com")
    .setValue("//*[@id='passwordTextFieldkw']", "companyiPhone")
    .click("//*[@id='loginButtonghs-submit']")
    .click("//*[@id='makePaymentButton']"pause(2000)
    .setValue("//*[@id='phoneTextField']", "123456")
    .setValue("//*[@id='nameTextField']", "Test")getTitle().then(function(title){
    .setValue("//*[@id='amountTextField']", "10")
    .setValue("//*[@id='countryTextField']", "US")
    .click("//*[@id='sendPaymentButton']")
    .click("//*[@id='Yes']")
    .click("//*[@id='logoutButton']" console.log("The title of the page is: ", title);
    })
    .end()
    .catch(function (err) {
        console.log(err);
    });
  }
 
main();
Code Block
languagejs
titleSafari on IOS Test using JavaJavascript
collapsetrue
"use strict";
var webdriverio = require('webdriverio');
 
function main() {
 
  let options = {
    host: 'cloud.seetest.io',
    protocol: 'https',
    port: 443,
    path: '', 
    desiredCapabilities: {
        accessKey: "<ACCESS_KEY>",
        platformName: 'androidios',
        browsermName: 'chrome',//udid: "<UDID OF SPECIFIC DEVICE>", optional
         //udid: "<UDID OF SPECIFIC DEVICE>", optionalapp: "http://d242m5chux1g9j.cloudfront.net/EriBank.ipa", // if you have the app in your project you can do cloud:com.pacakge.name
        bundleId: "com.experitest.ExperiBank", // would be appPackage and appActivity for Android
        testName: "Javascript AndroidiOS WebApp Test"
      }
  };
 
  webdriverio
    .remote(options)
    .init()
    .urlsetValue("https://ebay.com*[@id='usernameTextField']", "company")
    .setValue("//*[@id='kwpasswordTextField']", "iPhonecompany")
    .click("//*[@id='ghs-submitloginButton']")
    .pause(2000click("//*[@id='makePaymentButton']")
    .getTitle().then(function(title){
 setValue("//*[@id='phoneTextField']", "123456")
    .setValue("//*[@id='nameTextField']", "Test")
    .setValue("//*[@id='amountTextField']", "10")
    console.log("The title of the page is: ", title);
    }setValue("//*[@id='countryTextField']", "US")
    .click("//*[@id='sendPaymentButton']")
    .click("//*[@id='Yes']")
    .click("//*[@id='logoutButton']")
    .end()
    .catch(function (err) {
        console.log(err);
    });
  }
 
main();





Prerequisites

There are a few things you need to do first before you can start running Appium tests using javascript and Node.js.

  1. Install the latest Node.js.
  2. Install webdriver node bindings:

    Code Block
    languagebash
    themeRDark
    npm install --save webdriverio
  3. Upload your App and get your cloud access key.

    Note
    iconfalse

    Before you proceed with fetching the sample tests, you will have to do two more things, very simple but important ones:

    1. Upload your app to your project
    2. Fetch your access key


Let's make this quick and easy

Now that you are all set, you can start your testing.

  1. Find the sample test in our git repository.
  2. Fork the repository.
  3. Edit the test and hit Run. Enjoy!