Xcuitest

Prisma-Labs-Dev/apple-skills/skills/xcuitest

作者 Prisma-Labs-Dev498626005e65783ebe8570a103b2335cf397768c无许可证收录于 2026年10月9日更新于 2026年10月9日

API reference: XCUITest. Query for element queries, waiting patterns, Swift 6 @MainActor, assertions, screenshots, launch arguments.

AI 生成的概览

用于编写可靠的 Swift 6 XCUITest UI 测试的参考指南,涵盖查询、等待、断言和截图。

功能
该技能是 XCUITest 与 XCUIAutomation 的 API 参考。它提供带代码示例的主题指南,涵盖元素查询、交互、等待模式、Swift 6 并发、断言、截图、启动参数、权限、测试辅助工具、故障排查和高级模式。它还附带本地下载的 XCTest 与 XCUIAutomation 类及索引的 Apple 文档页面。
适用场景
适用于在 Swift 中编写、调试或审查 Apple 平台的 XCUITest UI 测试时。适合查阅 waitForExistence、XCUIElementQuery、启动参数或截图附件等 API 细节。也有助于处理测试类中的 Swift 6 严格并发问题。
运行要求
不含脚本,仅为说明和 Markdown 参考文件。阅读随附文件无需软件包或凭据,但技能建议在本地未覆盖的主题上通过网络访问文档镜像。

XCUITest Reference

Comprehensive reference for writing reliable XCUITest UI tests in Swift 6.

Quick Reference

swift
// Basic test structure@MainActorfinal class MyUITests: XCTestCase {    var app: XCUIApplication!
    override func setUp() {        super.setUp()        continueAfterFailure = false        app = XCUIApplication()        app.launch()    }
    func testExample() {        let button = app.buttons["Submit"]        XCTAssertTrue(button.waitForExistence(timeout: 5))        button.tap()    }}

Topic Guides

Curated guidance with code examples (grep-friendly):

FileContent
element-queries.md [blocked]Core API classes: XCUIApplication, XCUIElement, XCUIElementQuery, XCUICoordinate
interactions.md [blocked]Taps, presses, text input, swipes, coordinate-based and other gestures
waiting.md [blocked]waitForExistence, XCTWaiter, non-existence, property waits, Xcode 26 KeyPath waits
swift6-concurrency.md [blocked]Swift 6 strict concurrency: @MainActor test classes, async setUp/tearDown, nonisolated
assertions.md [blocked]XCTAssert patterns, custom messages, existence checks
screenshots.md [blocked]Screenshots, XCTAttachment, screenshot-on-failure, extracting from .xcresult
launch-arguments.md [blocked]Launch arguments/environment, UserDefaults override, localization and accessibility testing
permissions.md [blocked]resetAuthorizationStatus, XCUIProtectedResource, interruption monitors, springboard/system alerts
test-helpers.md [blocked]Page Object Model, reusable helpers, timeout constants
troubleshooting.md [blocked]Common failures (element not found, flaky tests) and what's new in Xcode 26 / iOS 26
patterns.md [blocked]Advanced patterns: base test class, system dialogs, scroll/wait, debugging, test organization

Downloaded Reference Files

Apple documentation pages available locally:

FileContent
xctest-index.md [blocked]Full XCTest framework index
xcuiautomation-index.md [blocked]Full XCUIAutomation framework index
xcuiapplication.md [blocked]XCUIApplication class
xcuielement.md [blocked]XCUIElement class
xcuielementquery.md [blocked]XCUIElementQuery class
xcuicoordinate.md [blocked]XCUICoordinate class
xcuiprotectedresource.md [blocked]XCUIProtectedResource enum
xcuiscreenshot.md [blocked]XCUIScreenshot class

Sources

Apple Documentation

WWDC Sessions

Community Resources

Fetching More Apple Docs

  1. Search this skill's local .md files first.
  2. If the topic is not here, check the other installed Apple skills you have available by their names, descriptions, or SKILL.md frontmatter, then grep their local files. This is faster and uses less context than fetching new docs from the internet.
  3. If no installed skill has the page, use the relevant documentation path from the local XCTest or XCUIAutomation indexes with the sosumi.ai Markdown mirror. For example, /documentation/xcuiautomation/xcuielement maps to https://sosumi.ai/documentation/xcuiautomation/xcuielement.

来源与署名

来源:Prisma-Labs-Dev/apple-skills位于skills/xcuitest提交4986260

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架