import XCTest /// Covers screens reachable directly from the authenticated Profile tab /// with no cart/store-browse setup needed - OrdersView and MyReviewsView /// both load their own data. The standing QA account has real order/review /// history from prior manual and automated testing, so these don't assert /// on empty vs. non-empty - just that the real network load completes /// without getting stuck. See /// decisions/2026-08-06-ui-test-account-and-app-attest-bypass.md for the /// account (`ensureLoggedIn`). final class AuthenticatedProfileNavigationTests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false } // No per-test logout: the standing QA account's Keychain session is // meant to persist across authenticated-flow tests, so only the first // one in a suite run pays for a real OTP round trip. Tests that need a // guaranteed logged-out state (HomeGuestFlowTests, // ProfileLoggedOutFlowTests) force it themselves in their own setUp // instead of relying on every authenticated class to log out after // itself - see decisions/2026-09-11-ui-test-shared-login-session.md. func testOrdersScreenReachableAndLoadsRealData() throws { let app = XCUIApplication() app.launch() XCTAssertTrue(app.ensureLoggedIn(), "Login never completed") XCTAssertTrue(app.buttons["Sair da Conta"].waitForExistence(timeout: 10), "Never reached authenticated Profile") app.staticTexts["Meus Pedidos"].tap() XCTAssertTrue(app.staticTexts["Meus Pedidos"].waitForExistence(timeout: 10)) for _ in 0..<30 { if app.activityIndicators.firstMatch.exists == false { break } usleep(500_000) } XCTAssertFalse(app.activityIndicators.firstMatch.exists, "Orders list never finished loading") } func testReviewsScreenReachableAndLoadsRealData() throws { let app = XCUIApplication() app.launch() XCTAssertTrue(app.ensureLoggedIn(), "Login never completed") XCTAssertTrue(app.buttons["Sair da Conta"].waitForExistence(timeout: 10), "Never reached authenticated Profile") app.staticTexts["Minhas Avaliações"].tap() XCTAssertTrue(app.staticTexts["Minhas Avaliações"].waitForExistence(timeout: 10)) for _ in 0..<30 { if app.activityIndicators.firstMatch.exists == false { break } usleep(500_000) } XCTAssertFalse(app.activityIndicators.firstMatch.exists, "Reviews list never finished loading") } }