// // StabilityTests.swift // SportsTimeUITests // // Stability stress tests: rapid tab switching, wizard open/close. // QA Sheet: P-014, P-015 // import XCTest final class StabilityTests: BaseUITestCase { /// P-014: Rapidly switch between all 5 tabs 50 times — no crash. @MainActor func testP014_RapidTabSwitching() { let home = HomeScreen(app: app) home.waitForLoad() let tabs = [home.scheduleTab, home.myTripsTab, home.progressTab, home.settingsTab, home.homeTab] for cycle in 0..<10 { for tab in tabs { tab.tap() } // Every 5 cycles, verify the app is still responsive if cycle % 5 == 4 { home.switchToTab(home.homeTab) XCTAssertTrue( home.startPlanningButton.waitForExistence( timeout: BaseUITestCase.shortTimeout), "App should remain responsive after \(cycle + 1) tab cycles" ) } } captureScreenshot(named: "P014-RapidTabs-Complete") } /// P-015: Open and close the wizard 20 times — no crash, no memory growth. @MainActor func testP015_RapidWizardOpenClose() { let home = HomeScreen(app: app) home.waitForLoad() for i in 0..<20 { home.tapStartPlanning() let wizard = TripWizardScreen(app: app) wizard.waitForLoad() wizard.tapCancel() // Verify we're back on home if i % 5 == 4 { XCTAssertTrue( home.startPlanningButton.waitForExistence( timeout: BaseUITestCase.defaultTimeout), "Should return to Home after wizard cycle \(i + 1)" ) } } captureScreenshot(named: "P015-RapidWizard-Complete") } }