fix(uitests): give the product add button an explicit accessibility identifier
quickDiagnostics finally showed the real state at the timeout: Store
Detail had genuinely loaded (store header, category tabs, a real priced
product 'Alcatra' R$ 14,00 all visible) - 'product list never loaded'
was simply the wrong diagnosis. The test was matching
app.images.matching(identifier: "plus") against the product row's add
button, relying entirely on SF Symbol systemName being exposed as an
implicit accessibility identifier - which wasn't holding on this Xcode
26/iOS 26 CI environment, and is inherently ambiguous anyway since
CartView's own quantity stepper reuses the same "plus" systemName.
Added a real .accessibilityIdentifier("storeDetailProductAddButton")
to the product row's add Button in StoreDetailView+Components.swift (an
app-source change, not just a test workaround), and updated the test to
match on that instead.
See decisions/2026-09-11-ui-test-shared-login-session.md follow-up.
This commit is contained in:
@@ -228,20 +228,20 @@ final class CartCheckoutFlowTests: XCTestCase {
|
||||
)
|
||||
storeCard.tap()
|
||||
|
||||
// A plain (non-addon, non-pizza) product row's "+" control adds
|
||||
// directly with no sheet. Once a product's quantity is > 0, its
|
||||
// outer Button's identifier moves off itself - the same badge-
|
||||
// merging bug already fixed for the tab bar's cart icon - because
|
||||
// the row's own quantity Text becomes the Button's accessible
|
||||
// label/identity instead. The QA account's cart has genuinely
|
||||
// accumulated real quantities across many runs today, so
|
||||
// app.buttons.matching(identifier: "plus") stopped matching once
|
||||
// the first several products all had quantity > 0 (confirmed via
|
||||
// screenshot: the "+" controls were clearly visible on screen
|
||||
// while the buttons-only query found nothing). The nested Image
|
||||
// keeps identifier "plus" regardless of quantity, so target that
|
||||
// directly instead - same fix pattern as the cart-tab icon.
|
||||
let addButton = app.images.matching(identifier: "plus").firstMatch
|
||||
// The product row's add button carries an explicit
|
||||
// `.accessibilityIdentifier("storeDetailProductAddButton")`
|
||||
// (StoreDetailView+Components.swift) - added after discovering
|
||||
// that matching on the inner "plus" SF Symbol's implicit/
|
||||
// auto-generated identifier was unreliable: `quickDiagnostics`'s
|
||||
// visible-text dump showed a real product ("Alcatra", R$ 14,00)
|
||||
// clearly rendered on screen while `images.matching(identifier:
|
||||
// "plus")` still found nothing, and the same "plus" systemName is
|
||||
// separately reused by CartView's quantity stepper, making it an
|
||||
// ambiguous identifier to search by in the first place. Matching
|
||||
// the button itself (not a nested image) also sidesteps the
|
||||
// quantity-badge accessibility-label-merging issue that affected
|
||||
// the tab bar's cart icon elsewhere in this suite.
|
||||
let addButton = app.buttons.matching(identifier: "storeDetailProductAddButton").firstMatch
|
||||
XCTAssertTrue(
|
||||
addButton.waitForExistence(timeout: 25),
|
||||
"Store Detail's product list never loaded. \(quickDiagnostics(app))"
|
||||
|
||||
Reference in New Issue
Block a user