Skip to content

Commit a3906a1

Browse files
authored
chore(auth): fix web authn and push notifications integration tests (#4241)
1 parent 7cc49bc commit a3906a1

3 files changed

Lines changed: 11 additions & 23 deletions

File tree

AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@
902902
PRODUCT_BUNDLE_IDENTIFIER = com.amazon.aws.amplify.swift.AnalyticsHostAppWatch.watchkitapp;
903903
PRODUCT_NAME = "$(TARGET_NAME)";
904904
SDKROOT = watchos;
905-
SKIP_INSTALL = YES;
905+
SKIP_INSTALL = NO;
906906
SWIFT_EMIT_LOC_STRINGS = YES;
907907
SWIFT_VERSION = 5.0;
908908
TARGETED_DEVICE_FAMILY = 4;
@@ -932,7 +932,7 @@
932932
PRODUCT_BUNDLE_IDENTIFIER = com.amazon.aws.amplify.swift.AnalyticsHostAppWatch.watchkitapp;
933933
PRODUCT_NAME = "$(TARGET_NAME)";
934934
SDKROOT = watchos;
935-
SKIP_INSTALL = YES;
935+
SKIP_INSTALL = NO;
936936
SWIFT_EMIT_LOC_STRINGS = YES;
937937
SWIFT_VERSION = 5.0;
938938
TARGETED_DEVICE_FAMILY = 4;

AmplifyPlugins/Auth/Tests/AuthWebAuthnApp/AuthWebAuthnAppUITests/AuthWebAuthnAppUITests.swift

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import XCTest
99

1010
final 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

AmplifyPlugins/Notifications/Push/Tests/PushNotificationHostApp/PushNotificationHostApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@
868868
PRODUCT_BUNDLE_IDENTIFIER = com.aws.amplify.notification.PushNotificationHostApp;
869869
PRODUCT_NAME = "$(TARGET_NAME)";
870870
SDKROOT = watchos;
871-
SKIP_INSTALL = YES;
871+
SKIP_INSTALL = NO;
872872
SWIFT_EMIT_LOC_STRINGS = YES;
873873
SWIFT_VERSION = 5.0;
874874
TARGETED_DEVICE_FAMILY = 4;
@@ -899,7 +899,7 @@
899899
PRODUCT_BUNDLE_IDENTIFIER = com.aws.amplify.notification.PushNotificationHostApp;
900900
PRODUCT_NAME = "$(TARGET_NAME)";
901901
SDKROOT = watchos;
902-
SKIP_INSTALL = YES;
902+
SKIP_INSTALL = NO;
903903
SWIFT_EMIT_LOC_STRINGS = YES;
904904
SWIFT_VERSION = 5.0;
905905
TARGETED_DEVICE_FAMILY = 4;

0 commit comments

Comments
 (0)