- 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>
136 lines
5.5 KiB
Swift
136 lines
5.5 KiB
Swift
import XCTest
|
|
|
|
/// Rebuild plan for legacy Suite3 failures (all blocked at residences tab precondition).
|
|
/// Old tests covered:
|
|
/// - test01_viewResidencesList
|
|
/// - test02_navigateToAddResidence
|
|
/// - test03_navigationBetweenTabs
|
|
/// - test04_cancelResidenceCreation
|
|
/// - test05_createResidenceWithMinimalData
|
|
/// - test06_viewResidenceDetails
|
|
final class Suite3_ResidenceRebuildTests: BaseUITestCase {
|
|
override var includeResetStateLaunchArgument: Bool { false }
|
|
override func setUpWithError() throws {
|
|
try super.setUpWithError()
|
|
UITestHelpers.ensureLoggedOut(app: app)
|
|
}
|
|
|
|
private func loginAndOpenResidences() {
|
|
UITestHelpers.ensureOnLoginScreen(app: app)
|
|
let login = LoginScreenObject(app: app)
|
|
login.waitForLoad(timeout: defaultTimeout)
|
|
login.enterUsername("testuser")
|
|
login.enterPassword("TestPass123!")
|
|
app.buttons[AccessibilityIdentifiers.Authentication.loginButton].waitForExistenceOrFail(timeout: defaultTimeout).forceTap()
|
|
|
|
let main = MainTabScreenObject(app: app)
|
|
main.waitForLoad(timeout: longTimeout)
|
|
main.goToResidences()
|
|
}
|
|
|
|
@discardableResult
|
|
private func createResidence(name: String) -> String {
|
|
loginAndOpenResidences()
|
|
|
|
let list = ResidenceListScreen(app: app)
|
|
list.waitForLoad(timeout: defaultTimeout)
|
|
list.openCreateResidence()
|
|
|
|
let form = ResidenceFormScreen(app: app)
|
|
form.waitForLoad(timeout: defaultTimeout)
|
|
form.enterName(name)
|
|
|
|
form.save()
|
|
return name
|
|
}
|
|
|
|
func testR301_authenticatedPreconditionCanReachMainApp() throws {
|
|
loginAndOpenResidences()
|
|
RebuildSessionAssertions.assertOnMainApp(app, timeout: defaultTimeout)
|
|
}
|
|
|
|
func testR302_residencesTabIsPresentAndNavigable() throws {
|
|
loginAndOpenResidences()
|
|
let residencesTab = app.tabBars.buttons.containing(NSPredicate(format: "label CONTAINS[c] 'Residences'")).firstMatch
|
|
XCTAssertTrue(residencesTab.exists, "Residences tab should exist")
|
|
}
|
|
|
|
func testR303_residencesListLoadsAfterTabSelection() throws {
|
|
loginAndOpenResidences()
|
|
let list = ResidenceListScreen(app: app)
|
|
list.waitForLoad(timeout: defaultTimeout)
|
|
XCTAssertTrue(list.addButton.exists, "Add residence button should be visible")
|
|
}
|
|
|
|
func testR304_openAddResidenceFormFromResidencesList() throws {
|
|
loginAndOpenResidences()
|
|
let list = ResidenceListScreen(app: app)
|
|
list.waitForLoad(timeout: defaultTimeout)
|
|
list.openCreateResidence()
|
|
|
|
let form = ResidenceFormScreen(app: app)
|
|
form.waitForLoad(timeout: defaultTimeout)
|
|
XCTAssertTrue(form.saveButton.exists, "Residence save button should exist")
|
|
}
|
|
|
|
func testR305_cancelAddResidenceReturnsToResidenceList() throws {
|
|
loginAndOpenResidences()
|
|
let list = ResidenceListScreen(app: app)
|
|
list.openCreateResidence()
|
|
|
|
let form = ResidenceFormScreen(app: app)
|
|
form.waitForLoad(timeout: defaultTimeout)
|
|
form.cancel()
|
|
|
|
list.waitForLoad(timeout: defaultTimeout)
|
|
}
|
|
|
|
func testR306_createResidenceMinimalDataSubmitsSuccessfully() throws {
|
|
let name = "UITest Home \(Int(Date().timeIntervalSince1970))"
|
|
_ = createResidence(name: name)
|
|
let created = app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@", name)).firstMatch
|
|
XCTAssertTrue(created.waitForExistence(timeout: longTimeout), "Created residence should appear in list")
|
|
}
|
|
|
|
func testR307_newResidenceAppearsInResidenceList() throws {
|
|
let name = "UITest Verify \(Int(Date().timeIntervalSince1970))"
|
|
_ = createResidence(name: name)
|
|
let created = app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@", name)).firstMatch
|
|
XCTAssertTrue(created.waitForExistence(timeout: longTimeout), "New residence should be visible in residences list")
|
|
}
|
|
|
|
func testR308_openResidenceDetailsFromResidenceList() throws {
|
|
let name = "UITest Detail \(Int(Date().timeIntervalSince1970))"
|
|
_ = createResidence(name: name)
|
|
|
|
let row = app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@", name)).firstMatch
|
|
row.waitForExistenceOrFail(timeout: longTimeout).forceTap()
|
|
|
|
let edit = app.buttons[AccessibilityIdentifiers.Residence.editButton]
|
|
let delete = app.buttons[AccessibilityIdentifiers.Residence.deleteButton]
|
|
let loaded = edit.waitForExistence(timeout: defaultTimeout) || delete.waitForExistence(timeout: defaultTimeout)
|
|
XCTAssertTrue(loaded, "Residence details should expose edit or delete actions")
|
|
}
|
|
|
|
func testR309_navigationAcrossPrimaryTabsAndBackToResidences() throws {
|
|
loginAndOpenResidences()
|
|
|
|
let tabBar = app.tabBars.firstMatch
|
|
tabBar.waitForExistenceOrFail(timeout: defaultTimeout)
|
|
|
|
let tasksTab = tabBar.buttons.containing(NSPredicate(format: "label CONTAINS[c] 'Tasks'")).firstMatch
|
|
XCTAssertTrue(tasksTab.exists, "Tasks tab should exist")
|
|
tasksTab.forceTap()
|
|
|
|
let contractorsTab = tabBar.buttons.containing(NSPredicate(format: "label CONTAINS[c] 'Contractors'")).firstMatch
|
|
XCTAssertTrue(contractorsTab.exists, "Contractors tab should exist")
|
|
contractorsTab.forceTap()
|
|
|
|
let residencesTab = tabBar.buttons.containing(NSPredicate(format: "label CONTAINS[c] 'Residences'")).firstMatch
|
|
residencesTab.forceTap()
|
|
|
|
let list = ResidenceListScreen(app: app)
|
|
list.waitForLoad(timeout: defaultTimeout)
|
|
}
|
|
}
|