// // TripWizardFlowTests.swift // SportsTimeUITests // // Tests the trip planning wizard: date range mode, calendar navigation, // sport/region selection, and planning engine results. // import XCTest final class TripWizardFlowTests: BaseUITestCase { /// Full flow: Start Planning → Date Range → Select dates → MLB → Central → Plan. /// Asserts the planning engine returns results. @MainActor func testDateRangeTripPlanningFlow() { let home = HomeScreen(app: app) home.waitForLoad() home.tapStartPlanning() let wizard = TripWizardScreen(app: app) wizard.waitForLoad() // Step 1: Select "By Dates" mode wizard.selectDateRangeMode() // Step 2: Navigate to June 2026 and select June 11-16 // Scroll to see dates step wizard.nextMonthButton.scrollIntoView(in: app.scrollViews.firstMatch) wizard.selectDateRange( targetMonth: "June", targetYear: "2026", startDay: "2026-06-11", endDay: "2026-06-16" ) // Step 3: Select MLB wizard.selectSport("mlb") // Step 4: Select Central region wizard.selectRegion("central") // Step 5: Tap Plan My Trip wizard.tapPlanTrip() // Assert: Trip Options screen appears with results let options = TripOptionsScreen(app: app) options.waitForLoad() options.assertHasResults() captureScreenshot(named: "TripWizard-PlanningResults") } /// Verifies the wizard can be dismissed via Cancel. @MainActor func testWizardCanBeDismissed() { let home = HomeScreen(app: app) home.waitForLoad() home.tapStartPlanning() let wizard = TripWizardScreen(app: app) wizard.waitForLoad() wizard.tapCancel() // Assert: Back on home screen XCTAssertTrue( home.startPlanningButton.waitForExistence(timeout: BaseUITestCase.defaultTimeout), "Should return to Home after cancelling wizard" ) } }