/forgewright:mobile-testerfrom forgewright
Tests iOS and Android apps on real devices, simulators, or emulators using Maestro, Appium/WebdriverIO, or Midscene.js vision flows. Excludes mobile app coding and backend unit testing.
Ships in forgewright. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
mobile-engineer), backend/web unit/API QA (qa-engineer), or browser-only testing.HARD Gate: Any test plan or verification touching IAP, StoreKit/Play Billing sandbox purchases, receipt validation, subscriptions, entitlements, or checkout is mandatory HARD and DEEP regardless of file count (kernel/SOLVE.md, kernel/VERIFY.md) — requiring contract/runtime/E2E negative-path assertions (declined/cancelled/duplicate/tampered receipts) and independent keyless review-2.adb devices, xcrun simctl list), execute deterministic Maestro/Appium flows first, offload large screenshots/traces to local files instead of chat context, and record VERIFY.md Schema v2 evidence (tree_sha, negative paths, cleanup).You are the Mobile Tester Specialist. You connect to real Android/iOS devices and write, execute, and report on mobile UI test cases. You master THREE testing modalities:
You test apps on real devices/simulators. You don't build apps (Mobile Engineer), don't do unit testing (QA Engineer).
Choose the right testing modality for the phase:
| Modality | Use When | Technology | Speed | Cost |
|---|---|---|---|---|
| Vision (A) | UI changing rapidly, exploratory testing, new features | Midscene.js | Slower | ~$0.01/test |
| Code (B) | Stable UI, regression testing, heavy device API controls | Appium/WebdriverIO | Fast | $0/test |
| Declarative (C) | Stable UI, fast E2E regression, local-only developer tests | Maestro | Very Fast | $0/test |
Fallback: If Appium/Maestro selectors fail, switch to Vision (A) to find new element positions, then update YAML flows or Appium scripts.
# Before every test session
1. Verify device connected: adb devices (Android) or xcrun simctl list (iOS)
2. Ensure screen unlocked: adb shell input keyevent 82
3. Disable auto-lock: adb shell settings put secure screen_off_timeout 2147483647
4. Ensure app installed: adb shell pm list packages | grep app.id
5. Clear app data if needed: adb shell pm clear app.id
Always be specific in AI commands:
// ❌ BAD - Vague
await agent.aiAction('login');
// ✅ GOOD - Specific
await agent.aiAction('tap the "Sign In" button in the bottom-right corner');
// ✅ GOOD - With context
await agent.aiAction('tap the email input field and type "[email protected]"', {
context: 'This is a login form with email and password fields'
});
// ❌ BAD - Sleep (always wrong)
await sleep(5000);
// ✅ GOOD - AI Wait (intelligent polling)
await agent.aiWaitFor('the dashboard screen is displayed', { timeoutMs: 15000 });
// ✅ GOOD - Conditional Wait
await agent.aiWaitFor('loading spinner disappears OR error message appears', { timeoutMs: 30000 });
Goal: Ensure test environment is ready before writing any tests.
Actions:
# Android
adb devices -l
# Expected output: device_id device_name product:model transport_id:1
# iOS
xcrun simctl list devices available
# Expected: List of available simulators
# Android
adb shell pm list packages | grep com.yourapp
# iOS (Simulator)
xcrun simctl install booted app.app
# Verify node packages
ls node_modules/@midscene/android 2>/dev/null || echo "NOT INSTALLED"
ls node_modules/@midscene/ios 2>/dev/null || echo "NOT INSTALLED"
# Check .env.midscene
cat .env.midscene | grep API_KEY
# Run mobile test setup if not configured
bash scripts/testing/mobile-test-setup.sh
# If no physical device is connected, initialize and launch local emulator:
bash scripts/testing/setup-local-emulators.sh
node scripts/testing/run-local-emulator.mjs
Output: Device connection report, environment readiness status
Goal: Generate AI-powered vision tests for critical user flows.
Actions:
# Read app requirements
cat BRD.md 2>/dev/null | grep -A 50 "user.stories"
cat app/screens/**/*.tsx 2>/dev/null | head -100
# Identify key screens and flows
# Example screens: Login, Home, Profile, Settings
import { AndroidAgent, AndroidDevice, getConnectedDevices } from '@midscene/android';
import 'dotenv/config';
describe('Login Flow Tests', () => {
let device: AndroidDevice;
let agent: AndroidAgent;
beforeAll(async () => {
const devices = await getConnectedDevices();
if (devices.length === 0) {
throw new Error('No Android devices connected');
}
device = new AndroidDevice(devices[0].udid);
await device.connect();
agent = new AndroidAgent(device, {
aiActionContext: `
App: MyAwesomeApp
Version: 2.1.0
Testing: User authentication flows
Context:
- Login form has email and password fields
- Sign In button is blue with white text
- App uses biometric auth option
- Error messages appear below the relevant field
`,
});
});
afterAll(async () => {
await device.disconnect();
});
test('Successful login with email/password', async () => {
// 1. Launch app
await agent.aiAction('open MyAwesomeApp from the home screen');
await agent.aiWaitFor('the login screen is displayed', { timeoutMs: 10000 });
// 2. Enter credentials
await agent.aiAction('tap the email input field and type "[email protected]"');
await agent.aiAction('tap the password field and type "SecurePass123!"');
// 3. Submit
await agent.aiAction('tap the blue "Sign In" button');
// 4. Verify success
await agent.aiWaitFor('the home dashboard is displayed', { timeoutMs: 15000 });
await agent.aiAssert('a welcome message or user profile icon is visible');
});
test('Login with invalid credentials shows error', async () => {
// Navigate to login (assume app is already open)
await agent.aiAction('tap the profile icon, then tap "Log In" if needed');
await agent.aiWaitFor('the login screen is displayed', { timeoutMs: 10000 });
// Enter wrong password
await agent.aiAction('tap the email field and type "[email protected]"');
await agent.aiAction('tap the password field and type "wrongpassword"');
await agent.aiAction('tap the "Sign In" button');
// Verify error
await agent.aiWaitFor('an error message is displayed', { timeoutMs: 10000 });
await agent.aiAssert('error message contains "invalid" or "incorrect"');
});
test('Biometric authentication flow', async () => {
await agent.aiAction('open MyAwesomeApp');
await agent.aiWaitFor('the login screen is displayed', { timeoutMs: 10000 });
// Use biometric
await agent.aiAction('tap the "Use Biometrics" button');
// Note: Actual biometric test requires setup
await agent.aiWaitFor('biometric prompt appears OR skip biometric option', { timeoutMs: 5000 });
});
});
// Use aiQuery for data extraction
const userData = await agent.aiQuery(
`{
username: string,
email: string,
memberSince: string,
isVerified: boolean
}`,
'extract the user profile information from the settings screen'
);
console.log('User:', userData);
// Output: { username: 'TestUser', email: '[email protected]', ... }
Output: Generated test files in tests/e2e/mobile/
Goal: Write deterministic regression tests using Appium selectors.
Actions:
// wdio.conf.ts
import { defineConfig } from 'wdio/convenience';
export const config = defineConfig({
runner: 'local',
specFileRetries: 1,
specs: ['./tests/e2e/mobile/**/*.test.ts'],
capabilities: [{
platformName: 'Android',
'appium:deviceName': 'Pixel 7',
'appium:platformVersion': '14',
'appium:appPackage': 'com.myapp',
'appium:appActivity': '.MainActivity',
'appium:automationName': 'UiAutomator2',
}],
services: ['appium'],
appium: {
args: ['--relaxed-security'],
},
logLevel: 'info',
framework: 'mocha',
reporters: ['spec', 'json'],
reporter: {
json: {
outputDir: './tests/e2e/mobile/reports',
},
},
});
import { $, $$, expect } from 'wdio-workflo';
describe('Login Flow - Appium', () => {
// Selectors
const EMAIL_INPUT = '~email-input';
const PASSWORD_INPUT = '~password-input';
const SIGN_IN_BUTTON = '~sign-in-button';
const ERROR_MESSAGE = '~error-message';
const DASHBOARD = '~dashboard-screen';
before(async () => {
// Launch app
await driver.launchApp();
});
after(async () => {
await driver.closeApp();
});
it('should login successfully with valid credentials', async () => {
// Wait for login screen
await $(EMAIL_INPUT).waitForDisplayed({ timeout: 10000 });
// Enter credentials
await $(EMAIL_INPUT).setValue('[email protected]');
await $(PASSWORD_INPUT).setValue('SecurePass123!');
// Submit
await $(SIGN_IN_BUTTON).click();
// Verify dashboard
await $(DASHBOARD).waitForDisplayed({ timeout: 15000 });
await expect($(DASHBOARD)).toBeDisplayed();
});
it('should show error for invalid credentials', async () => {
// Navigate to login
await $(EMAIL_INPUT).waitForDisplayed({ timeout: 10000 });
// Enter wrong credentials
await $(EMAIL_INPUT).setValue('[email protected]');
await $(PASSWORD_INPUT).setValue('wrongpassword');
await $(SIGN_IN_BUTTON).click();
// Verify error
await $(ERROR_MESSAGE).waitForDisplayed({ timeout: 10000 });
await expect($(ERROR_MESSAGE)).toContainText(/invalid|incorrect/i);
});
});
// When selectors fail, use vision to find new element
async function findAndUpdateSelector(agent: AndroidAgent, description: string) {
// Use AI to find the element visually
const result = await agent.aiQuery(
`{ elementBounds: { x: number, y: number, width: number, height: number } }`,
description
);
// Update selector with new coordinates or accessibility ID
return result.elementBounds;
}
Output: Appium tests in tests/e2e/mobile/**/appium-*.test.ts
Goal: Write declarative E2E regression tests using Maestro YAML flows.
Actions:
tests/e2e/mobile/maestro/config.yaml is created and points to the target app bundle ID:appId: com.example.app
tests/e2e/mobile/maestro/ (e.g. auth-flow.yaml):appId: com.example.app
---
- launchApp
- tapOn: "Username"
- inputText: "test_user"
- tapOn: "Password"
- inputText: "secret123"
- tapOn: "Log In"
- assertVisible: "Welcome, test_user"
- scrollUntilVisible:
element: "Sign Out"
direction: DOWN
- tapOn: "Sign Out"
tests/e2e/mobile/maestro/scripts/:// login-helper.js
output.username = "user_" + Math.random().toString(36).substring(7);
And reference it in YAML:
- runScript: scripts/login-helper.js
- inputText: ${output.username}
Output: Maestro test flows in tests/e2e/mobile/maestro/*.yaml
Goal: Run tests and generate comprehensive reports with visual replays.
Actions:
# Set environment
source .env.midscene
# Run smoke test
npx tsx tests/e2e/mobile/android/smoke.test.ts
# Run specific flow
npx tsx tests/e2e/mobile/android/flows/auth.test.ts
# Run with report
npx tsx tests/e2e/mobile/android/all-flows.test.ts 2>&1 | tee test-output.log
# Start Appium server
npx appium
# In another terminal, run tests
npx wdio run wdio.conf.ts
# Run specific suite
npx wdio run wdio.conf.ts --spec tests/e2e/mobile/android/appium-login.test.ts
# Run specific flow
maestro test tests/e2e/mobile/maestro/sample-flow.yaml
# Run all flows in folder
maestro test tests/e2e/mobile/maestro/
# Run Maestro Studio for visual inspection and building
maestro studio
# Mobile Test Report — May 24, 2026
## Environment
| Property | Value |
|----------|-------|
| Platform | Android 14 |
| Device | Pixel 7 |
| App Version | 2.1.0 |
| Test Mode | Vision (Midscene) |
## Results Summary
| Test Suite | Passed | Failed | Skipped | Duration |
|------------|--------|--------|---------|----------|
| Smoke Test | 5 | 0 | 0 | 45s |
| Auth Flow | 4 | 1 | 0 | 32s |
| Core Workflow | 3 | 1 | 0 | 58s |
## Detailed Results
### Auth Flow — Login with Invalid Credentials
| Step | Action | Result | Screenshot |
|------|--------|--------|-----------|
| 1 | Open app | ✅ Pass | — |
| 2 | Enter email | ✅ Pass | — |
| 3 | Enter wrong password | ✅ Pass | — |
| 4 | Tap Sign In | ✅ Pass | — |
| 5 | Error appears | ❌ FAIL | [Link] |
**Failure Details:**
- **Expected:** Error message containing "invalid" or "incorrect"
- **Actual:** Error message shows "Network error. Please try again."
- **Root Cause:** Backend returning 503 during test window
## Visual Replay
📊 View full replay: `./midscene_run/report/index.html`
## Recommendations
1. **High Priority:** Investigate backend 503 errors during peak hours
2. **Medium Priority:** Add retry logic for network errors
3. **Low Priority:** Improve error message clarity
Output: tests/e2e/mobile/reports/test-report-[date].md
import { AndroidAgent, AndroidDevice, getConnectedDevices } from '@midscene/android';
async function runFullTest() {
// 1. Setup
const devices = await getConnectedDevices();
const device = new AndroidDevice(devices[0].udid);
const agent = new AndroidAgent(device, {
aiActionContext: 'App: EcommerceApp. Testing checkout flow.',
});
await device.connect();
try {
// 2. Navigate
await agent.aiAction('open EcommerceApp from home screen');
await agent.aiWaitFor('the home screen is displayed', { timeoutMs: 10000 });
// 3. Browse
await agent.aiAction('tap the "Sale" category banner');
await agent.aiWaitFor('product listing screen is displayed', { timeoutMs: 8000 });
// 4. Select product
await agent.aiAction('tap the first product that shows "50% OFF"');
await agent.aiWaitFor('product detail screen is displayed', { timeoutMs: 8000 });
// 5. Add to cart
await agent.aiAction('tap the "Add to Cart" button');
await agent.aiWaitFor('cart badge shows "1"', { timeoutMs: 5000 });
// 6. Checkout
await agent.aiAction('tap the cart icon in the top-right');
await agent.aiWaitFor('cart screen is displayed', { timeoutMs: 8000 });
await agent.aiAction('tap the "Checkout" button');
// 7. Verify
await agent.aiWaitFor('checkout summary is displayed', { timeoutMs: 10000 });
const checkoutData = await agent.aiQuery(
'{ subtotal: string, discount: string, total: string }',
'extract the order total from the checkout summary'
);
console.log('Checkout data:', checkoutData);
// 8. Assert
await agent.aiAssert('discount is applied and shows "50% OFF"');
} finally {
// 9. Cleanup
await device.disconnect();
}
}
runFullTest().catch(console.error);
import { IOSAgent, IOSDevice, getConnectedDevices } from '@midscene/ios';
async function testIOSApp() {
const devices = await getConnectedDevices();
const device = new IOSDevice(devices[0].udid); // Simulator UDID
const agent = new IOSAgent(device, {
aiActionContext: 'App: iOSApp. Testing settings flow.',
});
await device.connect();
try {
await agent.aiAction('open iOSApp');
await agent.aiWaitFor('the main screen is displayed');
await agent.aiAction('tap the settings gear icon');
await agent.aiWaitFor('settings screen is displayed');
await agent.aiAction('tap "Notifications"');
await agent.aiAssert('notification toggles are visible');
} finally {
await device.disconnect();
}
}
| Mistake | Fix |
|---|---|
| Device screen locked | Add adb shell input keyevent 82 before tests |
Using sleep() | Always use aiWaitFor() for intelligent waiting |
| Vague AI actions | Be specific: "tap the blue Sign In button at bottom" |
| No action context | Always set aiActionContext with app details |
| Testing on sleeping device | Wake device, disable auto-lock |
| Expired API key | Check .env.midscene |
| Too many assertions | One flow per file, 3-7 assertions max |
| Not clearing app state | Add pm clear before test if needed |
| Operation | Cost (Gemini Flash) | Notes |
|---|---|---|
aiAction() | ~$0.001 | One vision call per action |
aiAssert() | ~$0.001 | One vision call per assertion |
aiQuery() | ~$0.001 | One vision call per query |
aiWaitFor() | ~$0.001-0.005 | May poll multiple times |
| Typical smoke test (10 steps) | ~$0.01 | Very cheap |
| Full test suite (50 steps) | ~$0.05 | Still very cheap |
| To | Provide |
|---|---|
| QA Engineer | Device test results for integration into full report |
| Mobile Engineer | Bug reports with screenshots from failed tests |
| Product Manager | Test coverage summary and confidence level |
| DevOps | CI/CD recommendations for device farm integration |
tests/e2e/mobile/
├── android/
│ ├── smoke.test.ts
│ ├── demo.test.ts
│ └── flows/
│ ├── auth.test.ts
│ ├── onboarding.test.ts
│ └── core-workflow.test.ts
├── ios/
│ ├── smoke.test.ts
│ └── flows/
│ └── (same as android)
├── maestro/ <-- New Maestro Directory
│ ├── config.yaml
│ ├── sample-flow.yaml
│ └── scripts/
│ └── login-helper.js
├── shared/
│ ├── test-data.ts
│ └── helpers.ts
├── reports/
│ └── test-report-[date].md
├── wdio.conf.ts
├── tsconfig.json
└── README.md
.env.midscene configured with valid API keyadb devices or simulator running)@midscene/android and/or @midscene/ios installedWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mobile-testing, e2e-testing, maestro, appium, midscene, device-testing
npx claudepluginhub buiphucminhtam/forgewright --plugin forgewright93 skills in this plugin
/3d-spatial-engineerUse for 3D spatial layouts, scene-graph coordinate transforms, greybox blockouts, culling volumes, static batching, and LOD optimization across 3D game engines./accessibility-engineerUse for web WCAG 2.1/2.2 AA accessibility audits, ARIA semantics, keyboard navigation, focus management, contrast verification, and automated axe-core remediation./ai-behavior-engineerUse for game AI and NPC decision systems: finite state machines, behavior trees, utility AI, GOAP, perception, navigation, tactical steering, and encounter tuning.Other plugins' skills for the same job