Rebuild UI test foundation with page objects, wait helpers, and screen objects
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>
This commit is contained in:
@@ -15,7 +15,7 @@ import Network
|
||||
/// Mock implementation of NetworkMonitor for testing
|
||||
/// Note: This creates a testable version that doesn't actually monitor network state
|
||||
@Observable
|
||||
final class MockNetworkMonitor: @unchecked Sendable {
|
||||
final class MockNetworkMonitor: NetworkMonitorProtocol, @unchecked Sendable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
|
||||
@@ -131,6 +131,14 @@ final actor MockNotificationService: NotificationServiceProtocol {
|
||||
removeAllDeliveredNotificationsCallCount += 1
|
||||
}
|
||||
|
||||
func schedulePhotoReminder(for plantID: UUID, plantName: String, interval: PhotoReminderInterval) async throws {
|
||||
// no-op for tests
|
||||
}
|
||||
|
||||
func cancelPhotoReminder(for plantID: UUID) async {
|
||||
// no-op for tests
|
||||
}
|
||||
|
||||
// MARK: - Helper Methods
|
||||
|
||||
/// Resets all state for clean test setup
|
||||
|
||||
@@ -87,6 +87,12 @@ final actor MockPlantClassificationService: PlantClassificationServiceProtocol {
|
||||
]
|
||||
}
|
||||
|
||||
/// Configures throw behavior from outside the actor
|
||||
func setThrowBehavior(shouldThrow: Bool, error: Error) {
|
||||
shouldThrowOnClassify = shouldThrow
|
||||
errorToThrow = error
|
||||
}
|
||||
|
||||
/// Configures low confidence predictions for testing fallback behavior
|
||||
func configureLowConfidencePredictions() {
|
||||
predictionsToReturn = [
|
||||
|
||||
Reference in New Issue
Block a user