Replace brittle localized-string selectors and broken wait helpers with a robust, identifier-first UI test infrastructure. All 41 UI tests pass on iOS 26.2 simulator (iPhone 17). Foundation: - BaseUITestCase with deterministic launch helpers (launchClean, launchOffline) - WaitHelpers (waitUntilHittable, waitUntilGone, tapWhenReady) replacing sleep() - UITestID enum mirroring AccessibilityIdentifiers from the app target - Screen objects: TabBarScreen, CameraScreen, CollectionScreen, TodayScreen, SettingsScreen, PlantDetailScreen Key fixes: - Tab navigation uses waitForExistence+tap instead of isHittable (unreliable in iOS 26 simulator) - Tests handle real app state (empty collection, no camera permission) - Increased timeouts for parallel clone execution - Added NetworkMonitorProtocol and protocol-typed DI for testability - Fixed actor-isolation issues in unit test mocks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
704 B
Swift
30 lines
704 B
Swift
//
|
|
// PlantGuideUITests.swift
|
|
// PlantGuideUITests
|
|
//
|
|
// Smoke tests verifying the app launches and basic navigation works.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class PlantGuideUITests: BaseUITestCase {
|
|
|
|
// MARK: - Smoke Tests
|
|
|
|
@MainActor
|
|
func testAppLaunches() throws {
|
|
launchClean()
|
|
let tabs = TabBarScreen(app: app)
|
|
tabs.assertAllTabsExist()
|
|
}
|
|
|
|
@MainActor
|
|
func testLaunchPerformance() throws {
|
|
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
|
app.launchArguments += [LaunchConfigKey.uiTesting, LaunchConfigKey.skipOnboarding]
|
|
app.launchEnvironment[LaunchConfigKey.isUITesting] = "YES"
|
|
app.launch()
|
|
}
|
|
}
|
|
}
|