Skip to content

Commit a7682e5

Browse files
tests: fix tests after UI changes
1 parent 36449ce commit a7682e5

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ public struct PasswordRecoveryView {
4242
extension PasswordRecoveryView: View {
4343
public var body: some View {
4444
VStack {
45+
HStack {
46+
Button(action: {
47+
authService.authView = .authPicker
48+
}) {
49+
HStack(spacing: 4) {
50+
Image(systemName: "chevron.left")
51+
.font(.system(size: 17, weight: .medium))
52+
Text(authService.string.backButtonLabel)
53+
.font(.system(size: 17))
54+
}
55+
.foregroundColor(.blue)
56+
}
57+
.accessibilityIdentifier("password-recovery-back-button")
58+
}
4559
Text(authService.string.passwordRecoveryTitle)
4660
.font(.largeTitle)
4761
.fontWeight(.bold)
@@ -79,14 +93,6 @@ extension PasswordRecoveryView: View {
7993
.sheet(item: $resultWrapper) { wrapper in
8094
resultSheet(wrapper.value)
8195
}
82-
.navigationBarItems(leading: Button(action: {
83-
authService.authView = .authPicker
84-
}) {
85-
Image(systemName: "chevron.left")
86-
.foregroundColor(.blue)
87-
Text(authService.string.backButtonLabel)
88-
.foregroundColor(.blue)
89-
}.accessibilityIdentifier("password-recovery-back-button"))
9096
}
9197

9298
@ViewBuilder

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests/MFAEnrolmentUITests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ final class MFAEnrollmentUITests: XCTestCase {
354354
// MARK: - Navigation Tests
355355

356356
@MainActor
357-
func testCancelButtonNavigation() throws {
357+
func testBackButtonNavigation() throws {
358358
let app = XCUIApplication()
359359
app.launchArguments.append("--auth-emulator")
360360
app.launchArguments.append("--mfa-enabled")
@@ -367,10 +367,10 @@ final class MFAEnrollmentUITests: XCTestCase {
367367
try signInToApp(app: app, email: email)
368368
try navigateToMFAEnrollment(app: app)
369369

370-
// Test cancel button exists
371-
let cancelButton = app.buttons["cancel-button"]
372-
XCTAssertTrue(cancelButton.exists, "Cancel button should exist")
373-
XCTAssertTrue(cancelButton.isEnabled, "Cancel button should be enabled")
370+
// Test back button exists
371+
let cancelButton = app.buttons["mfa-back-button"]
372+
XCTAssertTrue(cancelButton.exists, "Back button should exist")
373+
XCTAssertTrue(cancelButton.isEnabled, "Back button should be enabled")
374374

375375
// Tap cancel button
376376
cancelButton.tap()

0 commit comments

Comments
 (0)