qa-test-flows
Automated UI test flow framework using CDP + agent-device for native apps and agent-browser for web apps. Zero-framework approach — bash scripts orchestrate simulators with no Detox, Maestro, or Appium dependencies. Provides test lifecycle, screenshot capture, assertion helpers, and JSON report generation. Invoke when user says "run tests", "test the app", "smoke test", "regression test", "verify flows", "run e2e tests", or any task requiring automated UI testing.
- License 许可
- MIT
- 最近更新
- 2026-07-29
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- qa-test-flows
- description
- Automated UI test flow framework using CDP + agent-device for native apps and agent-browser for web apps. Zero-framework approach — bash scripts orchestrate simulators with no Detox, Maestro, or Appium dependencies. Provides test lifecycle, screenshot capture, assertion helpers, and JSON report generation. Invoke when user says "run tests", "test the app", "smoke test", "regression test", "verify flows", "run e2e tests", or any task requiring automated UI testing.
- allowed-tools
- Bash(agent-device:*) Bash(agent-browser:*) Bash(xcrun:*) Bash(adb:*) Bash(open:*) Bash(find:*) Bash(npx:*) Bash(node:*) Read
02 资源文件 5
- 脚本flows/smoke/example-smoke.sh4.3 KB
- 脚本lib/cdp-helpers.sh11.3 KB
- 脚本lib/test-helpers.sh15.0 KB
- 脚本run-all.sh4.9 KB
- 其他templates/new-flow.sh.template3.5 KB
03 SKILL.md 正文
qa-test-flows
Automated UI test flow framework using a dual-driver architecture: CDP for navigation/state control and agent-device for screenshots/visual assertions in native apps, plus agent-browser for web app testing. This is a zero-framework approach — bash scripts orchestrate the entire test lifecycle with no Detox, Maestro, or Appium dependencies.
Key Innovation: CDP + agent-device + agent-browser
Native mobile apps with complex gesture handlers (full-screen video players, swipe-based feeds) often make coordinate-based tapping unreliable. We solve this by connecting directly to the React Native Hermes runtime via Metro's CDP WebSocket, giving us:
- Direct navigation control via
navigationRef.current.navigate()— no touch coordinates needed - Runtime state inspection — check current route, user state, storage
- Module access via Metro's
__r()require — load any app module at runtime - Screenshots & visual verification via agent-device (best-in-class for simulators)
- Web app testing via agent-browser when the same app has a web version
When to Use
- Smoke testing before submission or release builds
- Regression testing after navigation or feature changes
- Flow verification (auth, navigation, data entry, checkout)
- Platform parity checks (iOS vs Android)
- Pre-PR validation of multi-screen flows
- State persistence verification
Test Architecture
Dual Driver System
| Driver | Purpose | Use For |
|---|---|---|
| CDP (WebSocket) | Navigation, state queries, JS execution | React Native apps (Hermes runtime) |
| agent-device | Screenshots, coordinate taps, swipes, accessibility | Native app simulators/emulators |
| agent-browser | Full browser automation, DOM interaction | Web apps, PWAs, browser testing |
Test Flow Format
All test flows follow a consistent bash template:
#!/bin/bash
source "$(dirname "$0")/../../lib/test-helpers.sh"
source "$(dirname "$0")/../../lib/cdp-helpers.sh"
TEST_NAME="my-flow"
setup_test "$TEST_NAME"
# Step 1: Navigate
step "Navigate to target screen"
cdp_navigate "TargetScreen"
sleep 2
take_screenshot "01-target-screen"
assert_screenshot "01-target-screen"
# Step 2: Interact
step "Perform action"
tap 200 400
sleep 1
take_screenshot "02-after-action"
# Step 3: Verify
step "Verify result"
route=$(cdp_get_route)
log_info "Route: $route"
teardown_test
Running Tests
Single Test
bash .pi/skills/qa-automation/qa-test-flows/flows/smoke/example-smoke.sh
All Tests
bash .pi/skills/qa-automation/qa-test-flows/run-all.sh
With Logging
bash .pi/skills/qa-automation/qa-test-flows/flows/smoke/example-smoke.sh 2>&1 | tee /tmp/smoke.log
Writing New Tests
1. Copy the template
cp .pi/skills/qa-automation/qa-test-flows/templates/new-flow.sh.template \
.pi/skills/qa-automation/qa-test-flows/flows/my-suite/my-test.sh
chmod +x .pi/skills/qa-automation/qa-test-flows/flows/my-suite/my-test.sh
2. Edit the template
Replace CUSTOMIZE markers with your app-specific details.
3. Find coordinates
agent-device screenshot /tmp/debug.png
open /tmp/debug.png # Measure tap targets
4. Run and verify
bash .pi/skills/qa-automation/qa-test-flows/flows/my-suite/my-test.sh
ls /tmp/qa-tests/screenshots/my-test/
Helper Libraries
test-helpers.sh
| Function | Purpose |
|---|---|
setup_test "name" |
Initialize test, create directories |
teardown_test |
Report results, cleanup |
step "description" |
Log a numbered test step |
log_pass/fail/info/warn |
Status logging |
take_screenshot "name" |
Capture screenshot |
tap x y |
Tap at coordinates |
swipe x1 y1 x2 y2 |
Swipe gesture |
scroll_dir direction |
Scroll up/down/left/right |
assert_app_foreground |
Verify app is running |
assert_screenshot "name" |
Verify screenshot exists |
assert_text_visible "text" |
Check accessibility tree |
launch_app |
Launch/relaunch the app |
close_app |
Terminate the app |
cdp-helpers.sh
| Function | Purpose |
|---|---|
cdp_eval "expression" |
Execute JS in Hermes |
cdp_eval_safe "expression" |
Eval with ErrorUtils suppression |
cdp_navigate "Screen" |
Navigate to screen |
cdp_navigate_tab "TabScreen" |
Navigate to tab |
cdp_get_route |
Get current route name |
cdp_get_state |
Get full nav state |
cdp_go_back |
Go back |
nav_explore/search/home/profile |
Quick tab navigation |
File Structure
qa-test-flows/
├── SKILL.md # This file
├── lib/
│ ├── test-helpers.sh # Core test framework
│ └── cdp-helpers.sh # CDP interaction helpers
├── flows/
│ └── smoke/
│ └── example-smoke.sh # Example smoke test
├── templates/
│ └── new-flow.sh.template # Template for new tests
└── run-all.sh # Master test runner
Troubleshooting
| Problem | Solution |
|---|---|
| agent-device click hangs | Commands run in background with timeout — if still hanging, increase DEVICE_CMD_TIMEOUT |
| Dev console overlay covers screen | Call dismiss_error_overlay from scroll-helpers, or use CDP to suppress LogBox |
| Accessibility tree is sparse | React Native trees are thinner than web — prefer coordinates + screenshots |
| CDP timeout | Check dev server is running: curl $DEV_SERVER_HEALTH |
| Module ID changed after code update | Delete cache: rm $NAV_MODULE_CACHE — setup guard will re-scan |
04 同仓库更多 Skills
using-agent-skills
Discovers and invokes the right @runecraft/spells skill for the current task. Use when starting a session, when a request is ambiguous about which workflow to apply, or when you need to pick among the 13-skill Arcanum catalog. EN triggers: /skill, which skill, pick a skill, what skill should I use, skill discovery, meta skill. PT triggers: qual skill, qual habilidade, descobrir skill, qual fluxo usar. Do NOT use for: actual implementation work (route to the specific skill instead), unrelated standalone tasks outside the Arcanum catalog, or runtime-specific configuration (e.g., opencode.json / Claude Code plugin paths).
typescript-patterns
TypeScript best practices and patterns for type-safe, maintainable code. Covers discriminated unions, generics, const assertions, type narrowing, and common anti-patterns. Extends (does not override) project tsconfig. EN triggers: /typescript, TypeScript patterns, TS best practices, type safety, discriminated unions, generics, type narrowing. PT triggers: /typescript, padrões TypeScript, boas práticas TS, segurança de tipos, unions discriminadas, genéricos. Do NOT use for: JavaScript-only projects, runtime performance, or replacing project tsconfig rules.
test-driven-development
Drives development with tests — fail first, then make them pass, then refactor. Use when implementing any logic, fixing any bug, or changing any behavior. EN triggers: /test, write tests first, TDD, prove it, 80/15/5 pyramid, Beyonce Rule. PT triggers: /teste, testes primeiro, provar com teste, pirâmide 80/15/5. Do NOT use for: production incident triage (use /debug), or cosmetic-only changes with no behavioral surface.
spec-driven
Feature planning and implementation with 4 adaptive phases — Specify, Design, Tasks, Execute. Auto-sizes depth by complexity. Creates atomic tasks with verification criteria, atomic git commits, and requirement traceability. Features an independent Verifier (author != verifier, evidence-or-zero), persistent decision log (STATE.md), and test-coverage-matrix-driven tests, plus a self-improving lessons layer that turns verification failures into reusable project-local guidance. Stack-agnostic. Use when planning features (requirements, design, task breakdown), implementing with verification and atomic commits, or validating/verifying an implementation against a spec. Triggers (PT/EN): "specify feature", "vamos especificar", "discutir feature", "discutir este caso", "design", "design da feature", "tarefas", "quebrar em tarefas", "implementar", "build", "validar", "verify work", "UAT", "validar implementação", "record decision", "pause work", "pausar trabalho", "resume work", "retomar trabalho". Do NOT use for architecture decomposition analysis (use architecture skills) or technical design docs (treat as Complex scope: discuss gray areas + architecture-focused design).
skill-forge
Designs, authors, validates, and optimizes new Agent Skills from scratch. Use when creating a new skill, packaging a workflow as a skill, improving a skill's triggering accuracy, or evaluating whether a skill improves output quality. Covers the full lifecycle: DISCOVER, DESIGN, AUTHOR, VALIDATE, OPTIMIZE, DELIVER. Produces skills that follow the open SKILL.md format (YAML frontmatter + Markdown body, progressive disclosure, validation loops). EN triggers: /forge, create a skill, write a skill, build a skill, new skill, author a skill, package this as a skill, validate a skill, improve skill triggering, optimize skill description, evaluate skill quality. PT triggers: /forge, criar uma skill, escrever uma skill, construir uma skill, nova skill, empacotar como skill, validar skill, melhorar disparo, otimizar descrição de skill. Do NOT use for: discovering which existing skill to apply (use a dispatch/meta skill), planning feature implementation, or designing software architecture.
shipping-and-launch
Prepares production launches with a pre-launch checklist, staged rollout, monitoring, and a rollback strategy — plus feature flag lifecycle (off → internal → beta → GA). Use when deploying a feature to production for the first time, releasing a significant change, or planning a rollout. EN triggers: /ship, pre-launch checklist, staged rollout, feature flag, rollback plan, monitoring. PT triggers: /shippar, checklist pré-lançamento, rollout gradual, feature flag, plano de rollback. Do NOT use for: pre-production development work, or one-off internal tools with no user exposure.