Understand the UI-Test Architecture Layers
mainThe Wikipedia iOS UI test suite uses a layered architecture to ensure deterministic and maintainable tests.
- Tests: High-level user journeys. They should only contain chains of robot calls and high-level assertions. They must not own selectors, waits, gestures, or launch arguments.
- Robots: The automation contract. Each robot represents one screen or a cohesive flow. They hide XCUITest mechanics and provide semantic actions (e.g.,
.openSearch()) and assertions (e.g.,.assertVisible()). - Accessibility Identifiers: The bridge between app code and tests. App code sets identifiers; robots query them. Use stable identifiers for root tabs, articles, search, and onboarding instead of localized text.
- Launch Configuration: Managed via
UITestConfiguration.swift. It handles app theme, language, onboarding state, and HTTP profiles. Avoid setting these ad hoc in individual tests. - Network Profiles:
fixture-strict(Default): Routes requests through bundled fixtures. Missing routes fail.e2e: Uses live networking.
- Fixtures: Production-grade API responses stored in
WikipediaUnitTests/Fixturesand registered inTestNetworkFixtures.json.