fix: F097 sport selector test uses label match instead of overridden identifier
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>
This commit is contained in:
@@ -40,27 +40,21 @@ final class ProgressTests: BaseUITestCase {
|
|||||||
let progress = ProgressScreen(app: app)
|
let progress = ProgressScreen(app: app)
|
||||||
progress.waitForLoad()
|
progress.waitForLoad()
|
||||||
|
|
||||||
// Sport selector may be below the fold — swipe up to find it
|
// Sport buttons inherit the parent's identifier (progress.sportSelector),
|
||||||
let sportSelector = progress.sportSelector
|
// so find them by their accessibility label which includes the sport name.
|
||||||
var scrollAttempts = 0
|
let mlbButton = app.buttons.matching(NSPredicate(
|
||||||
while !sportSelector.exists && scrollAttempts < 10 {
|
format: "label BEGINSWITH 'MLB'"
|
||||||
app.swipeUp(velocity: .slow)
|
)).firstMatch
|
||||||
scrollAttempts += 1
|
XCTAssertTrue(mlbButton.waitForExistence(timeout: BaseUITestCase.longTimeout),
|
||||||
}
|
"MLB sport button should exist in sport selector")
|
||||||
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()
|
mlbButton.tap()
|
||||||
|
|
||||||
// After selecting MLB, the stats should update (just verify no crash)
|
|
||||||
captureScreenshot(named: "F097-SportSelector-MLB")
|
captureScreenshot(named: "F097-SportSelector-MLB")
|
||||||
|
|
||||||
// Try switching to NBA if available
|
// Switch to NBA
|
||||||
let nbaButton = progress.sportButton("nba")
|
let nbaButton = app.buttons.matching(NSPredicate(
|
||||||
|
format: "label BEGINSWITH 'NBA'"
|
||||||
|
)).firstMatch
|
||||||
if nbaButton.waitForExistence(timeout: BaseUITestCase.shortTimeout) {
|
if nbaButton.waitForExistence(timeout: BaseUITestCase.shortTimeout) {
|
||||||
nbaButton.tap()
|
nbaButton.tap()
|
||||||
captureScreenshot(named: "F097-SportSelector-NBA")
|
captureScreenshot(named: "F097-SportSelector-NBA")
|
||||||
|
|||||||
Reference in New Issue
Block a user