// // KordantUITests.swift // KordantUITests // // Created by Mike Freno on 5/25/26. // import XCTest /// Main entry point for Kordant UI test suite. /// Runs on device farm across iPhone SE, 14, and 15 Pro Max simulators. /// /// Coverage: /// - Auth flows (login, signup, forgot password, biometric prompt) /// - Dashboard (widgets, alerts, threat score, quick actions) /// - Services (DarkWatch, VoicePrint, SpamShield, HomeTitle, RemoveBrokers) /// - Settings (profile, notifications, theme, logout) /// - Accessibility (VoiceOver labels, dynamic type, contrast) final class KordantUITests: UITestBase { // MARK: - Launch Performance /// Measures cold launch time of the application. /// Acceptance criteria: < 2 seconds on iPhone 12 equivalent. func testLaunchPerformance() { // Measure the cold launch time of the application measure(metrics: [XCTApplicationLaunchMetric()]) { let perfApp = XCUIApplication() perfApp.launchArguments = ["-UITesting"] perfApp.launchEnvironment["UITestScenario"] = UITestScenario.authenticated.rawValue perfApp.launch() perfApp.terminate() } } // MARK: - Smoke Test /// Quick smoke test to verify the app launches and basic UI is intact. /// This is the fastest test in the suite and runs first. func testSmokeTestAppLaunches() { // App should launch to either auth or main screen depending on scenario let appVisible = app.otherElements.firstMatch.waitForExistence(timeout: 5) XCTAssertTrue(appVisible, "App should launch and display UI") } // MARK: - Cross-Cutting Navigation /// Verify the complete tab navigation flow works func testCompleteTabNavigationFlow() { // Navigate through all tabs let tabs: [TabBarItem] = [.dashboard, .services, .alerts, .settings, .account] for tab in tabs { navigateToTab(tab) let navBar = app.navigationBars[tab.rawValue] XCTAssertTrue(navBar.waitForExistence(timeout: 3), "Navigation bar for '\(tab.rawValue)' should exist") } } // MARK: - Test Report Attachment /// Capture final test report screenshot func testCaptureFinalState() { navigateToTab(.dashboard) captureScreen(name: "FinalTestState-Dashboard") navigateToTab(.services) captureScreen(name: "FinalTestState-Services") } }