Files
Sportstime/SportsTimeUITests/Tests/ProgressTests.swift
Trey t dc142bd14b feat: expand XCUITest coverage to 54 QA scenarios with accessibility IDs and fix test failures
Add 22 new UI tests across 8 test files covering Home, Schedule, Progress,
Settings, TabNavigation, TripSaving, and TripOptions. Add accessibility
identifiers to 11 view files for test element discovery. Fix sport chip
assertion logic (all sports start selected, tap deselects), scroll container
issues on iOS 26 nested ScrollViews, toggle interaction, and delete trip flow.
Update QA coverage map from 32 to 54 automated test cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 19:44:22 -06:00

92 lines
3.0 KiB
Swift

//
// 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")
}
}