From 74a18396a4ae017a1cd27cb508e5f1158517a98c Mon Sep 17 00:00:00 2001 From: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:07:41 -0500 Subject: [PATCH] fix: Fixing the WebAuthn integration tests --- .github/workflows/integ_test_auth.yml | 15 ++++++++++----- .../AuthWebAuthnAppUITests.swift | 8 +++----- .../AuthWebAuthnAppUITests/LocalServer.swift | 2 +- .../Tests/AuthWebAuthnApp/LocalServer/index.mjs | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integ_test_auth.yml b/.github/workflows/integ_test_auth.yml index 5cbceea4f7..f7c9b0e1db 100644 --- a/.github/workflows/integ_test_auth.yml +++ b/.github/workflows/integ_test_auth.yml @@ -22,6 +22,11 @@ on: required: true default: true type: boolean + webauthn-ios: + description: '🔐 WebAuthn iOS' + required: true + default: true + type: boolean workflow_call: permissions: @@ -59,8 +64,8 @@ jobs: timeout-minutes: 30 secrets: inherit - # Disabling the integration test because the job is not able to connect to the local server - # auth-webauthn-integration-test-iOS: - # name: Auth WebAuthn Integration Tests (iOS) - # uses: ./.github/workflows/integ_test_auth_webauthn.yml - # secrets: inherit + auth-webauthn-integration-test-iOS: + if: ${{ inputs.webauthn-ios != 'false' }} + name: Auth WebAuthn Integration Tests (iOS) + uses: ./.github/workflows/integ_test_auth_webauthn.yml + secrets: inherit diff --git a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/AuthWebAuthnAppUITests.swift b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/AuthWebAuthnAppUITests.swift index a314bd2fb3..e6283ebdc6 100644 --- a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/AuthWebAuthnAppUITests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/AuthWebAuthnAppUITests.swift @@ -19,7 +19,9 @@ final class AuthWebAuthnAppUITests: XCTestCase { private var deleteButton: XCUIElement! private var deleteUserButton: XCUIElement! private var springboard: XCUIApplication! - private var continueButton: XCUIElement! + private var continueButton: XCUIElement! { + springboard.otherElements["ASAuthorizationControllerContinueButton"] + } private lazy var deviceIdentifier: String = { let paths = Bundle.main.bundleURL.pathComponents @@ -57,7 +59,6 @@ final class AuthWebAuthnAppUITests: XCTestCase { signInButton = nil deleteButton = nil deleteUserButton = nil - continueButton = nil springboard = nil try await uninstallApp() } @@ -233,9 +234,6 @@ final class AuthWebAuthnAppUITests: XCTestCase { signOutButton = app.buttons["SignOut"] springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") - // The Continue button only appears when a FaceID operation is triggered, - // so we're also not checking for its existance - continueButton = springboard.otherElements["ASAuthorizationControllerContinueButton"] } @MainActor diff --git a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/LocalServer.swift b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/LocalServer.swift index 07e7c02a3c..59a9438da1 100644 --- a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/LocalServer.swift +++ b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/LocalServer.swift @@ -8,7 +8,7 @@ import Foundation enum LocalServer { - static let endpoint = "http://127.0.0.1:9293" + static let endpoint = "http://127.0.0.1:9294" case boot(String) case enroll(String) diff --git a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/LocalServer/index.mjs b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/LocalServer/index.mjs index 1ca545833c..4d019007b7 100644 --- a/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/LocalServer/index.mjs +++ b/AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/LocalServer/index.mjs @@ -72,6 +72,6 @@ app.post('/match', async (req, res) => { } }) -app.listen(9293, () => { +app.listen(9294, () => { console.log("Simulator server started!") })