Coder Social home page Coder Social logo

appium-nightwatch-examples's Introduction

Apppium-Nightwatch-Examples

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.

Overview

The aim of the repo is to demonstrate features of Nightwatch which will be useful for writing testcases for mobile devices.

Demo

iPhone Nightwatch Session

Setup

  1. To run tests locally on mobile devices we need to download and setup Appium.
  2. Now that you have installed Appium, run the appium server using command:
$ appium
  1. clone the repository:
$ git clone 
  1. Install the dependencies
$ npm install
  1. To run on Lambdatest

Setting Up Your Authentication

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

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.

Configuration

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
      }
    },
  1. Run the test
$ npm test

appium-nightwatch-examples's People

Contributors

gravityvi avatar lambdapro avatar

Forkers

abidkidwai786

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.