Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add timlu33/agent-skills --skill "mobile-automation-test"
Install specific skill from multi-skill repository
# Description
Mobile app automation testing with Robot Framework and Appium for Android and iOS. Use when writing, generating, or debugging automated UI tests for mobile applications, including test case creation, page object patterns, element locators, gesture handling, and CI/CD integration for mobile testing pipelines.
# SKILL.md
name: mobile-automation-test
description: Mobile app automation testing with Robot Framework and Appium for Android and iOS. Use when writing, generating, or debugging automated UI tests for mobile applications, including test case creation, page object patterns, element locators, gesture handling, and CI/CD integration for mobile testing pipelines.
Mobile Automation Test Skill
Create automated UI tests for Android and iOS apps using Robot Framework with AppiumLibrary.
Quick Start
# Install dependencies
pip install robotframework robotframework-appiumlibrary --break-system-packages
# Run tests
robot --variable PLATFORM:android tests/
robot --variable PLATFORM:ios tests/
Project Structure
mobile-tests/
βββ tests/
β βββ login.robot
β βββ checkout.robot
βββ resources/
β βββ common.resource
β βββ android.resource
β βββ ios.resource
βββ pages/
β βββ login_page.resource
β βββ home_page.resource
βββ config/
βββ capabilities.yaml
Appium Capabilities
Android
*** Variables ***
${ANDROID_AUTOMATION} UiAutomator2
${ANDROID_PLATFORM} Android
*** Keywords ***
Open Android App
[Arguments] ${app_path} ${device_name}=emulator-5554
Open Application http://localhost:4723
... platformName=${ANDROID_PLATFORM}
... automationName=${ANDROID_AUTOMATION}
... deviceName=${device_name}
... app=${app_path}
... noReset=true
iOS
*** Variables ***
${IOS_AUTOMATION} XCUITest
${IOS_PLATFORM} iOS
*** Keywords ***
Open iOS App
[Arguments] ${app_path} ${device_name}=iPhone 15
Open Application http://localhost:4723
... platformName=${IOS_PLATFORM}
... automationName=${IOS_AUTOMATION}
... deviceName=${device_name}
... app=${app_path}
... noReset=true
Element Locators
Use platform-appropriate locators:
| Strategy | Android Example | iOS Example |
|---|---|---|
| id | id=com.app:id/login_btn |
id=loginButton |
| accessibility_id | accessibility_id=Login |
accessibility_id=Login |
| xpath | xpath=//android.widget.Button[@text='Login'] |
xpath=//XCUIElementTypeButton[@name='Login'] |
| class | class=android.widget.EditText |
class=XCUIElementTypeTextField |
Best practice: Prefer accessibility_id for cross-platform compatibility.
Page Object Pattern
Create reusable page resources in pages/:
*** Settings ***
Resource ../resources/common.resource
*** Variables ***
# Cross-platform locators
${LOGIN_BUTTON} accessibility_id=loginButton
${USERNAME_FIELD} accessibility_id=usernameInput
${PASSWORD_FIELD} accessibility_id=passwordInput
${ERROR_MESSAGE} accessibility_id=errorText
*** Keywords ***
Enter Username
[Arguments] ${username}
Input Text ${USERNAME_FIELD} ${username}
Enter Password
[Arguments] ${password}
Input Text ${PASSWORD_FIELD} ${password}
Tap Login Button
Click Element ${LOGIN_BUTTON}
Login Should Fail With Message
[Arguments] ${expected_message}
Wait Until Element Is Visible ${ERROR_MESSAGE}
Element Text Should Be ${ERROR_MESSAGE} ${expected_message}
Perform Login
[Arguments] ${username} ${password}
Enter Username ${username}
Enter Password ${password}
Tap Login Button
Test Case Template
*** Settings ***
Resource ../pages/login_page.resource
Resource ../resources/common.resource
Suite Setup Open Test Application
Suite Teardown Close Application
Test Teardown Capture Page Screenshot
*** Test Cases ***
Valid Login Should Navigate To Home
[Tags] smoke login
Perform Login ${VALID_USER} ${VALID_PASS}
Home Page Should Be Displayed
Invalid Password Should Show Error
[Tags] negative login
Perform Login ${VALID_USER} wrong_password
Login Should Fail With Message Invalid credentials
Gesture Keywords
Common gestures for mobile testing:
*** Keywords ***
Swipe Down To Refresh
Swipe 500 300 500 800
Swipe Left To Delete
[Arguments] ${element}
${location}= Get Element Location ${element}
Swipe ${location}[x] ${location}[y] 0 ${location}[y]
Long Press Element
[Arguments] ${locator} ${duration}=2000
Long Press ${locator} ${duration}
Scroll To Element
[Arguments] ${locator}
FOR ${i} IN RANGE 10
${visible}= Run Keyword And Return Status Element Should Be Visible ${locator}
IF ${visible} RETURN
Swipe 500 800 500 300
END
Fail Element ${locator} not found after scrolling
Wait Strategies
*** Keywords ***
Wait For Element And Click
[Arguments] ${locator} ${timeout}=30s
Wait Until Element Is Visible ${locator} ${timeout}
Click Element ${locator}
Wait For Page Load
[Arguments] ${indicator_element} ${timeout}=30s
Wait Until Element Is Visible ${indicator_element} ${timeout}
Sleep 500ms # Allow animations to complete
Platform-Specific Handling
*** Keywords ***
Handle Platform Specific Action
[Arguments] ${android_keyword} ${ios_keyword}
IF '${PLATFORM}' == 'android'
Run Keyword ${android_keyword}
ELSE IF '${PLATFORM}' == 'ios'
Run Keyword ${ios_keyword}
END
Press Back Button
IF '${PLATFORM}' == 'android'
Press Keycode 4 # Android back key
ELSE
# iOS: tap navigation back or swipe
Click Element accessibility_id=Back
END
CI/CD Integration
See references/ci-integration.md for GitLab CI and Jenkins pipeline configurations.
Troubleshooting
| Issue | Solution |
|---|---|
| Element not found | Increase wait timeout, verify locator strategy |
| Stale element | Re-locate element after page transition |
| App not installed | Check app capability path, ensure APK/IPA exists |
| Session timeout | Add newCommandTimeout capability |
| Flaky tests | Add explicit waits, avoid Sleep where possible |
References
- CI/CD Configuration: See
references/ci-integration.md - Advanced Locators: See
references/locator-strategies.md - Common Patterns: See
references/test-patterns.md
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.