Skip to content

Commit

Permalink
chore: Improving WebAuthn integ test
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas committed Dec 11, 2024
1 parent 0a78846 commit 7df0500
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ final class AuthWebAuthnAppUITests: XCTestCase {
private var deleteButton: XCUIElement!
private var deleteUserButton: XCUIElement!
private var springboard: XCUIApplication!
private var continueButton: XCUIElement! {
springboard.otherElements["ASAuthorizationControllerContinueButton"]
}

private lazy var deviceIdentifier: String = {
let paths = Bundle.main.bundleURL.pathComponents
Expand Down Expand Up @@ -86,11 +83,12 @@ final class AuthWebAuthnAppUITests: XCTestCase {
}

// Wait for the "Continue" button to appear in the FaceID popover and tap it
guard continueButton.waitForExistence(timeout: timeout) else {
XCTFail("Failed to find 'Continue' button")
let associateContinueButton = springboard.otherElements["ASAuthorizationControllerContinueButton"]
guard associateContinueButton.waitForExistence(timeout: timeout) else {
XCTFail("Failed to find the 'Continue' button to Associate new WebAuthn credential")
return
}
continueButton.tap()
associateContinueButton.tap()

// Trigger a matching face
try await matchBiometrics()
Expand Down Expand Up @@ -125,8 +123,9 @@ final class AuthWebAuthnAppUITests: XCTestCase {
}

// Wait for the "Continue" button to appear in the FaceID popover
guard continueButton.waitForExistence(timeout: timeout) else {
XCTFail("Failed to find 'Continue' button")
let signInContinueButton = springboard.otherElements["ASAuthorizationControllerContinueButton"]
guard signInContinueButton.waitForExistence(timeout: timeout) else {
XCTFail("Failed to find the 'Continue' button to Sign In with WebAuthn")
return
}

Expand All @@ -137,7 +136,7 @@ final class AuthWebAuthnAppUITests: XCTestCase {
}

// Tap the "Continue" button
continueButton.tap()
signInContinueButton.tap()

// Trigger a matching face
try await matchBiometrics()
Expand Down Expand Up @@ -232,8 +231,6 @@ final class AuthWebAuthnAppUITests: XCTestCase {
// so we don't check their existance.
signInButton = app.buttons["SignIn"]
signOutButton = app.buttons["SignOut"]

springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
}

@MainActor
Expand Down

0 comments on commit 7df0500

Please sign in to comment.