The parent SportSelectorGrid's accessibilityIdentifier propagates to child
buttons, overriding their individual progress.sport.{name} identifiers.
Match by accessibility label (e.g., "MLB") instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
86 lines
2.8 KiB
Swift
86 lines
2.8 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 buttons inherit the parent's identifier (progress.sportSelector),
|
|
// so find them by their accessibility label which includes the sport name.
|
|
let mlbButton = app.buttons.matching(NSPredicate(
|
|
format: "label BEGINSWITH 'MLB'"
|
|
)).firstMatch
|
|
XCTAssertTrue(mlbButton.waitForExistence(timeout: BaseUITestCase.longTimeout),
|
|
"MLB sport button should exist in sport selector")
|
|
mlbButton.tap()
|
|
|
|
captureScreenshot(named: "F097-SportSelector-MLB")
|
|
|
|
// Switch to NBA
|
|
let nbaButton = app.buttons.matching(NSPredicate(
|
|
format: "label BEGINSWITH 'NBA'"
|
|
)).firstMatch
|
|
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")
|
|
}
|
|
}
|