@@ -29,18 +29,99 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
2929 override func tearDownWithError( ) throws { }
3030
3131 @MainActor
32- func testExample ( ) throws {
32+ func testNoProvidersInitialized ( ) throws {
3333 let app = XCUIApplication ( )
34+ app. launchArguments. append ( " --test-view-enabled " )
35+ app. launchArguments. append ( " --no-providers " )
3436 app. launch ( )
37+
38+ // Verify email/password fields are NOT visible when no providers are initialized
39+ let emailField = app. textFields [ " email-field " ]
40+ XCTAssertFalse (
41+ emailField. waitForExistence ( timeout: 2 ) ,
42+ " Email field should NOT be visible when no providers are initialized "
43+ )
44+
45+ // Verify email link button is NOT visible
46+ let emailLinkButton = app. buttons [ " sign-in-with-email-link-button " ]
47+ XCTAssertFalse (
48+ emailLinkButton. waitForExistence ( timeout: 2 ) ,
49+ " Email link button should NOT be visible when no providers are initialized "
50+ )
51+
52+ // Verify provider buttons are NOT visible
53+ let googleButton = app. buttons [ " sign-in-with-google-button " ]
54+ XCTAssertFalse (
55+ googleButton. waitForExistence ( timeout: 2 ) ,
56+ " Google button should NOT be visible when no providers are initialized "
57+ )
58+
59+ let facebookButton = app. buttons [ " sign-in-with-facebook-button " ]
60+ XCTAssertFalse (
61+ facebookButton. waitForExistence ( timeout: 2 ) ,
62+ " Facebook button should NOT be visible when no providers are initialized "
63+ )
3564 }
3665
3766 @MainActor
38- func testLaunchPerformance( ) throws {
39- if #available( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , watchOS 7 . 0 , * ) {
40- measure ( metrics: [ XCTApplicationLaunchMetric ( ) ] ) {
41- XCUIApplication ( ) . launch ( )
42- }
67+ func testAllProvidersInitialized( ) throws {
68+ let app = XCUIApplication ( )
69+ app. launchArguments. append ( " --test-view-enabled " )
70+ // No --no-providers flag means all providers are enabled by default
71+ app. launch ( )
72+
73+ // Verify email/password fields are visible when withEmailSignIn() is enabled
74+ let emailField = app. textFields [ " email-field " ]
75+ XCTAssertTrue (
76+ emailField. waitForExistence ( timeout: 5 ) ,
77+ " Email field should be visible when withEmailSignIn() is enabled "
78+ )
79+
80+ let passwordField = app. secureTextFields [ " password-field " ]
81+ XCTAssertTrue (
82+ passwordField. waitForExistence ( timeout: 5 ) ,
83+ " Password field should be visible when withEmailSignIn() is enabled "
84+ )
85+
86+ let signInButton = app. buttons [ " sign-in-button " ]
87+ XCTAssertTrue (
88+ signInButton. waitForExistence ( timeout: 5 ) ,
89+ " Sign-in button should be visible when withEmailSignIn() is enabled "
90+ )
91+
92+ // Verify email link button is visible when withEmailLinkSignIn() is enabled
93+ let emailLinkButton = app. buttons [ " sign-in-with-email-link-button " ]
94+ XCTAssertTrue (
95+ emailLinkButton. waitForExistence ( timeout: 5 ) ,
96+ " Email link button should be visible when withEmailLinkSignIn() is enabled "
97+ )
98+
99+ // Tap the email link button and verify it navigates to email link view
100+ emailLinkButton. tap ( )
101+ let emailLinkText = app. staticTexts [ " Send a sign-in link to your email " ] . firstMatch
102+ XCTAssertTrue (
103+ emailLinkText. waitForExistence ( timeout: 5 ) ,
104+ " Email link view should appear after tapping email link button "
105+ )
106+
107+ // Go back to verify provider buttons
108+ let backButton = app. navigationBars. buttons. element ( boundBy: 0 )
109+ if backButton. exists {
110+ backButton. tap ( )
43111 }
112+
113+ // Verify provider buttons are visible
114+ let googleButton = app. buttons [ " sign-in-with-google-button " ]
115+ XCTAssertTrue (
116+ googleButton. waitForExistence ( timeout: 5 ) ,
117+ " Google sign-in button should be visible when withGoogleSignIn() is enabled "
118+ )
119+
120+ let facebookButton = app. buttons [ " sign-in-with-facebook-button " ]
121+ XCTAssertTrue (
122+ facebookButton. waitForExistence ( timeout: 5 ) ,
123+ " Facebook sign-in button should be visible when withFacebookSignIn() is enabled "
124+ )
44125 }
45126
46127 @MainActor
0 commit comments