Skip to content

Commit 598e918

Browse files
test: use main thread for test helper functions
1 parent 5d05bd3 commit 598e918

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests/TestHarness.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func configureFirebaseIfNeeded() {
1515
}
1616
}
1717

18+
@MainActor
1819
private var hasCheckedEmulatorAvailability = false
1920

2021
@MainActor
@@ -62,6 +63,7 @@ func createEmail() -> String {
6263
return "\(before)@\(after).com"
6364
}
6465

66+
@MainActor
6567
func waitForStateChange(timeout: TimeInterval = 10.0,
6668
condition: @escaping () -> Bool) async throws {
6769
let startTime = Date()

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests/MFAResolutionUITests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ final class MFAResolutionUITests: XCTestCase {
121121
/// - phoneNumber: The phone number to enroll for SMS MFA (e.g., "+15551234567")
122122
/// - displayName: Optional display name for the MFA factor
123123
/// - Returns: True if MFA was successfully enabled, false otherwise
124+
@MainActor
124125
private func enableSMSMFAViaEmulator(
125126
idToken: String,
126127
phoneNumber: String,
@@ -261,6 +262,7 @@ final class MFAResolutionUITests: XCTestCase {
261262
/// - Parameters:
262263
/// - phoneNumber: The phone number to retrieve the code for
263264
/// - codeType: The type of code - "enrollment" for MFA enrollment, "verification" for phone verification during resolution
265+
@MainActor
264266
private func getSMSVerificationCode(for phoneNumber: String, codeType: String = "enrollment") async -> String? {
265267
let emulatorUrl = "http://127.0.0.1:9099/emulator/v1/projects/flutterfire-e2e-tests/verificationCodes"
266268

@@ -336,6 +338,7 @@ final class MFAResolutionUITests: XCTestCase {
336338
/// - email: The user's email address
337339
/// - password: The user's password (defaults to "123456")
338340
/// - Returns: The user's ID token, or nil if the sign-in failed
341+
@MainActor
339342
private func getIDTokenFromEmulator(email: String, password: String = "123456") async -> String? {
340343
let signInUrl = "http://127.0.0.1:9099/identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=fake-api-key"
341344

@@ -379,6 +382,7 @@ final class MFAResolutionUITests: XCTestCase {
379382
}
380383
}
381384

385+
@MainActor
382386
private func signUpUser(email: String, password: String = "12345678") async throws {
383387
// Create user via Auth Emulator REST API
384388
let url = URL(string: "http://127.0.0.1:9099/identitytoolkit.googleapis.com/v1/accounts:signUp?key=fake-api-key")!

0 commit comments

Comments
 (0)