Automate Testing of WaveMaker Mobile Apps Using Appium
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.
WaveMaker mobile applications are hybrid mobile applications and can be easily tested using Appium. This document outlines the steps to configure mobile automation testing for React Native applications using Appium, Android Studio, and WebdriverIO.
Prerequisites
Ensure the following tools are installed and properly configured on your system before proceeding.
1 Node.js and npm
Install Node.js (v16 or higher is recommended), which comes with npm.
Download: https://nodejs.org/
2 Java JDK
Install Java Development Kit (JDK) -- version 11 or above.
Download: https://www.oracle.com/java/technologies/javase-downloads.html
3 Android Studio
Install Android Studio to get the Android SDK and emulator tools.
- Ensure ANDROID_HOME environment variable is set.
- Add the following paths to your environment variables:
Download: https://developer.android.com/studio
Note: Ensure you install the required SDK Platform Tools and emulator images from SDK Manager.
4 Appium
Install Appium globally using npm
Verify installation
You can also use the Appium Desktop for GUI interaction : Download: https://github.com/appium/appium-desktop
5 WebdriverIO CLI
Install WebdriverIO CLI globally
Create your project and run the configuration wizard
During setup, it will ask to choose options for multiple parameters. Here are some of the important parameters you have to choose:
- Test Framework: Mocha or Jasmine
- Reporter: spec
- Services: appium
- Path: /wd/hub
- Test Framework: Mocha or Jasmine
- Reporter: spec
- Services: appium
- Path: /wd/hub
Project Setup
- Initialize your test project (if not already)
- Install required dependencies
- Add test specs
Create your test file in ./test/specs/example.e2e.js
Sample WebdriverIO Configuration
Below is a sample wdio.conf.js
for Android:
Running the Tests
- Start the Android emulator from Android Studio or the CLI.
- Start Appium server
- Run the WebdriverIO test.
Quick Example
TestCase
This Test will attempt to log in to 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 the Android Studio emulator.
- Launch the Appium Inspector, and switch to uiautomatorviewer in the Appium Inspector.
- Obtain the AccessibilityIDs of Username, Password, and Log in button as shown in the above image.
Sample Automation Framework
We have created a sample automation framework to execute a single testcase. All you have to do is,
- Get the setup ready.
- Generate apk of an application.
- Clone or Download the zip from this repository. Appium test framework
- If downloaded, extract and start writing a testcase using the above mentioned process and execute it.