88import XCTest
99
1010final class AuthWebAuthnAppUITests : XCTestCase {
11- private let timeout = TimeInterval ( 6 )
11+ private let timeout = TimeInterval ( 30 )
1212 private let app = XCUIApplication ( )
1313 private var username : String !
1414 private var signUpButton : XCUIElement !
@@ -72,20 +72,14 @@ final class AuthWebAuthnAppUITests: XCTestCase {
7272 @MainActor
7373 func testWebAuthnAPIs( ) async throws {
7474 // 1. Associate new WebAuthn Credential
75+ let associateContinueButton = springboard. otherElements [ " ASAuthorizationControllerContinueButton " ]
7576 let associateAttempt = await attempt {
7677 associateButton. tap ( )
77- return !waitForResult ( " Associate WebAuthn Credential failed: " , timeout: 1 )
78+ return associateContinueButton . waitForExistence ( timeout: timeout )
7879 }
7980
8081 guard associateAttempt else {
81- XCTFail ( " Failed to trigger the Associate WebAuthn Credential workflow: \( lastResult) " )
82- return
83- }
84-
85- // Wait for the "Continue" button to appear in the FaceID popover and tap it
86- let associateContinueButton = springboard. otherElements [ " ASAuthorizationControllerContinueButton " ]
87- guard associateContinueButton. waitForExistence ( timeout: timeout) else {
88- XCTFail ( " Failed to find the 'Continue' button to Associate new WebAuthn credential " )
82+ XCTFail ( " Failed to find the 'Continue' button to Associate new WebAuthn credential: \( lastResult) " )
8983 return
9084 }
9185 associateContinueButton. tap ( )
@@ -112,20 +106,14 @@ final class AuthWebAuthnAppUITests: XCTestCase {
112106 }
113107
114108 // 4. Sign in with WebAuthn
109+ let signInContinueButton = springboard. otherElements [ " ASAuthorizationControllerContinueButton " ]
115110 let signInAttempt = await attempt {
116111 signInButton. tap ( )
117- return !waitForResult ( " Sign In failed: " , timeout: 1 )
112+ return signInContinueButton . waitForExistence ( timeout: timeout )
118113 }
119114
120115 guard signInAttempt else {
121- XCTFail ( " Failed to trigger the Assert WebAuthn Credential workflow: \( lastResult) " )
122- return
123- }
124-
125- // Wait for the "Continue" button to appear in the FaceID popover
126- let signInContinueButton = springboard. otherElements [ " ASAuthorizationControllerContinueButton " ]
127- guard signInContinueButton. waitForExistence ( timeout: timeout) else {
128- XCTFail ( " Failed to find the 'Continue' button to Sign In with WebAuthn " )
116+ XCTFail ( " Failed to find the 'Continue' button to Sign In with WebAuthn: \( lastResult) " )
129117 return
130118 }
131119
0 commit comments