-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding UI Test for Passwordless Flow [fdl deprecation] (#14000)
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,6 +226,35 @@ class AuthenticationExampleUITests: XCTestCase { | |
removeUIInterruptionMonitor(interruptionMonitor) | ||
} | ||
|
||
func testEmailLinkSentSuccessfully() { | ||
app.staticTexts["Email Link/Passwordless"].tap() | ||
|
||
let testEmail = "[email protected]" | ||
app.textFields["Enter Authentication Email"].tap() | ||
app.textFields["Enter Authentication Email"].typeText(testEmail) | ||
app.buttons["return"].tap() // Dismiss keyboard | ||
app.buttons["Send Sign In Link"].tap() | ||
|
||
// Wait for the error message to appear (if there is an error) | ||
let errorAlert = app.alerts.staticTexts["Error"] | ||
let errorExists = errorAlert.waitForExistence(timeout: 5.0) | ||
|
||
app.swipeDown(velocity: .fast) | ||
|
||
// Assert that there is no error message (success case) | ||
// The email sign in link is sent successfully if no error message appears | ||
XCTAssertFalse(errorExists, "Error") | ||
|
||
// Go back and check that there is no user that is signed in | ||
app.tabBars.firstMatch.buttons.element(boundBy: 1).tap() | ||
wait(forElement: app.navigationBars["User"], timeout: 5.0) | ||
XCTAssertEqual( | ||
app.cells.count, | ||
0, | ||
"The user shouldn't be signed in and the user view should have no cells." | ||
) | ||
} | ||
|
||
// MARK: - Private Helpers | ||
|
||
private func signOut() { | ||
|