WaveMaker Docs

WaveMaker Docs

  • Get started
  • Widgets
  • Mobile
  • How-to
  • Enterprise
  • Releases
  • Blog
  • Sign-in

›Developer options

Getting started

  • Introduction
  • Walkthrough

Pages

  • Pages Overview
  • Creating a Page
  • Layout and Styles

    • Page Layout
    • Templates
    • Themes
    • Accessibility

    Page Configure

    • Page Artefacts
    • Page Cache
    • Partial Page
    • Page Parameters
    • Examples

    Page Actions

    • Navigation
    • Events

    Custom Development

    • Theme Editor
    • Manual Theme
    • Create Template

SSPA

  • Micro Frontend App

Databases

  • Database Services Overview
  • Database Tools
  • Database Designing

    • Working with Databases
    • Data Modelling
    • DataBase Schema Modes
    • Working with DB Schema
    • Database Views
    • Temporal Support

    Accessing Database

    • Accessing Database

    Queries and Procedures

    • Working with Queries
    • Working with Stored Procedures
    • Version Queries & Procedures
    • Blob Queries and Procedures
    • Queries & Procedures - Java Services

    Database Variables & API

    • Database CRUD
    • CRUD Event Listeners
    • Database APIs
    • Database Service APIs

REST & SOAP

  • Web Services Overview
  • Restful

    • REST Services
    • Secure Server-side Properties
    • REST Request Timeouts
    • REST Services using OAuth 2.0

    SOAP

    • Working with SOAP Services
    • Imported SOAP APIs

    Websocket

    • Working with WebSockets

    APIs

    • API Designer
    • Mocking APIs
    • Mocking REST API
    • Swagger Import

    Variables

    • CRUD Variable
    • Service Variable
    • WebSocket Variable

Java Services

  • Java Service
  • Java Services

    • Java Integration Services
    • DB Service Integration
    • API Composition
    • Variables for Invocation
    • Generated REST APIs (API Designer)

    Java Services Variables & API

    • Variable for Java Service
    • Java Service APIs

    Source Files

    • Resources and Third-party Libraries
    • Using 3rd party JavaScript files
    • Using 3rd party jar files

Variables & Actions

    Variables

    • Variables Overview
    • Model Variable
    • Device Variables

    Binding

    • Variable Binding
    • Custom Formatter

    Actions

    • Actions
    • Navigation Action
    • Login Action
    • Logout Action
    • Timer Action
    • Notification Action

    Events

    • Events
    • JavaScript Access

Security

    App Security

    • Overview
    • Authentication
    • Authorization
    • Access Levels & Permissions
    • Login Configuration
    • Session Persistence
    • SSL Encryption
    • XSS antisamy policy configuration
    • OWASP
    • XSS Prevention
    • Central Authentication System
    • Token Based Authentication
    • SAML Integration
    • Secure Connection for Deployed Apps
    • Concurrent Sessions
    • HostHeader Injection

    Security Variable and API

    • Security Variables
    • Remember Me
    • Variable for Security Service
    • Security Service APIs

Developer options

  • Test and Run (Preview) Apps
  • Chrome Extension: Devtool
  • Debugging
  • Inspection Framework
  • Build Options
  • WaveMaker Mobile Apps Automation
  • Developer Integration

    • Project User Management
    • Developer Collaboration
    • Extending the Application using IDEs
    • Import, Export & Update Apps
    • Project Shells

    Add-ons

    • Localization
    • Artifacts Repository

Deployment

  • Overview
  • Deployment Profile
  • One-click Deployment
  • WaveMaker CI/CD Pipeline

    • Overview
    • Configuration Profiles
    • Configuration Management
    • Pipelines and Phases

    Pipeline Configuration

    • Default Pipelines in WMO
    • Configure Pipeline in WME

    Deploy to Cloud Providers

    • AWS
    • Azure
    • Google Cloud
    • DigitalOcean

    Pipeline Configuration cont.

    • Phase configurations
    • Webhooks Integration
    • Tests Integration

    Manage Deployed Apps

    • Manage Deployed Apps

    Integrate with your CI/CD Providers

    • Push Code to External repo
    • Custom VCS Integration
    • Export WaveMaker Application
    • Building Project with Maven
    • Build with Docker
    • Jenkins Integration
    • Deploy using Docker Compose
    • Deployment to Heroku

    WaveMaker apps Interation with CDN

    • App Integration with AWS CDN
    • App Integration with Azure CDN

    Deployment to external web servers

    • Application Server Overview
    • Deploy to Tomcat
    • WebSphere
    • JBoss - WildFly
    • WebLogic Server

Connectors

  • Introduction
  • Architecture
  • Import Connectors
  • List of Connectors
  • Build a New Connector

Teams

  • Overview
  • Team Setup
  • Dashboard
  • Manage Users
  • Manage Projects
  • Manage Prefabs
  • Project Branches
  • Manage Roles
  • Code Repository
  • Import VCS Project
  • Team Profile
  • Manage Subscription
  • FAQs
Edit

Automate testing of WaveMaker mobile apps using Appium


How to use Appium to automate testing of WaveMaker mobile app

Introduction

Appium is an open-source tool for automating testing of native, mobile web, and hybrid applications on iOS mobile, Android mobile, and Windows desktop platforms.

  • Native apps are those written using the iOS, Android, or Windows SDKs.
  • Mobile web apps are web apps accessed using a mobile browser (Appium supports Safari on iOS and Chrome or the built-in 'Browser' app on Android).
  • Hybrid apps have a wrapper around a "webview" -- a native control that enables interaction with web content. Projects like Apache Cordova make it easy to build apps using web technologies that are then bundled into a native wrapper, creating a hybrid app.

WaveMaker mobile applications are hybrid mobile applications and can be easily tested using Appium. This How-To document explains how to do this.

Generate APK of the WM mobile application.

We can generate APK of the WM application by following any of the options mentioned below.

  1. Build for Android or
  2. Export cordova zip and perform manual build.

Refer documentation for more details.

Choosing locators for WM apps.

An appium driver has two contexts to choose locators.

Native_APP : This is the driver context where we choose locators from uiautomatorviewer tool.

WebView : This is another driver context where we choose locators from mobile debug browser.

For the WM applications, if we choose uiautomatorviewer widget-id will be randomly changed on every execution of a certain test case and hence it will be better to switch context of the driver from Native_App to WebView. Using the WebView context, the best approach to choose locators are by its name, class name or any other unique selectors which will not change on every test script execution.

Here is the example how to choose locators for a sample application built in WaveMaker.

TestCase : Test will attempt to login into the application. We need to fill in the Username & Password and click on the Login button. We will verify if the Login is successful.

  • Launch the application in emulator and navigate to chrome://inspect/#devices from chrome browser and open the remote debugging window of the launched application.

Get the locators of the Username, Password, Login button and verify login locators. i.e.,


By userNameTxt = By.xpath("//*[@name='userNameField']//input");
By passwordTxt = By.xpath("//*[@name='passwordField']//input");
By loginButton = By.xpath("//*[@name='loginButton']");
By labellocator = By.xpath("//label[text() = 'LoggedIn as Admin']");

Register appium driver by providing required desired capabilities as shown below.

@BeforeMethod
public void setup() throws MalformedURLException, UnexpectedException {
   DesiredCapabilities capabilities = new DesiredCapabilities();
   capabilities.setCapability("app", appLocation);
   capabilities.setCapability("appPackage", appPackage);
   capabilities.setCapability("appActivity", appActivity);
   capabilities.setCapability("deviceName","Pixel_3_XL_API_28");
   capabilities.setCapability("platformName", "Android");
   capabilities.setCapability("platformVersion", "7.0");
   capabilities.setCapability("udid", "emulator-5554");
   capabilities.setCapability("autoGrantPermissions", true);
   capabilities.setCapability("showChromedriverLog", true);
   capabilities.setCapability("browserName", "");
   capabilities.setCapability("uiautomator2ServerLaunchTimeout", "50000");
   capabilities.setCapability("--session-override", true);
   capabilities.setCapability("noRest", true);

   driver = new AppiumDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
   wait = new WebDriverWait(driver, 1000);
}
note

In the above snippet, capability ‘app’ is the location of the app, ‘appPackage’ is the applicationId and ‘appActivity’ is used to launch the application in the emulator.

We can get appPackage and appActivity values by executing following commands in terminal,

  1. adb shell
  2. dumpsys window windows | grep -E ‘mCurrentFocus’

Switch the context of the driver from Native_APP to WEBVIEW.

As we are using web inspector locators, switching to WebView context.

driver.context("WEBVIEW_" + appPackage);

Prepare your test scripts to execute test cases.

Link for Reference: https://www.swtestacademy.com/appium-tutorial/

Last updated on 8/21/2020 by Prashant Reddy
← Build OptionsProject User Management →
  • Introduction
  • Generate APK of the WM mobile application.
  • Choosing locators for WM apps.
  • Register appium driver by providing required desired capabilities as shown below.
  • Switch the context of the driver from Native_APP to WEBVIEW.
  • Prepare your test scripts to execute test cases.
WaveMaker
  • PRICING
  • PARTNERS
  • CUSTOMERS
  • ABOUT US
  • CONTACT US
Terms of Use | Copyright © 2013-2023 WaveMaker, Inc. All rights reserved.