Skip to content

Commit 8d232b2

Browse files
committed
adding UI test for reset password [fdl-dep]
1 parent 3e2c63d commit 8d232b2

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,60 @@ class AuthenticationExampleUITests: XCTestCase {
226226
removeUIInterruptionMonitor(interruptionMonitor)
227227
}
228228

229+
func testResetPasswordLinkCustomDomain() {
230+
// assuming action type is in-app + continue URL everytime the app launches
231+
232+
// set Authorized Domain as Continue URL
233+
let testContinueURL = "fir-ios-auth-sample.firebaseapp.com"
234+
app.staticTexts["Continue URL"].tap()
235+
app.alerts.textFields.element.typeText(testContinueURL)
236+
app.buttons["Save"].tap()
237+
238+
// set Custom Hosting Domain as Link Domain
239+
let testLinkDomain = "http://firebaseiosauthsample.testdomaindonotuse.com"
240+
app.staticTexts["Link Domain"].tap()
241+
app.alerts.textFields.element.typeText(testLinkDomain)
242+
app.buttons["Save"].tap()
243+
244+
app.staticTexts["Request Password Reset"].tap()
245+
let testEmail = "[email protected]"
246+
app.alerts.textFields.element.typeText(testEmail)
247+
app.buttons["Save"].tap()
248+
249+
// Go back and check that there is no user that is signed in
250+
app.tabBars.firstMatch.buttons.element(boundBy: 1).tap()
251+
wait(forElement: app.navigationBars["User"], timeout: 5.0)
252+
XCTAssertEqual(
253+
app.cells.count,
254+
0,
255+
"The user shouldn't be signed in and the user view should have no cells."
256+
)
257+
}
258+
259+
func testResetPasswordLinkDefaultDomain() {
260+
// assuming action type is in-app + continue URL everytime the app launches
261+
262+
// set Authorized Domain as Continue URL
263+
let testContinueURL = "fir-ios-auth-sample.firebaseapp.com"
264+
app.staticTexts["Continue URL"].tap()
265+
app.alerts.textFields.element.typeText(testContinueURL)
266+
app.buttons["Save"].tap()
267+
268+
app.staticTexts["Request Password Reset"].tap()
269+
let testEmail = "[email protected]"
270+
app.alerts.textFields.element.typeText(testEmail)
271+
app.buttons["Save"].tap()
272+
273+
// Go back and check that there is no user that is signed in
274+
app.tabBars.firstMatch.buttons.element(boundBy: 1).tap()
275+
wait(forElement: app.navigationBars["User"], timeout: 5.0)
276+
XCTAssertEqual(
277+
app.cells.count,
278+
0,
279+
"The user shouldn't be signed in and the user view should have no cells."
280+
)
281+
}
282+
229283
// MARK: - Private Helpers
230284

231285
private func signOut() {

0 commit comments

Comments
 (0)