AI Agent Hub
Back to skills
Uni-app Automated Testing Workflow icon

Uni-app Automated Testing Workflow

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_3141f90e/uniapp-test according to https://skillhub.cn/install/skillhub.md.

About this skill

What It Solves

uni-app (x) projects run across multiple targets, so selectors, event bindings, async rendering, and device differences make manual verification brittle. This skill turns automated testing into a repeatable workflow: it extracts page structure, event handlers, and reactive state from .uvue / .vue files under pages/, then generates maintainable Jest cases using the official uni-app automation testing APIs. When tests fail, it classifies the failure and iterates on the right layer.

How It Works and Where It Stops

The workflow is:
- Analyze pages: identify button, input, lists, custom components, @click, @input, @change, and reactive state in data, ref, or reactive.
- Write cases: colocate tests next to pages as [page-name].test.js; if the file exists, read it first and improve it rather than overwriting.
- Run tests: target Web, Android, iOS, Harmony, and WeChat Mini Program, and rerun only a failing file with --testcaseFile.
- Fix failures: separate test-code issues from product bugs, and stop after three consecutive unsuccessful fixes for the same error.

Boundaries: it should only touch the target page and its test file unless asked; prefer data-testid or stable class selectors; iOS testing is macOS simulator-only; defer to official docs when APIs are uncertain.

Use Cases

  • After adding a submit button to a login .uvue page, generate login.test.js to verify taps, inputs, and navigation.
  • When a list page fails on WeChat Mini Program, isolate event binding or selector issues and rerun the target test file.
  • Before Android device acceptance, run test:app-android and classify failed assertions as test-code or product bugs.
  • When a page lacks stable selectors, suggest data-testid on key elements and build maintainable automation cases.

Best For

  • Front-end engineers maintaining uni-app (x) pages who need repeatable Jest cases for cross-platform interactions.
  • QA engineers validating Mini Program and app builds who need to reproduce failures with --testcaseFile.
  • Developers inheriting .uvue pages who need to add stable selectors and assertions instead of manual clicking.
  • QA engineers running iOS simulator cases on macOS and distinguishing missing devices from real failures.