[auth-payment-login-lockout] Make auth intro a clean screen with a back button

App Review rejected the 2026-08 build: tapping checkout as a guest
switched root to .auth, which replaced the whole UI with LoginView as the
NavigationStack root - no nav bar, no back, no dismiss. User was trapped.

- LoginView: rebuilt as a static screen in LCENavigationView with a back
  button that sets root = .main, a 'Criar conta' and an 'Entrar' button,
  and 'Termos de Uso' / 'Politica de Privacidade' links. Added #Preview.
- Forced .preferredColorScheme(.light) and fixed DS colors (the app has
  no dark theme, so system dark mode was inverting the nav bar / title).
- Removed the entry-reveal animation machinery (heroVisible/textVisible/
  buttonVisible/token/prepare flags across LoginView, AuthFlowView,
  ContentView) - dead since guest browsing shipped and the root cause of
  the 2026-08-06 'content stuck hidden' bug.
- enterAuthFlow() is now just root = .auth.
- UITestSupport.ensureLoggedIn taps 'Entrar' (new label).
- ProfileLoggedOutFlowTests: new test covering the choices and the way
  back out of .auth.
- Localizable.xcstrings: catalog caught up to the new/removed strings.
This commit is contained in:
Daniel Arantes Loverde
2026-08-27 10:11:04 -03:00
parent 662f7d6ebd
commit 57103c637a
6 changed files with 81 additions and 170 deletions

View File

@@ -1,10 +1,7 @@
import XCTest
/// Covers the Profile tab's logged-out state (`ProfileLoggedOutView`) -
/// confirmed reachable. Actually logging in is blocked by a separate
/// navigation issue in LoginView's entry-reveal animation, documented in
/// decisions/2026-08-06-ui-test-account-and-app-attest-bypass.md - not
/// covered here.
/// Covers the Profile tab's logged-out state (`ProfileLoggedOutView`) and
/// the auth intro screen (`LoginView`) it opens.
final class ProfileLoggedOutFlowTests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
@@ -20,18 +17,27 @@ final class ProfileLoggedOutFlowTests: XCTestCase {
XCTAssertTrue(app.buttons["Entrar ou Cadastrar"].isHittable)
}
func testTappingLoginButtonDoesNotCrash() throws {
/// The auth intro screen must offer both entry points plus the legal
/// links, and the reason App Review rejected the build in 2026-08
/// a working way back out (its `LCENavigationView` back button, which
/// sets `root = .main`).
func testAuthIntroScreenShowsChoicesAndCanGoBack() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.reachLoggedOutProfile())
app.buttons["Entrar ou Cadastrar"].tap()
sleep(2)
// Known limitation (see decisions doc): the login screen's entry
// animation doesn't reliably reveal when navigating here from an
// already-running guest session, so this only asserts the app is
// still alive and responsive, not that login itself completes.
XCTAssertEqual(app.state, .runningForeground)
XCTAssertTrue(app.buttons["Criar conta"].waitForExistence(timeout: 5), "Auth intro missing 'Criar conta'")
XCTAssertTrue(app.buttons["Entrar"].exists, "Auth intro missing 'Entrar'")
XCTAssertTrue(app.buttons["Termos de Uso"].exists, "Auth intro missing 'Termos de Uso' link")
XCTAssertTrue(app.buttons["Política de Privacidade"].exists, "Auth intro missing 'Política de Privacidade' link")
let backButton = app.buttons.matching(NSPredicate(format: "label == %@", "Back")).firstMatch
XCTAssertTrue(backButton.exists, "Auth intro has no back button — user is trapped")
backButton.tap()
// Back out of `.auth` lands on the main tab bar again.
XCTAssertTrue(app.buttons["Home"].waitForExistence(timeout: 5), "Back button did not return to the main flow")
}
}