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:
treyt
2026-03-15 17:32:13 -05:00
parent cf2e6d8bcc
commit 5c360a2796
57 changed files with 3781 additions and 928 deletions

View File

@@ -12,9 +12,7 @@ import XCTest
///
/// IMPORTANT: These are integration tests requiring network connectivity.
/// Run against a test/dev server, NOT production.
final class Suite10_ComprehensiveE2ETests: BaseUITestCase {
override var includeResetStateLaunchArgument: Bool { false }
final class Suite10_ComprehensiveE2ETests: AuthenticatedTestCase {
// Test run identifier for unique data - use static so it's shared across test methods
private static let testRunId = Int(Date().timeIntervalSince1970)
@@ -33,12 +31,10 @@ final class Suite10_ComprehensiveE2ETests: BaseUITestCase {
override func setUpWithError() throws {
try super.setUpWithError()
// Register user on first test, then just ensure logged in for subsequent tests
// Register user on first test if needed (for multi-user E2E scenarios)
if !Self.userRegistered {
registerTestUser()
Self.userRegistered = true
} else {
UITestHelpers.ensureLoggedIn(app: app, username: testUsername, password: testPassword)
}
}
@@ -131,14 +127,6 @@ final class Suite10_ComprehensiveE2ETests: BaseUITestCase {
// MARK: - Helper Methods
private func navigateToTab(_ tabName: String) {
let tab = app.tabBars.buttons.containing(NSPredicate(format: "label CONTAINS[c] '\(tabName)'")).firstMatch
if tab.waitForExistence(timeout: 5) && !tab.isSelected {
tab.tap()
sleep(2)
}
}
/// Dismiss keyboard by tapping outside (doesn't submit forms)
private func dismissKeyboard() {
// Tap on a neutral area to dismiss keyboard without submitting
@@ -154,7 +142,7 @@ final class Suite10_ComprehensiveE2ETests: BaseUITestCase {
navigateToTab("Residences")
sleep(2)
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton]
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton].firstMatch
guard addButton.waitForExistence(timeout: 5) else {
XCTFail("Add residence button not found")
return false
@@ -600,7 +588,7 @@ final class Suite10_ComprehensiveE2ETests: BaseUITestCase {
}
// Try to add contractor
let addButton = app.buttons[AccessibilityIdentifiers.Contractor.addButton]
let addButton = app.buttons[AccessibilityIdentifiers.Contractor.addButton].firstMatch
guard addButton.waitForExistence(timeout: 5) else {
// May need residence first
return