diff --git a/SportsTimeUITests/Tests/HomeTests.swift b/SportsTimeUITests/Tests/HomeTests.swift index 992842d..dbe4409 100644 --- a/SportsTimeUITests/Tests/HomeTests.swift +++ b/SportsTimeUITests/Tests/HomeTests.swift @@ -3,7 +3,7 @@ // SportsTimeUITests // // Tests for the Home tab: hero card, start planning, toolbar button, recent trips, polls. -// QA Sheet: F-012, F-013, F-014, F-015, F-017, F-018, F-019, F-020, F-081, F-083, F-084 +// QA Sheet: F-012, F-013, F-014, F-015, F-017, F-018, F-019, F-020, F-081, F-082, F-083, F-084 // import XCTest @@ -221,6 +221,63 @@ final class HomeTests: BaseUITestCase { captureScreenshot(named: "F081-PollsSectionVisible") } + /// F-082: Create poll button appears when 2+ trips are saved. + @MainActor + func testF082_CreatePollButtonWith2PlusTrips() { + // Save first trip using the standard flow + let (wizard1, detail1) = TestFlows.planAndSelectFirstTrip(app: app) + detail1.assertSaveState(isSaved: false) + detail1.tapFavorite() + detail1.assertSaveState(isSaved: true) + + // Navigate back: Detail → Options → Wizard → Cancel + app.navigationBars.buttons.firstMatch.tap() + app.navigationBars.buttons.firstMatch + .waitUntilHittable(timeout: BaseUITestCase.shortTimeout).tap() + wizard1.tapCancel() + + // Save second trip using a different date range + let home = HomeScreen(app: app) + home.waitForLoad() + + let (wizard2, options2) = TestFlows.planDateRangeTrip( + app: app, + month: "July", + year: "2026", + startDay: "2026-07-01", + endDay: "2026-07-07" + ) + options2.selectTrip(at: 0) + let detail2 = TripDetailScreen(app: app) + detail2.waitForLoad() + detail2.assertSaveState(isSaved: false) + detail2.tapFavorite() + detail2.assertSaveState(isSaved: true) + + // Navigate back: Detail → Options → Wizard → Cancel + app.navigationBars.buttons.firstMatch.tap() + app.navigationBars.buttons.firstMatch + .waitUntilHittable(timeout: BaseUITestCase.shortTimeout).tap() + wizard2.tapCancel() + + // Navigate to My Trips tab + home.waitForLoad() + home.switchToTab(home.myTripsTab) + + // Scroll to find the Create poll button + let createPollButton = app.buttons["Create poll"] + var scrollAttempts = 0 + while !createPollButton.exists && scrollAttempts < 10 { + app.swipeUp(velocity: .slow) + scrollAttempts += 1 + } + + XCTAssertTrue(createPollButton.exists, + "Create poll button should appear with 2+ saved trips") + + captureScreenshot(named: "F082-CreatePollWith2Trips") + } + /// F-083: Create poll button hidden when fewer than 2 trips saved. @MainActor func testF083_CreatePollButtonHiddenLessThan2Trips() { diff --git a/SportsTimeUITests/Tests/ProgressTests.swift b/SportsTimeUITests/Tests/ProgressTests.swift index f4a08c5..6a477d0 100644 --- a/SportsTimeUITests/Tests/ProgressTests.swift +++ b/SportsTimeUITests/Tests/ProgressTests.swift @@ -3,7 +3,7 @@ // SportsTimeUITests // // Tests for the Progress tab (Pro-gated). -// QA Sheet: F-066, F-097, F-100, F-101, F-106, F-110 +// QA Sheet: F-066, F-097, F-099, F-100, F-101, F-106, F-110 // import XCTest @@ -182,6 +182,51 @@ final class ProgressTests: BaseUITestCase { captureScreenshot(named: "F106-GamesHistory") } + /// F-099: Progress percentage updates after adding a stadium visit. + @MainActor + func testF099_ProgressPercentageUpdates() { + let home = HomeScreen(app: app) + home.waitForLoad() + home.switchToTab(home.progressTab) + + let progress = ProgressScreen(app: app) + progress.waitForLoad() + + // Check initial progress — look for the accessibility label with "percent complete" + let progressCircle = app.descendants(matching: .any).matching(NSPredicate( + format: "label CONTAINS 'stadiums visited'" + )).firstMatch + let initialLabel = progressCircle.exists ? progressCircle.label : "" + + // Add a stadium visit + progress.tapAddManualVisit() + let visitSheet = StadiumVisitSheetScreen(app: app) + visitSheet.waitForLoad() + visitSheet.pickFirstStadium() + visitSheet.tapSave() + visitSheet.navigationBar.waitForNonExistence(timeout: BaseUITestCase.defaultTimeout) + + // Wait for data to reload + sleep(2) + + // Progress should have updated — verify the progress circle label changed + let updatedCircle = app.descendants(matching: .any).matching(NSPredicate( + format: "label CONTAINS 'stadiums visited'" + )).firstMatch + + XCTAssertTrue(updatedCircle.waitForExistence(timeout: BaseUITestCase.longTimeout), + "Progress circle should exist after adding a visit") + + // If we had an initial label, verify it changed + if !initialLabel.isEmpty { + // The new label should have a higher visited count + XCTAssertNotEqual(updatedCircle.label, initialLabel, + "Progress label should update after adding a visit") + } + + captureScreenshot(named: "F099-ProgressPercentageUpdated") + } + /// F-110: Achievements gallery is visible with badge grid. @MainActor func testF110_AchievementsGalleryVisible() { diff --git a/docs/SportsTime_QA_Test_Plan.xlsx b/docs/SportsTime_QA_Test_Plan.xlsx index 950e0db..8358d0c 100644 Binary files a/docs/SportsTime_QA_Test_Plan.xlsx and b/docs/SportsTime_QA_Test_Plan.xlsx differ