• Stars
    star
    141
  • Rank 254,614 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ“± Wrapper Appium Framework in Java which supports Automation of Mobile and Tablet apps.

Wrapper Appium Framework in Java which supports Automation of Mobile and Tablet apps.

Open in Gitpod

Open Source Love Discord CircleCI Bugs Test Coverage Quality Gate Maintainability Reliability Security Vulnurability Duplicate Code Maven Central Github Releases License

πŸ“Ή Demo

πŸš€ Quick Start

  • The documentations of coteafs-appium includes all the information you need to get started including setup, usage, advantages, sample test.
  • Want to know when our next feature or fix release is going to happen? Watch out our planned milestones.

πŸ“Œ Want to know Key Features?

In order to use a framework, it's important to know it's advantages. Let's see what are the key features of this framework:

πŸ‘‰ πŸ“± Supports Android and iOS Real Devices and Emulators.

πŸ‘‰ πŸ’» Able to start and stop the server on run-time and also can connect to an already running server.

πŸ‘‰ πŸ““ Enforces Page object model style of coding.

πŸ‘‰ 🌌 Allows parallel and sequential execution of tests.

πŸ‘‰ πŸ”¨ All capabilities, playback and delay settings are configurable through config file.

πŸ‘‰ ☁️ Supports execution of tests on any Cloud solution like BrowserStack, SauceLabs, TestingBot, etc.

πŸ‘‰ πŸ“Ή Supports video recording of tests on Android and iOS.

πŸ‘‰ πŸ“· Supports capturing screenshots for Android and iOS.

πŸ‘‰ πŸ“‹ Supports reading Clipboard from devices.

πŸ‘‰ πŸ“” Supports logging of all events occurred during test execution.

πŸ‘‰ ❌ Provides pre-defined errors which wraps the Appium exceptions in a meaningful way.

πŸ‘‰ βœ… Provides inbuilt assertions to verify the device elements.

πŸ‘‰ ♨️ Supports any Testing frameworks like TestNG, JUnit or Cucumber.

πŸ“Œ Usage?

<dependency>
    <groupId>com.github.wasiqb.coteafs</groupId>
    <artifactId>appium</artifactId>
    <version>4.2.0</version>
</dependency>

πŸ˜„ How it is easy to write Tests with this Framework?

1. 🏭 How to configure the tests?

First step in writing tests using coteafs-appium framework is defining a Yaml config file in the src/test/resources folder.

(For more details, check the link above.)

Sample file is shown below.

servers:
  android_server:
    host: 127.0.0.1
    port: 4723
    external: true
    logs:
      level: DEBUG
      path: logs/appium-server.log
      timestamp: true
      local_timezone: true
      debug_spacing: true
    android:
      suppress_adb_kill: true
devices:
  android:
    os: ANDROID
    name: Google Pixel 3
    version: 8.1
    type: SIMULATOR
    others:
      clear_files: true
      no_reset: false
      full_reset: true
      clear_logs: true
    automation: UIAUTOMATOR2
    android:
      avd:
        name: Pixel_3_XL_API_27
        launch_timeout: 60000
        ready_timeout: 60000
        args: -gpu swiftshader_indirect
      app:
        install_timeout: 60000
        type: HYBRID
        path: apps/android/VodQA.apk
    session_timeout: 120000
    playback:
      screenshot:
        on_error: true
      recording:
        enabled: true
      stream:
        enabled: true
      delay:
        before_swipe: 200
        after_swipe: 100
        before_tap: 0
        after_tap: 0
        implicit: 1
        explicit: 20
2. 🎯 How simple it is to write the tests?

By using Action classes for each Activity, the flow specific for that activity can be modularized and tests looks much clean and readable. See the sample test below.

import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;

import com.github.wasiqb.coteafs.appium.android.vodqa.actions.LoginActivityAction;
import com.github.wasiqb.coteafs.appium.service.AppiumServer;

public class SampleTest {
    protected AndroidDevice androidDevice;
    private   AppiumServer  androidServer;

    @BeforeClass
    public void setupTestSuite () {
        // Here the parameter refers to the key in server block in config file.
        this.androidServer = new AppiumServer ("android_server");
        this.androidServer.start ();

        // Here the param refers to the key in devices block in config file.
        this.androidDevice = new AndroidDevice (this.androidServer, "android_device");
        this.androidDevice.start ();
        this.androidDevice.startRecording ();
        this.androidDevice.startStreaming ();
    }

    @AfterClass (alwaysRun = true)
    public void tearDownTestSuite () {
        this.androidDevice.stopStreaming ();
        this.androidDevice.stopRecording ();
        this.androidDevice.stop ();
        this.androidServer.stop ();
    }

    @Test
    public void login () {
        final LoginActivityAction login = new LoginActivityAction (this.androidDevice);
        login.addInputValue ("UserName", "admin")
            .addInputValue ("Password", "admin")
            .perform ();
    }
}
3. β›³ How to create Activity class?

New class needs to be created for each Activity. There's an abstract activity class for each type of device. Here prepare method needs to be implemented with all the elements available on that Activity.

See the below sample for an Android activity with comments for better understanding.

import org.openqa.selenium.By;

import com.github.wasiqb.coteafs.appium.android.AndroidDevice;
import com.github.wasiqb.coteafs.appium.device.DeviceElement;

public class LoginActivity extends AndroidActivity {
    public LoginActivity (final AndroidDevice device) {
        super (device);
    }

    @Override
    protected DeviceElement prepare () {
        final DeviceElement main = DeviceElement.create ("Main")
            .forAndroid (By.id ("android:id/content"));
        DeviceElement.create ("Back")
            .parent (main)
            .forAndroid (By.xpath ("//android.widget.TextView[@text=\"Back\"]"))
            // We can set multiple locators for different Automation names.
            .forAndroid (AutomationType.UIAUTOMATOR2,
                MobileBy.AndroidUIAutomator ("new UiSelector ().text (\"Back\");"));
        DeviceElement.create ("UserName")
            .forAndroid (MobileBy.AccessibilityId ("username"))
            .parent (main);
        DeviceElement.create ("Password")
            .forAndroid (MobileBy.AccessibilityId ("password"))
            .parent (main);
        DeviceElement.create ("Login")
            .index (1)    // Index of element when multiple elements for same locator exists.
            .waitStrategy (WaitStrategy.VISIBLE)  // Wait strategy to be used while finding the element.
            .forAndroid (MobileBy.AccessibilityId ("login"))     // Locator used to find the element.
            .parent (main);    // Parent of current element.
        return main;
    }
}
4. ⚽ How to create your Activity action class?

There is abstract action class provided by the framework where Activity specific flow is implemented in perform method. See the sample Activity action class below.

import com.github.wasiqb.coteafs.appium.android.AndroidActivityActions;
import com.github.wasiqb.coteafs.appium.android.AndroidDevice;
import com.github.wasiqb.coteafs.appium.android.vodqa.activities.LoginActivity;

public class LoginActivityAction extends AndroidActivityActions {
    public LoginActivityAction (final AndroidDevice device) {
        super (device);
    }

    @Override
    public void perform () {
        final LoginActivity login = new LoginActivity (getDevice ());
        login.onElement ("UserName")
            .enterText (value ("UserName"));
        login.onElement ("Password")
            .enterText (value ("Password"));
        login.onDevice ()
            .hideKeyboard ();
        login.onElement ("Login")
            .tap ();
    }
}

❓ What to do when you need help?

  • You can chat with us on our Discord server.
  • Directly chat with me on my site and I'll revert to you as soon as possible.
  • If you find any issue which is a bottleneck for you, search the issue tracker to see if it is already raised.
  • If not raised, then you can create a new issue with required details as mentioned in the issue template.

⭐ What you do if you like the project?

  • Star the project to make the project popular.
  • Stay updated with the project progress by Watching it.
  • Contribute to fix open issues, documentations or add new features. Check our contributing page.

βœ”οΈ Contributors

πŸ’ Thanks for the support.

For allowing us to run our unit tests on different platforms.

🎫 Versioning ideology

©️ Wasiq Bhamla

More Repositories

1

multiple-cucumber-html-reporter

Generate beautiful Cucumber HTML reports
JavaScript
238
star
2

coteafs-selenium

πŸ’» Selenium WebDriver wrapper framework in Java for clean and maintainable tests.
Java
77
star
3

coteafs-datasource

πŸ“’ Simple Data file to object parser supports JSON, YML, XML and properties file format.
Java
12
star
4

my-wdio

♨️ My first try on webdriverio.
JavaScript
10
star
5

applitools-hackathon-2020

Applitools Ultra Fast Grid Hackathon solution.
Java
6
star
6

wasiqb.github.io

πŸ’» My personal site
JavaScript
6
star
7

cypress-practice

Learning Cypress
TypeScript
6
star
8

youtube-samples

Sample repository demonstrating examples from my YouTube channel
Java
5
star
9

java-formatter

My common Eclipse IDE Code cleanup and formatter for Eclipse and IntelliJ
5
star
10

applitools-hackathon

Java
4
star
11

java-for-automation

Java
4
star
12

coteafs-services

An easy to use Web API Test Automation Framework for REST and SOAP.
Java
4
star
13

wdio-image-comparison-dashboard-service

TypeScript
3
star
14

my-wdio-ts

WebDriverIO sample project with Cucumber and Typescript
TypeScript
3
star
15

coteafs-parent

πŸ‘¨ Maven parent project for common plugins and profiles.
3
star
16

coteafs-logger

πŸ“– A wrapped library over log4j2 for simplified logging.
Java
3
star
17

WasiqB

3
star
18

coteafs-listeners

πŸ“° Runtime logging and recovery framework written in Java powered by TestNG.
Java
3
star
19

my-repo-starter

✨ My basic repository starter pack.
3
star
20

coteafs-dataset

Data container to store data from different sources.
Java
3
star
21

coteafs-config

πŸ”§ Simple multi format configuration support for your project.
Java
3
star
22

maven-publish-action

πŸ“¦ GitHub Action for automatically publishing to Maven central
TypeScript
2
star
23

personal-next-site

My new Next JS based portfolio
TypeScript
2
star
24

appium-lambdatest-sample

Java
2
star
25

website

My personal website build using Docusaurus.
CSS
2
star
26

wdio-automation-tutorials

LambdaTest YouTube WDIO sample repository
JavaScript
2
star
27

config_bot

Config file creation helper bot.
Ruby
2
star
28

coteafs-error

⚠️ Throw and Handle custom wrapped Exceptions.
Java
2
star
29

maven-deploy

♻️ Circle Orb for Maven build and deploy jobs.
Shell
2
star
30

my-react-site

Re-write of my existing Jekyll site to React using Docusaurus 2.0
JavaScript
2
star
31

coteafs-selenium-docker

Testing Environment in Docker container
Dockerfile
2
star
32

appium-next-example

Java
2
star
33

coteafs-mail

A small mail utility.
Java
2
star
34

competitive-programming

My attempt in competitive programming platforms.
Java
2
star
35

teswiz-test

Java
2
star
36

coteafs-selenium-sample

Sample project for coteafs-selenium
Java
1
star
37

common-git-commands

A list of commonly used Git commands.
1
star
38

my-website

My Next JS website
TypeScript
1
star
39

appium-visual-regression-sample

Java
1
star
40

assert-json

1
star
41

wdio-sample

A sample WDIO v8 with JavaScript
JavaScript
1
star
42

wdio-starterkit

TypeScript based WDIO starter kit.
1
star
43

selebee

Selenium Page object Framework
Java
1
star
44

my-portfolio

My portfolio created with React JS, Webpack, TypeScript, DaiyUI, TailwindCSS
TypeScript
1
star
45

appium-locator-sample

Demo project for Appium supported locators
Java
1
star
46

coteafs-sftp

Java
1
star
47

java-webdriver-tutorials

1
star
48

coteafs-appium-sample

Sample Project for coteafs-appium.
Java
1
star