@@ -58,7 +58,7 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
5858 }
5959
6060 @MainActor
61- func testSignInDisplaysSignedInView( ) async throws {
61+ func testSignInDisplaysSignedInView( ) throws {
6262 let app = XCUIApplication ( )
6363 let email = createEmail ( )
6464 app. launchArguments. append ( " --auth-emulator " )
@@ -82,11 +82,16 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
8282
8383 let signedInText = app. staticTexts [ " signed-in-text " ]
8484
85- XCTAssertTrue (
86- signedInText . waitForExistence ( timeout : 30 ) ,
87- " SignedInView should be visible after login "
85+ let expectation = XCTNSPredicateExpectation (
86+ predicate : NSPredicate ( format : " exists == true " ) ,
87+ object : signedInText
8888 )
8989
90+ let maxWaitTime : TimeInterval = 30
91+ let result = XCTWaiter ( ) . wait ( for: [ expectation] , timeout: maxWaitTime)
92+
93+ XCTAssertEqual ( result, . completed, " SignedInView should be visible after login " )
94+
9095 dismissAlert ( app: app)
9196 // Check the Views are updated
9297 let signOutButton = app. buttons [ " sign-out-button " ]
@@ -179,9 +184,14 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
179184
180185 let signedInText = app. staticTexts [ " signed-in-text " ]
181186
182- XCTAssertTrue (
183- signedInText . waitForExistence ( timeout : 30 ) ,
184- " SignedInView should be visible after login "
187+ let expectation = XCTNSPredicateExpectation (
188+ predicate : NSPredicate ( format : " exists == true " ) ,
189+ object : signedInText
185190 )
191+
192+ let maxWaitTime : TimeInterval = 30
193+ let result = XCTWaiter ( ) . wait ( for: [ expectation] , timeout: maxWaitTime)
194+
195+ XCTAssertEqual ( result, . completed, " SignedInView should be visible after login " )
186196 }
187197}
0 commit comments