// // ProgressTests.swift // SportsTimeUITests // // Tests for the Progress tab (Pro-gated). // QA Sheet: F-095, F-097, F-110 // import XCTest final class ProgressTests: BaseUITestCase { /// F-066: Progress tab loads for Pro user — stadium quest and navigation visible. @MainActor func testF066_ProgressTabLoads() { let home = HomeScreen(app: app) home.waitForLoad() home.switchToTab(home.progressTab) let progress = ProgressScreen(app: app) progress.waitForLoad() // Stadium Quest label should be visible (proves data loaded) XCTAssertTrue( progress.stadiumQuestLabel.waitForExistence( timeout: BaseUITestCase.longTimeout), "Stadium Quest label should appear on Progress tab" ) captureScreenshot(named: "F066-ProgressTab-Loaded") } /// F-097: League/sport selector toggles between sports. @MainActor func testF097_LeagueSportSelector() { let home = HomeScreen(app: app) home.waitForLoad() home.switchToTab(home.progressTab) let progress = ProgressScreen(app: app) progress.waitForLoad() // Sport selector may be below the fold — swipe up to find it let sportSelector = progress.sportSelector var scrollAttempts = 0 while !sportSelector.exists && scrollAttempts < 10 { app.swipeUp(velocity: .slow) scrollAttempts += 1 } XCTAssertTrue(sportSelector.exists, "Sport selector should be visible on Progress tab") // MLB button should exist and be tappable let mlbButton = progress.sportButton("mlb") XCTAssertTrue(mlbButton.waitForExistence(timeout: BaseUITestCase.shortTimeout), "MLB sport button should exist") mlbButton.tap() // After selecting MLB, the stats should update (just verify no crash) captureScreenshot(named: "F097-SportSelector-MLB") // Try switching to NBA if available let nbaButton = progress.sportButton("nba") if nbaButton.waitForExistence(timeout: BaseUITestCase.shortTimeout) { nbaButton.tap() captureScreenshot(named: "F097-SportSelector-NBA") } } /// F-110: Achievements gallery is visible with badge grid. @MainActor func testF110_AchievementsGalleryVisible() { let home = HomeScreen(app: app) home.waitForLoad() home.switchToTab(home.progressTab) let progress = ProgressScreen(app: app) progress.waitForLoad() // Achievements section is below the fold — swipe up to find it let achievementsTitle = progress.achievementsTitle var scrollAttempts = 0 while !achievementsTitle.exists && scrollAttempts < 15 { app.swipeUp(velocity: .slow) scrollAttempts += 1 } XCTAssertTrue(achievementsTitle.exists, "Achievements section should be visible") captureScreenshot(named: "F110-AchievementsGallery") } }