Mobile UI automation framework for the Sauce Labs Sample App (Swag Labs), built with Python, Appium, and pytest, following the Page Object Model design pattern and targeting Android via UiAutomator2.
This is the second project in a portfolio designed to demonstrate automation fundamentals across different tech stacks:
- Python + Selenium — web automation (Toolshop demo site)
- Python + Appium (this project) — native mobile automation
This project demonstrates a mobile QA automation workflow: environment setup for Android emulation, element inspection via Appium Inspector, Page Object implementation, and test execution with pytest — applied to a real e-commerce-style native app.
- UI testing: login flow, including successful login and locked-out user error handling
- Design pattern: Page Object Model
- Target platform: Android (emulator)
| Category | Tool |
|---|---|
| Language | Python 3.9 |
| Test framework | pytest |
| Mobile automation | Appium Server 2.x + UiAutomator2 driver |
| Environment management | python-dotenv, venv |
| Element inspection | Appium Inspector |
python-android-app-automation/
├── apps/ # APK under test (not committed — see Setup below)
├── src/
│ ├── config/
│ │ └── capabilities.py # Appium/UiAutomator2 desired capabilities
│ └── pages/
│ ├── base_page.py # Shared wait/interaction methods for all pages
│ └── login_page.py # Login screen Page Object
├── tests/
│ └── test_login.py # Login test suite
├── docs/
│ ├── requirements.md
│ ├── test_cases.md
│ ├── ARCHITECTURE.md
│ └── ISSUES_AND_SOLUTIONS.md
├── conftest.py # Pytest fixtures (driver setup/teardown)
├── pytest.ini
├── requirements.txt
├── .env.example
└── LICENSE
Design decisions (Page Object Model, locator strategy, fixtures, handling of async UI
transitions) are documented in docs/ARCHITECTURE.md.
- macOS (Apple Silicon) — this guide targets that setup specifically
- Homebrew
- Android Studio (provides the SDK,
adb, and the emulator)
brew install openjdk@17
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
echo 'export JAVA_HOME=$(/usr/libexec/java_home -v17)' >> ~/.zshrc
source ~/.zshrcDownload from developer.android.com/studio, run the Standard setup, then confirm your SDK path from **Settings > Languages & Frameworks
Android SDK** and add it to your shell:
echo 'export ANDROID_HOME=$HOME/Library/Android/sdk' >> ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator' >> ~/.zshrc
source ~/.zshrcInside Android Studio: More Actions > Virtual Device Manager > Create Device. A Pixel device with a recent Android system image (API 33/34, Google APIs) works well.
brew install node
npm install -g appium
appium driver install uiautomator2Download the .dmg for your architecture from the
Appium Inspector releases page.
git clone https://github.com/noemiSynyster/python-android-app-automation.git
cd python-android-app-automation
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtcp .env.example .envThe default values already work with the sample app's demo accounts.
This project automates the Sauce Labs Sample App,
version 2.7.1. The APK is not committed to this repo — download it from the
releases page and
place it under apps/:
apps/Android.SauceLabs.Mobile.Sample.app.2.7.1.apk
With the emulator open and Appium running in a separate terminal (appium):
pytest tests/ -v- Login flow: successful login, locked-out user error handling
- Handling of native Android system dialogs
- Handling of async UI transitions (React Native screen animations)
- Products / catalog page object and tests
- Cart and checkout flow
- CI/CD pipeline (GitHub Actions + Android emulator runner)
- Allure reporting
Real problems encountered and how they were solved are documented transparently in
docs/ISSUES_AND_SOLUTIONS.md — including a wrong
assumed app package, a native system dialog blocking sessions, an empty-text element,
and a false test failure caused by animation timing.