import XCTest /// Tests for previously uncovered features: task completion, profile edit, /// manage users, join residence, task templates, notification preferences, /// and theme selection. final class FeatureCoverageTests: AuthenticatedUITestCase { override var needsAPISession: Bool { true } override var testCredentials: (username: String, password: String) { ("admin", "Test1234") } override var apiCredentials: (username: String, password: String) { ("admin", "Test1234") } // MARK: - Helpers /// Navigate to the settings sheet via the Residences tab settings button. private func openSettingsSheet() { navigateToResidences() let settingsButton = app.buttons[AccessibilityIdentifiers.Navigation.settingsButton] settingsButton.waitForExistenceOrFail( timeout: defaultTimeout, message: "Settings button should be visible on the Residences tab" ) settingsButton.forceTap() // Wait for the settings sheet to appear let settingsContent = app.staticTexts.containing( NSPredicate(format: "label CONTAINS[c] 'Profile' OR label CONTAINS[c] 'Account' OR label CONTAINS[c] 'Settings' OR label CONTAINS[c] 'Theme'") ).firstMatch _ = settingsContent.waitForExistence(timeout: defaultTimeout) } /// Dismiss a presented sheet by tapping the first matching toolbar button. private func dismissSheet(buttonLabel: String) { let button = app.buttons[buttonLabel] if button.waitForExistence(timeout: defaultTimeout) { button.forceTap() _ = button.waitForNonExistence(timeout: defaultTimeout) } } /// Scroll down in the topmost collection/scroll view to find elements below the fold. private func scrollDown(times: Int = 3) { let collectionView = app.collectionViews.firstMatch let scrollView = app.scrollViews.firstMatch let target = collectionView.exists ? collectionView : scrollView guard target.exists else { return } for _ in 0..