diff --git a/SportsTimeUITests/Tests/ProgressTests.swift b/SportsTimeUITests/Tests/ProgressTests.swift index 887dabe..f7d00c2 100644 --- a/SportsTimeUITests/Tests/ProgressTests.swift +++ b/SportsTimeUITests/Tests/ProgressTests.swift @@ -40,27 +40,21 @@ final class ProgressTests: BaseUITestCase { 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") + // 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() - // 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") + // 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")