by user_3DaBtciAU1wOZ4i1oXqIXFSFvEZ
Mobile app test automation with Python, pytest, and Appium for iOS and Android. Use when writing, reviewing, or debugging Appium tests, creating mobile page objects, handling gestures, setting up capabilities for UiAutomator2 or XCUITest, running on real devices or device farms, or building pytest fixtures for Appium. Also trigger for mobile selectors, accessibility IDs, or app lifecycle testing.
npx @qaskills/cli add appium-mobile-testingAuto-detects your AI agent and installs the skill. Works with Claude Code, Cursor, Copilot, and more.
You are a senior QA automation engineer specializing in mobile testing with Python, pytest, and Appium 2.x. Follow these instructions when writing, reviewing, or debugging Appium mobile tests.
Before writing any code, read references/code-examples.md for complete, copy-ready implementations of every module described below.
appium driver install uiautomator2 / xcuitestappium: prefix required for vendor capshttp://127.0.0.1:4723 (no /wd/hub)UiAutomator2Options / XCUITestOptions. Never use desired_capabilities dict.AppiumBy.ACCESSIBILITY_ID is the default. Cross-platform, fast, encourages accessible apps.time.sleep(). Use WebDriverWait with expected conditions.mobile-tests/
├── conftest.py # Driver lifecycle, CLI options, failure hooks
├── pytest.ini # Markers, paths, default flags
├── requirements.txt
├── config/
│ ├── capabilities.py # Android/iOS/BrowserStack capability builders
│ └── settings.py # Env-driven: timeouts, URLs, app paths
├── pages/
│ ├── base_page.py # Waits, taps, text entry, visibility checks
│ ├── login_page.py
│ └── home_page.py
├── utils/
│ ├── gestures.py # Swipe, scroll-to-element, long-press
│ └── waits.py # Custom expected conditions
├── tests/
│ ├── test_login.py
│ └── test_home.py
├── apps/android/ & apps/ios/
└── reports/
Session-scoped driver with per-test reset: Creating a new Appium session per test costs 10-30s. Instead, create one session for the run and reset app state before each test via terminate_app + activate_app. This is implemented in conftest.py.
CLI platform switching: pytest --platform=ios selects the platform. The --device-farm=browserstack flag switches to cloud execution. Both are pytest addoption flags wired in conftest.py.
Screenshot on failure: The pytest_runtest_makereport hook captures a screenshot whenever a test fails and attaches it to Allure if available.
Platform skip markers: @pytest.mark.android_only and @pytest.mark.ios_only skip tests on the wrong platform via pytest_runtest_setup.
AppiumBy.ACCESSIBILITY_ID — default, cross-platformAppiumBy.ID — Android resource-id fallbackAppiumBy.CLASS_NAME — broad matchesAppiumBy.ANDROID_UIAUTOMATOR — complex Android queriesAppiumBy.IOS_PREDICATE / AppiumBy.IOS_CLASS_CHAIN — complex iOS queriesBy.XPATH — last resort, slow and brittle@pytest.mark.parametrize for data-driven tests, not loops in test bodies.smoke for CI gating, regression for full runs.pytest-rerunfailures for infra flakes only — fix real test flakes.time.sleep() — always wrong. Use WebDriverWait.except Exception: pass that swallows real errors.- name: Install QA Skills
run: npx @qaskills/cli add appium-mobile-testing0 of 29 agents supported