Rearchitect UI test suite for complete, non-flaky coverage against live API
- Migrate Suite4-10, SmokeTests, NavigationCriticalPathTests to AuthenticatedTestCase with seeded admin account and real backend login - Add 34 accessibility identifiers across 11 app views (task completion, profile, notifications, theme, join residence, manage users, forms) - Create FeatureCoverageTests (14 tests) covering previously untested features: profile edit, theme selection, notification prefs, task completion, manage users, join residence, task templates - Create MultiUserSharingTests (18 API tests) and MultiUserSharingUITests (8 XCUI tests) for full cross-user residence sharing lifecycle - Add cleanup infrastructure: SuiteZZ_CleanupTests auto-wipes test data after runs, cleanup_test_data.sh script for manual reset via admin API - Add share code API methods to TestAccountAPIClient (generateShareCode, joinWithCode, getShareCode, listResidenceUsers, removeUser) - Fix app bugs found by tests: - ResidencesListView join callback now uses forceRefresh:true - APILayer invalidates task cache when residence count changes - AllTasksView auto-reloads tasks when residence list changes - Fix test quality: keyboard focus waits, Save/Add button label matching, Documents tab label (Docs), remove API verification from UI tests - DataLayerTests and PasswordResetTests now verify through UI, not API calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,13 @@ import XCTest
|
||||
/// Authentication flow tests
|
||||
/// Based on working SimpleLoginTest pattern
|
||||
final class Suite2_AuthenticationTests: BaseUITestCase {
|
||||
override var completeOnboarding: Bool { true }
|
||||
override var includeResetStateLaunchArgument: Bool { false }
|
||||
|
||||
|
||||
override func setUpWithError() throws {
|
||||
try super.setUpWithError()
|
||||
ensureLoggedOut()
|
||||
// Wait for app to stabilize, then ensure we're on the login screen
|
||||
sleep(2)
|
||||
ensureOnLoginScreen()
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
@@ -17,8 +18,23 @@ final class Suite2_AuthenticationTests: BaseUITestCase {
|
||||
|
||||
// MARK: - Helper Methods
|
||||
|
||||
private func ensureLoggedOut() {
|
||||
UITestHelpers.ensureLoggedOut(app: app)
|
||||
private func ensureOnLoginScreen() {
|
||||
let usernameField = app.textFields[AccessibilityIdentifiers.Authentication.usernameField]
|
||||
// Already on login screen
|
||||
if usernameField.waitForExistence(timeout: 3) {
|
||||
return
|
||||
}
|
||||
// If on main tabs, log out first
|
||||
let tabBar = app.tabBars.firstMatch
|
||||
if tabBar.exists {
|
||||
UITestHelpers.logout(app: app)
|
||||
// After logout, wait for login screen
|
||||
if usernameField.waitForExistence(timeout: 15) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Fallback: use ensureOnLoginScreen which handles onboarding state too
|
||||
UITestHelpers.ensureOnLoginScreen(app: app)
|
||||
}
|
||||
|
||||
private func login(username: String, password: String) {
|
||||
|
||||
Reference in New Issue
Block a user