-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding UI Tests for MFA Flows #14213
Open
srushtisv
wants to merge
13
commits into
main
Choose a base branch
from
mfa-ui-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+70
−0
Open
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2b31a9f
adding mfa ui test (enforce mode)
srushtisv 555854c
sign in with second factor mfa test (enforce mode)
srushtisv 3fa8761
lint fixes
srushtisv dddb6a6
fixes
srushtisv cf206cb
adding project file to pass failed checks
srushtisv f265c80
plist file fixes
srushtisv dcd3e5d
updating project file
srushtisv 2a7c989
update project.pbxproj
srushtisv 040e973
updating tests to pass failed checks
srushtisv 57eccd3
check
srushtisv 0ab033c
adding project file
srushtisv aa318e8
updating project.pbxproj to add rce
srushtisv 8dc2cc7
discarding changes in project.pbxproj
srushtisv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -182,6 +182,77 @@ class AuthenticationExampleUITests: XCTestCase { | |
) | ||
} | ||
|
||
func testPhoneMultiFactorEnrollUnenroll() { | ||
// login with email password | ||
app.staticTexts["Email & Password Login"].tap() | ||
let testEmail = "[email protected]" | ||
app.textFields["Email"].tap() | ||
app.typeText(testEmail) | ||
// app.buttons["return"].tap() // dismiss keyboard | ||
let testPassword = "sampleauthios" | ||
app.textFields["Password"].tap() | ||
app.typeText(testPassword) | ||
// app.buttons["return"].tap() // dismiss keyboard | ||
app.buttons["Login"].tap() | ||
// enroll multifactor with phone | ||
app.tabBars.buttons["Authentication"].tap() | ||
app.tables.cells.staticTexts["Phone Enroll"].tap() | ||
let testSecondFactorPhone = "+11234567890" | ||
app.typeText(testSecondFactorPhone) | ||
app.buttons["Save"].tap() | ||
let testVerificationCode = "123456" | ||
app.typeText(testVerificationCode) | ||
app.buttons["Save"].tap() | ||
let testPhoneSecondFactorDisplayName = "phone1" | ||
app.typeText(testPhoneSecondFactorDisplayName) | ||
app.buttons["Save"].tap() | ||
// unenroll multifactor | ||
app.swipeUp(velocity: .fast) | ||
app.tables.cells.staticTexts["Multifactor unenroll"].tap() | ||
XCTAssertTrue(app.buttons["phone1"].exists) // enrollment successful | ||
app.buttons["phone1"].tap() | ||
app.swipeUp(velocity: .fast) | ||
app.tables.cells.staticTexts["Multifactor unenroll"].tap() | ||
XCTAssertFalse(app.buttons["phone1"].exists) // unenrollment successful | ||
app.buttons["Cancel"].tap() | ||
// sign out after unenroll | ||
app.tabBars.buttons["Current User"].tap() | ||
app.tabBars.firstMatch.buttons.element(boundBy: 1).tap() | ||
} | ||
|
||
func testPhoneSecondFactorSignIn() { | ||
// login with email password | ||
app.staticTexts["Email & Password Login"].tap() | ||
let testEmail = "[email protected]" | ||
app.textFields["Email"].tap() | ||
app.typeText(testEmail) | ||
app.buttons["return"].tap() // dismiss keyboard | ||
let testPassword = "sampleios123" | ||
app.textFields["Password"].tap() | ||
app.typeText(testPassword) | ||
app.buttons["return"].tap() // dismiss keyboard | ||
app.buttons["Login"].tap() | ||
// login with second factor | ||
XCTAssertTrue(app.staticTexts["Choose a second factor to continue."] | ||
.waitForExistence(timeout: 5)) | ||
let secondFactor = app.staticTexts["phone2"] // select 'phone2' as second factor | ||
XCTAssertTrue(secondFactor.exists, "'phone2' option should be visible in the modal.") | ||
secondFactor.tap() | ||
app.buttons["Send Verification Code"].tap() | ||
let verificationCodeInput = app.textFields["Enter verification code."] | ||
verificationCodeInput.tap() | ||
let testVerificationCode = "123456" | ||
verificationCodeInput.typeText(testVerificationCode) | ||
let signInButton = app.buttons["Sign in"] | ||
XCTAssertTrue(signInButton.waitForExistence(timeout: 2), "'Sign in' button should be visible.") | ||
signInButton.tap() | ||
// sign out | ||
let signOutButton = app.buttons["Sign Out"] | ||
if signOutButton.exists { | ||
signOutButton.tap() | ||
} | ||
} | ||
|
||
func DRAFT_testGoogleSignInAndLinkAccount() { | ||
let interruptionMonitor = addUIInterruptionMonitor(withDescription: "Sign in with Google") { | ||
alert -> Bool in | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the failed CI seems related to the plist file, can you revert the plist file part in this file and then try trigger CI again?