Add comprehensive UI test infrastructure with Page Object pattern, accessibility identifiers, UI test mode (--ui-testing, --reset-state, --disable-animations), and 10 passing tests covering app launch, tab navigation, trip wizard, trip saving, settings, schedule, and accessibility at XXXL Dynamic Type. Also adds a 229-case QA test plan Excel workbook for manual QA handoff. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
2.1 KiB
Swift
67 lines
2.1 KiB
Swift
//
|
|
// TripSavingTests.swift
|
|
// SportsTimeUITests
|
|
//
|
|
// Tests the end-to-end trip saving flow: plan → select → save → verify in My Trips.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class TripSavingTests: BaseUITestCase {
|
|
|
|
/// Plans a trip, selects an option, saves it, and verifies it appears in My Trips.
|
|
@MainActor
|
|
func testSaveTripAppearsInMyTrips() {
|
|
let home = HomeScreen(app: app)
|
|
home.waitForLoad()
|
|
home.tapStartPlanning()
|
|
|
|
// Plan a trip using date range mode
|
|
let wizard = TripWizardScreen(app: app)
|
|
wizard.waitForLoad()
|
|
wizard.selectDateRangeMode()
|
|
|
|
wizard.nextMonthButton.scrollIntoView(in: app.scrollViews.firstMatch)
|
|
wizard.selectDateRange(
|
|
targetMonth: "June",
|
|
targetYear: "2026",
|
|
startDay: "2026-06-11",
|
|
endDay: "2026-06-16"
|
|
)
|
|
wizard.selectSport("mlb")
|
|
wizard.selectRegion("central")
|
|
wizard.tapPlanTrip()
|
|
|
|
// Select first trip option
|
|
let options = TripOptionsScreen(app: app)
|
|
options.waitForLoad()
|
|
options.selectTrip(at: 0)
|
|
|
|
// Save the trip
|
|
let detail = TripDetailScreen(app: app)
|
|
detail.waitForLoad()
|
|
detail.assertSaveState(isSaved: false)
|
|
detail.tapFavorite()
|
|
|
|
// Allow save to persist
|
|
detail.assertSaveState(isSaved: true)
|
|
|
|
captureScreenshot(named: "TripSaving-Favorited")
|
|
|
|
// Navigate back to My Trips tab
|
|
// Dismiss the entire wizard sheet: Detail → Options → Wizard → Cancel
|
|
app.navigationBars.buttons.firstMatch.tap() // Back from detail to options
|
|
// Back from options to wizard
|
|
let wizardBackBtn = app.navigationBars.buttons.firstMatch
|
|
wizardBackBtn.waitUntilHittable(timeout: BaseUITestCase.shortTimeout).tap()
|
|
// Cancel the wizard sheet
|
|
wizard.tapCancel()
|
|
// Now the tab bar is accessible
|
|
home.switchToTab(home.myTripsTab)
|
|
|
|
// Assert: Saved trip appears (empty state should NOT be visible)
|
|
let myTrips = MyTripsScreen(app: app)
|
|
myTrips.assertHasTrips()
|
|
}
|
|
}
|