migration

This commit is contained in:
Daniel Arantes Loverde
2026-08-11 13:22:02 -03:00
parent c4d6998595
commit 7702836fe7
231 changed files with 4329 additions and 1958 deletions

View File

@@ -0,0 +1,73 @@
import XCTest
/// Covers the guest (unauthenticated) Home screen - confirmed reachable
/// and stable, see decisions/2026-08-06-ui-test-account-and-app-attest-bypass.md.
/// Authenticated-only flows (real store data, cart checkout, orders) are
/// blocked by a separate login-navigation issue documented there and are
/// not covered here.
final class HomeGuestFlowTests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
}
func testHomeRendersSearchAndGreeting() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.reachGuestHome(), "Never reached Home's search field")
XCTAssertTrue(app.staticTexts["ENTREGAR EM:"].exists)
XCTAssertTrue(app.textFields["Search menu, restaurant or craving"].exists)
XCTAssertTrue(app.images["bell"].exists, "Notifications bell missing")
}
func testHomeShowsDefaultCategoryChip() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.reachGuestHome())
XCTAssertTrue(app.staticTexts["Categories"].exists)
XCTAssertTrue(app.staticTexts["Todas"].exists, "Default 'Todas' category chip missing")
}
func testHomeShowsGuestLocationPromptWhenNoLocationChosen() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.reachGuestHome())
// No guest state/city selected -> Home's own inline message, not
// the blocking sheet (which we just dismissed to get here).
XCTAssertTrue(app.staticTexts["Escolha um estado e cidade para visualizar os estabelecimentos."].waitForExistence(timeout: 3))
}
func testTappingAddressChipReopensLocationPicker() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.reachGuestHome())
// The "ENTREGAR EM:" address button re-opens the same address
// picker sheet we dismissed to reach Home - confirms the chip is
// wired to the real activeModal state, not just decorative.
let addressChip = app.buttons.matching(NSPredicate(format: "identifier == 'chevron.down'")).firstMatch
if addressChip.exists {
addressChip.tap()
} else {
// Fall back to tapping near the "ENTREGAR EM:" label's row.
app.staticTexts["ENTREGAR EM:"].tap()
}
XCTAssertTrue(
app.staticTexts["Escolha seu estado"].waitForExistence(timeout: 3)
|| app.staticTexts["Escolha sua cidade"].waitForExistence(timeout: 3),
"Tapping the address chip did not reopen the location picker"
)
}
// No testSearchFieldAcceptsTextInput here: the guest address-picker
// sheet re-presents on an independent timer (see
// decisions/2026-08-06-ui-test-account-and-app-attest-bypass.md) and
// can land back on top between a tap and the following `typeText`,
// which XCTest treats as a fatal, non-catchable event-synthesis
// failure - unlike `.exists` checks, there is no reliable way to guard
// against it. Confirmed via accessibility-hierarchy dump that the sheet
// was back on top at the moment of failure. Dropped rather than
// papered over with more retries.
}