Skip to content

Commit 3eb063b

Browse files
test: fix integration tests
1 parent 54afbb7 commit 3eb063b

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests/TestHarness.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ func createEmailLinkOnlyUser(email: String) async throws {
108108
try await service.sendEmailSignInLink(email: email)
109109
let signInLink = try await fetchEmailSignInLinkFromEmulator(email: email)
110110
try await service.handleSignInLink(url: signInLink)
111+
try await waitForStateChange {
112+
service.currentUser?.email?.caseInsensitiveCompare(email) == .orderedSame
113+
}
111114
try await service.signOut()
112115
}
113116

@@ -152,10 +155,13 @@ func fetchEmailSignInLinkFromEmulator(email: String,
152155
.compactMap(\.oobLink)
153156
.first
154157

155-
if let oobLink,
156-
let encodedLink = oobLink.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),
157-
let wrappedLink = URL(string: "https://example.com/?link=\(encodedLink)") {
158-
return wrappedLink
158+
if let oobLink {
159+
var components = URLComponents(string: "https://example.com/")
160+
components?.queryItems = [URLQueryItem(name: "link", value: oobLink)]
161+
162+
if let wrappedLink = components?.url {
163+
return wrappedLink
164+
}
159165
}
160166

161167
attempts += 1

0 commit comments

Comments
 (0)