@@ -58,7 +58,7 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
58
58
}
59
59
60
60
@MainActor
61
- func testSignInDisplaysSignedInView( ) async throws {
61
+ func testSignInDisplaysSignedInView( ) throws {
62
62
let app = XCUIApplication ( )
63
63
let email = createEmail ( )
64
64
app. launchArguments. append ( " --auth-emulator " )
@@ -82,11 +82,16 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
82
82
83
83
let signedInText = app. staticTexts [ " signed-in-text " ]
84
84
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
88
88
)
89
89
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
+
90
95
dismissAlert ( app: app)
91
96
// Check the Views are updated
92
97
let signOutButton = app. buttons [ " sign-out-button " ]
@@ -179,9 +184,14 @@ final class FirebaseSwiftUIExampleUITests: XCTestCase {
179
184
180
185
let signedInText = app. staticTexts [ " signed-in-text " ]
181
186
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
185
190
)
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 " )
186
196
}
187
197
}
0 commit comments