Pyppium is a wrapper of Appium-Python-Client for cross mobile testing.
$ pip install pyppium
Create your screen like this
from pyppium.fetcher import fetch, iOS, Android
class ScreenOne:
_button = fetch(iOS("id", "buttonSignIn"), Android("id", "button"))
_text_field = fetch(iOS("id", "inputUserName"), Android("id", "username"))
_text_password = fetch(iOS("id", "InputPassword"), Android("id", "pass"))
def login(self, username, password):
self._text_field.send_keys(username)
self._text_password.send_keys(password)
self._button.click()
User your screen in test after start pyppium driver
from pyppium.driver import PyppiumDriver
from tests.e2e.screens.screen import ScreenOne, ScreenTwo
from assertpy import assert_that
def test_android_basic_behaviours():
username = "Lully"
password = "123456789"
caps_android ={
"platformName": "Android",
"automationName": "uiautomator2",
"deviceName": "Android Emulator",
"appPackage": "com.example.dummy",
"appActivity": "MainActivity",
"newCommandTimeout": 0,
}
PyppiumDriver(caps_android)
ScreenOne().login(username, password)
assert_that(ScreenTwo().label_welcome_message()).contains(username)
PyppiumDriver.quit()