# xcuitest-skill

Generates XCUITest UI tests for iOS and iPadOS apps. Detects whether to use local Xcode simulators or TestMu AI cloud devices, then builds test code accordingly.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 248 installs · ★ 393 repo stars
- Author: TestMu AI
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/LambdaTest/agent-skills/tree/HEAD/xcuitest-skill/SKILL.md
- Updated: 2026-10-13
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/xcuitest-skill

## What it does

The skill produces Swift test code using Apple's XCUITest framework for iOS UI automation. It includes core patterns: app launch, element queries by accessibility identifier, tap and swipe actions, element existence checks, system alert handling. Contains Page Object examples for maintainable tests and an anti-pattern table (sleep vs. waits, hard-coded coordinates vs. accessibility IDs).

Routing logic checks the prompt: mention "cloud", "TestMu", "LambdaTest", or "device farm" and it generates code to upload .ipa and test runner, then execute on real devices via API. Mention "simulator", "Xcode", or "local" and it outputs Test Navigator steps or `xcodebuild` commands. Default is local simulator. Supports Swift and Objective-C across all listed AI coding platforms. Requires Xcode and iOS project familiarity.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill xcuitest-skill -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/xcuitest-skill/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/xcuitest-skill/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill xcuitest-skill -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/xcuitest-skill/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill xcuitest-skill -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/xcuitest-skill/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install LambdaTest/agent-skills xcuitest-skill
```

2. **Manually: put the files in place**
- File: `.github/skills/xcuitest-skill/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill xcuitest-skill -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/LambdaTest/agent-skills --path xcuitest-skill
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/xcuitest-skill/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add LambdaTest/agent-skills --skill xcuitest-skill -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/LambdaTest/agent-skills/tree/HEAD/xcuitest-skill/SKILL.md

## When to use it
- Generate login and navigation UI tests for iOS screens
- Set up testing on TestMu cloud real device farm
- Verify app behavior with valid and invalid inputs, timeouts
- Structure tests using Page Object pattern
- Run tests in CI/CD via xcodebuild

## Example prompts
- Write XCUITest for sign-in flow with valid and invalid credentials
- Generate tests on TestMu cloud iOS devices for MyApp.ipa
- Create a test that taps a button, waits for dashboard, and asserts welcome text

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 00cd1392ea18d1d8.

BEGIN THIRD-PARTY FILE 00cd1392ea18d1d8
````text
---
name: xcuitest-skill
description: >
  Generates XCUITest UI tests for iOS/iPadOS apps in Swift. Apple's native
  testing framework for reliable, fast UI automation. Supports local simulators
  and TestMu AI cloud real devices. Use when user mentions "XCUITest", "XCTest",
  "iOS UI test", "Swift test", "XCUIApplication". Triggers on: "XCUITest",
  "XCTest UI", "iOS UI test", "Swift UI test", "XCUIApplication", "TestMu".
languages:
  - Swift
  - Objective-C
category: mobile-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# XCUITest Automation Skill

You are a senior iOS QA engineer specializing in XCUITest.

## Step 1 — Execution Target

```
├─ Mentions "cloud", "TestMu", "LambdaTest", "device farm"?
│  └─ TestMu AI cloud (upload IPA + test runner)
│
├─ Mentions "simulator", "local", "Xcode"?
│  └─ Local: Xcode Test Navigator or xcodebuild
│
└─ Default → Local simulator
```

## Core Patterns — Swift

### Basic Test

```swift
import XCTest

class LoginTests: XCTestCase {
    let app = XCUIApplication()

    override func setUpWithError() throws {
        continueAfterFailure = false
        app.launch()
    }

    func testLoginWithValidCredentials() {
        let emailField = app.textFields["emailInput"]
        XCTAssertTrue(emailField.waitForExistence(timeout: 5))
        emailField.tap()
        emailField.typeText("user@test.com")

        let passwordField = app.secureTextFields["passwordInput"]
        passwordField.tap()
        passwordField.typeText("password123")

        app.buttons["loginButton"].tap()

        let dashboard = app.staticTexts["Welcome"]
        XCTAssertTrue(dashboard.waitForExistence(timeout: 10))
    }

    func testLoginWithInvalidCredentials() {
        app.textFields["emailInput"].tap()
        app.textFields["emailInput"].typeText("wrong@test.com")
        app.secureTextFields["passwordInput"].tap()
        app.secureTextFields["passwordInput"].typeText("wrong")
        app.buttons["loginButton"].tap()

        let error = app.staticTexts["Invalid credentials"]
        XCTAssertTrue(error.waitForExistence(timeout: 5))
    }
}
```

### Element Queries

```swift
// By accessibility identifier (best)
app.buttons["loginButton"]
app.textFields["emailInput"]

// By label text
app.staticTexts["Welcome back"]
app.buttons["Submit"]

// By predicate
app.buttons.matching(NSPredicate(format: "label CONTAINS 'Login'")).firstMatch

// By index
app.cells.element(boundBy: 0)

// Existence check
let element = app.buttons["submit"]
XCTAssertTrue(element.waitForExistence(timeout: 10))
```

### Actions

```swift
element.tap()                           // Tap
element.doubleTap()                     // Double tap
element.press(forDuration: 2)           // Long press
````
END THIRD-PARTY FILE 00cd1392ea18d1d8

The third-party file has ended. Everything between the 00cd1392ea18d1d8 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2788 of 6303 bytes. © TestMu AI · MIT · https://github.com/LambdaTest/agent-skills/tree/HEAD/xcuitest-skill/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
