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:
@@ -12,9 +12,7 @@ import XCTest
|
||||
///
|
||||
/// IMPORTANT: These tests create real data and require network connectivity.
|
||||
/// Run with a test server or dev environment (not production).
|
||||
final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
override var includeResetStateLaunchArgument: Bool { false }
|
||||
|
||||
final class Suite9_IntegrationE2ETests: AuthenticatedTestCase {
|
||||
|
||||
// Test user credentials - unique per test run
|
||||
private let timestamp = Int(Date().timeIntervalSince1970)
|
||||
@@ -48,15 +46,6 @@ final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
UITestHelpers.login(app: app, username: username, password: password)
|
||||
}
|
||||
|
||||
/// Navigate to a specific tab
|
||||
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() {
|
||||
let coordinate = app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.1))
|
||||
@@ -181,7 +170,7 @@ final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
let residenceName = "E2E Test Home \(timestamp)"
|
||||
|
||||
// Phase 1: Create residence
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton]
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton].firstMatch
|
||||
XCTAssertTrue(addButton.waitForExistence(timeout: 5), "Add residence button should exist")
|
||||
addButton.tap()
|
||||
sleep(2)
|
||||
@@ -380,7 +369,7 @@ final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
navigateToTab("Residences")
|
||||
sleep(2)
|
||||
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton]
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton].firstMatch
|
||||
if addButton.waitForExistence(timeout: 5) {
|
||||
addButton.tap()
|
||||
sleep(2)
|
||||
@@ -437,7 +426,7 @@ final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
// MARK: - Helper: Create Minimal Residence
|
||||
|
||||
private func createMinimalResidence(name: String) {
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton]
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Residence.addButton].firstMatch
|
||||
guard addButton.waitForExistence(timeout: 5) else { return }
|
||||
|
||||
addButton.tap()
|
||||
@@ -516,7 +505,7 @@ final class Suite9_IntegrationE2ETests: BaseUITestCase {
|
||||
// MARK: - Helper: Find Add Task Button
|
||||
|
||||
private func findAddTaskButton() -> XCUIElement {
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Task.addButton]
|
||||
let addButton = app.buttons[AccessibilityIdentifiers.Task.addButton].firstMatch
|
||||
if addButton.exists {
|
||||
return addButton
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user