qa-state-persistence
QA test skill for verifying UI state persistence across navigation. Tests that state changes (likes, bookmarks, cart items, form inputs) survive scrolling away and returning. Uses CDP + agent-device dual-driver architecture. Works with any React Native app that uses list-based feeds or scrollable content. Invoke when user says "test state persistence", "test like state", "verify bookmark persists", "QA the state", "test data survives scroll", "verify UI state", or any task requiring state persistence verification across navigation.
- License 许可
- MIT
- 最近更新
- 2026-07-29
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- qa-state-persistence
- description
- QA test skill for verifying UI state persistence across navigation. Tests that state changes (likes, bookmarks, cart items, form inputs) survive scrolling away and returning. Uses CDP + agent-device dual-driver architecture. Works with any React Native app that uses list-based feeds or scrollable content. Invoke when user says "test state persistence", "test like state", "verify bookmark persists", "QA the state", "test data survives scroll", "verify UI state", or any task requiring state persistence verification across navigation.
- allowed-tools
- Bash(agent-device:*) Bash(agent-browser:*) Bash(xcrun:*) Bash(node:*) Bash(curl:*) Bash(npx:*) Read
02 资源文件 3
- 脚本flows/example-state-test.sh13.6 KB
- 脚本lib/state-helpers.sh11.4 KB
- 脚本run.sh1.8 KB
03 SKILL.md 正文
qa-state-persistence
QA test skill for verifying UI state persistence across navigation. Tests that state changes (likes, bookmarks, cart additions, form inputs) survive scrolling away and returning. Uses the dual-driver architecture (CDP + agent-device).
What It Tests
| Test | Method | Assertion |
|---|---|---|
| Navigate to feed | CDP navigation | Route is on feed screen |
| Record item identity | CDP feed data query | Item ID and initial state captured |
| Verify initial state | CDP property query | State property is in expected initial value |
| Mutate state | CDP data mutation | Property flips (e.g., isLiked: false → true) |
| Scroll away (N items) | CDP scroll or agent-device swipe | Feed index advances |
| Scroll back | CDP scrollToIndex(0) |
Feed index returns to 0 |
| State persisted | CDP property query | KEY ASSERTION: property still has mutated value |
| Cleanup | CDP data mutation | Restore original state |
| Final route check | CDP cdp_get_route |
Still on feed screen |
Configuration
Set your app-specific values in qa.config.sh:
# What property to test
export STATE_PROPERTY="isLiked" # Property name to toggle
export STATE_COUNTER_PROPERTY="likesCount" # Associated counter (optional)
export STATE_SCROLL_COUNT=5 # How many items to scroll past
# Feed screen
export SCREEN_EXPLORE="ExploreScreen" # Your feed screen name
# Feed debug hook (set up in your app's dev build)
export GLOBAL_FEED_VAR="__qaFeedState" # Global variable name
Setting Up the Feed Debug Hook
In your app's feed component (dev builds only), expose:
// In your feed component (e.g., ExploreFeed.tsx):
if (__DEV__) {
globalThis.__qaFeedState = {
currentIndex: currentIndex,
scrollToNext: () => flatListRef.current?.scrollToIndex({ index: currentIndex + 1 }),
scrollToIndex: (i) => flatListRef.current?.scrollToIndex({ index: i }),
getData: () => feedData, // Return the full data array
getItem: (i) => feedData[i], // Return item at index
dataLength: feedData.length,
};
}
Architecture
CDP (Hermes Runtime) agent-device (Simulator)
┌──────────────────────┐ ┌──────────────────────┐
│ navigate to tab │ │ screenshot capture │
│ install state hook │ │ tap fallback (if CDP │
│ query item property │ │ mutation fails) │
│ mutate item property │ │ swipe fallback (if │
│ scrollToNext() │ │ scroll hook absent) │
│ scrollToIndex(0) │ │ │
│ read feed data │ │ │
└──────────────────────┘ └──────────────────────┘
Usage
Run the example test
bash .pi/skills/qa-automation/qa-state-persistence/run.sh
View results
- Screenshots:
/tmp/qa-tests/screenshots/<test-name>/ - Report JSON:
/tmp/qa-tests/<test-name>-report.json
Test Flow Diagram
┌─────────────────┐
│ Navigate to │
│ Feed Screen │
└────────┬────────┘
│
┌────────▼────────┐
│ Record item #0 │
│ (state=initial) │
└────────┬────────┘
│
┌────────▼────────┐
│ Mutate state │
│ (state=changed) │
└────────┬────────┘
│
┌────────▼────────┐
│ Scroll away Nx │
│ (index → N) │
└────────┬────────┘
│
┌────────▼────────┐
│ Scroll back to 0 │
│ (index → 0) │
└────────┬────────┘
│
┌────────▼────────┐
│ ★ VERIFY: state │
│ persisted! │
└────────┬────────┘
│
┌────────▼────────┐
│ Cleanup (restore │
│ original state) │
└─────────────────┘
File Structure
qa-state-persistence/
├── SKILL.md # This file
├── lib/
│ └── state-helpers.sh # State query, mutation, scroll-to-index
├── flows/
│ └── example-state-test.sh # Example test (customize for your app)
└── run.sh # Runner with JSON report output
Troubleshooting
"Feed hook not available"
The __qaFeedState global isn't set. Ensure:
- Your feed component sets it up in
__DEV__mode - The feed screen is mounted (navigate to it first)
- The hook name matches
GLOBAL_FEED_VARin config
"Could not read feed data"
getData() or getItem() failed. Possible causes:
- Component hasn't fully mounted yet (increase settle time)
- Feed data structure changed
- Hook was set up before data loaded
"scrollToIndex not available"
The hook doesn't expose scrollToIndex. The test falls back to repeated swipe-down gestures.
"State lost after scroll"
This is the real failure the test catches. If state doesn't persist, investigate:
- List item recycling (FlatList/FlashList virtualization)
- State management (local vs global state)
- Cache invalidation during scroll
- Component unmount/remount cycles
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.