writing-ui-tests

Guides writing and stabilizing XCUITest UI tests for the Moolah macOS app.

1|Updated Apr 5, 2026
One-click install
npx skills add https://github.com/moolah-rocks/moolah-native --skill writing-ui-tests-moolah-rocks
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: writing-ui-tests
Source: https://github.com/moolah-rocks/moolah-native/tree/main/.claude/skills/writing-ui-tests
Command: npx skills add https://github.com/moolah-rocks/moolah-native --skill writing-ui-tests-moolah-rocks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? UI tests in this SwiftUI codebase are expensive and flaky when written ad hoc. This Skill enforces a disciplined workflow — driver-first design, deterministic seeds, bounded waits, and a 20-run stability gate — so new UI tests are reliable and maintainable instead of timing out or flaking in CI. ## Core Features & Use Cases - Decision gate: Helps you decide whether a behaviour truly needs a UI test or is cheaper to cover with a store test against TestBackend. - Driver-first test authoring: Enforces extending screen drivers (sidebar, transaction list, detail, dialogs) with Trace.record, bounded post-condition waits, and UITestIdentifiers constants instead of inlining XCUI primitives. - Deterministic seeds and identifiers: Reuses or adds hard-coded UUID seeds in UITestSeeds.swift and incremental accessibility identifiers. - Failure triage and stability gates: Reads tree.txt, screenshot.png, seed.txt, and trace.txt artefacts, runs a @ui-test-review pass, and requires 20 consecutive passing runs before opening a PR. - Use Case: You need a test proving that opening a trade focuses the payee field. The Skill walks you through picking the tradeBaseline seed, extending the transaction detail driver with a focus expectation, and validating the test across 20 runs. ## Quick Start Ask the assistant to write a UI test for a specific Moolah macOS behaviour, naming the screen and the expected outcome.

Frequently Asked Questions about writing-ui-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a UI test for a SwiftUI macOS app with XCUITest?▼

Structure the test as driver actions followed by driver expectations, inheriting a base test case that captures failure artefacts. Extend screen drivers with methods that record traces and wait on bounded post-conditions rather than inlining XCUIElement queries in the test body.

When should I write a UI test instead of a unit or store test?▼

Write a UI test only when the failure class requires the real SwiftUI event loop, such as @FocusState behaviour, autocomplete overlay timing, real keyboard events, or multi-leg form reveals. Everything else is cheaper and more reliable as a store test against an in-memory backend.

Why is my XCUITest flaky and how do I fix it?▼

Flakiness almost always means a driver action is missing a proper post-condition wait. Replace Thread.sleep with a bounded wait on a real signal like an element appearing or a value propagating, then verify stability with 20 consecutive passing runs.

Why does my UI test hang at launch on macOS?▼

A missing .env file in a worktree causes different code signing, so macOS shows a TCC prompt for Documents access that blocks XCUIApplication.launch indefinitely. Copy .env from the main checkout so DEVELOPMENT_TEAM and the signing identity match.

How do I add accessibility identifiers for UI testing in SwiftUI?▼

Add identifier constants to a shared identifiers file using an area.element namespace, then apply .accessibilityIdentifier to the targeted view. Add only the identifiers the current test needs rather than bulk-annotating views.