Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/WasiqB/coteafs-appium

:iphone: Wrapper Appium Framework in Java which supports Automation of Mobile and Tablet apps.
https://github.com/WasiqB/coteafs-appium

android appium appium-android appium-framework appium-ios appium-java appium-tests automation automation-framework automation-test framework hacktoberfest ios java test-automation testing

Last synced: 3 months ago
JSON representation

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

Lists

README

        





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

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/WasiqB/coteafs-appium)

[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)][home]
[![Discord](https://img.shields.io/discord/771674310687326208?label=Discord&logo=Discord&style=for-the-badge)][discord]
[![CircleCI](https://circleci.com/gh/WasiqB/coteafs-appium.svg?style=svg)][circleci]
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=bugs)](https://sonarcloud.io/project/issues?id=com.github.wasiqb.coteafs%3Aappium&resolved=false)
[![Test Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=coverage)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=Coverage)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=alert_status)](https://sonarcloud.io/dashboard?id=com.github.wasiqb.coteafs%3Aappium)
[![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=Maintainability)
[![Reliability](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=Reliability)
[![Security](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=security_rating)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=Security)
[![Vulnurability](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=vulnerabilities)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=new_vulnerabilities)
[![Duplicate Code](https://sonarcloud.io/api/project_badges/measure?project=com.github.wasiqb.coteafs%3Aappium&metric=duplicated_lines_density)](https://sonarcloud.io/component_measures?id=com.github.wasiqb.coteafs%3Aappium&metric=Duplications)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.wasiqb.coteafs/appium.svg)][maven]
[![Github Releases](https://img.shields.io/github/downloads/WasiqB/coteafs-appium/total.svg)](https://github.com/WasiqB/coteafs-appium/releases)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## :video_camera: Demo



## :rocket: [Quick Start][wiki]

* The [documentations][wiki] 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][].

## :pushpin: [Want to know Key Features?][intro-doc]

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:

:point_right: :iphone: Supports Android and iOS Real Devices and Emulators.

:point_right: :computer: Able to start and stop the server on run-time and also can connect to an already running
server.

:point_right: :notebook: Enforces Page object model style of coding.

:point_right: :milky_way: Allows parallel and sequential execution of tests.

:point_right: :hammer: All capabilities, playback and delay settings are configurable through config file.

:point_right: :cloud: Supports execution of tests on any Cloud solution like BrowserStack, SauceLabs, TestingBot, etc.

:point_right: :video_camera: Supports video recording of tests on Android and iOS.

:point_right: :camera: Supports capturing screenshots for Android and iOS.

:point_right: :clipboard: Supports reading Clipboard from devices.

:point_right: :notebook_with_decorative_cover: Supports logging of all events occurred during test execution.

:point_right: :x: Provides pre-defined errors which wraps the Appium exceptions in a meaningful way.

:point_right: :white_check_mark: Provides inbuilt assertions to verify the device elements.

:point_right: :hotsprings: Supports any Testing frameworks like TestNG, JUnit or Cucumber.

## :pushpin: Usage?

```xml

com.github.wasiqb.coteafs
appium
4.2.0

```

## :smile: How it is easy to write Tests with this Framework?

1. :factory: 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.

```yaml
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. :dart: 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.

```java
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. :golf: 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.

```java
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. :soccer: 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.

```java
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 ();
}
}
```

## :question: What to do when you need help?

- You can chat with us on our [Discord server][discord].
- 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][issues] 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.

## :star: 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.

## :heavy_check_mark: Contributors



## :gift_heart: Thanks for the support.





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

## :ticket: Versioning ideology





## :copyright: Wasiq Bhamla





[home]: https://github.com/wasiqb/coteafs-appium

[circleci]: https://circleci.com/gh/WasiqB/coteafs-appium

[wiki]: https://wasiqb.github.io/projects/appium/intro/

[site]: https://wasiqb.github.io

[issues]: https://github.com/WasiqB/coteafs-appium/issues?q=something

[new issue]: https://github.com/WasiqB/coteafs-appium/issues/new

[milestones]: https://github.com/WasiqB/coteafs-appium/milestones

[maven]: https://maven-badges.herokuapp.com/maven-central/com.github.wasiqb.coteafs/appium

[contributing]: .github/CONTRIBUTING.md

[intro-doc]: https://wasiqb.github.io/projects/appium

[discord]: https://discord.gg/vkR9TBdKxZ