Fix UI test failures: registration dismiss cascade, onboarding reset, test stability
- Fix registration flow dismiss cascade: chain fullScreenCover → sheet onDismiss so auth state is set only after all UIKit presentations are removed, preventing RootView from swapping LoginView→MainTabView behind a stale sheet - Fix onboarding reset: set hasCompletedOnboarding directly instead of calling completeOnboarding() which has an auth guard that fails after DataManager.clear() - Stabilize Suite1 registration tests, Suite6 task tests, Suite7 contractor tests - Add clean-slate-per-suite via AuthenticatedUITestCase reset state - Improve test account seeding and screen object reliability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,9 +22,25 @@ final class Suite6_ComprehensiveTaskTests: AuthenticatedUITestCase {
|
||||
|
||||
// Test data tracking
|
||||
var createdTaskTitles: [String] = []
|
||||
private static var hasCleanedStaleData = false
|
||||
|
||||
override func setUpWithError() throws {
|
||||
try super.setUpWithError()
|
||||
|
||||
// Dismiss any open form from previous test
|
||||
let cancelButton = app.buttons[AccessibilityIdentifiers.Task.formCancelButton].firstMatch
|
||||
if cancelButton.exists { cancelButton.tap() }
|
||||
|
||||
// One-time cleanup of stale tasks from previous test runs
|
||||
if !Self.hasCleanedStaleData {
|
||||
Self.hasCleanedStaleData = true
|
||||
if let stale = TestAccountAPIClient.listTasks(token: session.token) {
|
||||
for task in stale {
|
||||
_ = TestAccountAPIClient.deleteTask(token: session.token, id: task.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure at least one residence exists (task add button requires it)
|
||||
if let residences = TestAccountAPIClient.listResidences(token: session.token),
|
||||
residences.isEmpty {
|
||||
@@ -109,6 +125,9 @@ final class Suite6_ComprehensiveTaskTests: AuthenticatedUITestCase {
|
||||
cleaner.trackTask(created.id)
|
||||
}
|
||||
|
||||
// Navigate to tasks tab to trigger list refresh and reset scroll position
|
||||
navigateToTasks()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user