Skip to content

Commit 59e945d

Browse files
authored
chore: kickoff release
2 parents 0a78846 + 5016f36 commit 59e945d

File tree

3 files changed

+61
-22
lines changed

3 files changed

+61
-22
lines changed

AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extension AppSyncRealTimeClientFactory {
136136
return url
137137
}
138138

139-
guard host.hasSuffix("amazonaws.com") else {
139+
guard host.hasSuffix("amazonaws.com") || host.hasSuffix("amazonaws.com.cn") else {
140140
return url.appendingPathComponent("realtime")
141141
}
142142

@@ -163,7 +163,7 @@ extension AppSyncRealTimeClientFactory {
163163
return url
164164
}
165165

166-
guard host.hasSuffix("amazonaws.com") else {
166+
guard host.hasSuffix("amazonaws.com") || host.hasSuffix("amazonaws.com.cn") else {
167167
if url.lastPathComponent == "realtime" {
168168
return url.deletingLastPathComponent()
169169
}

AmplifyPlugins/API/Tests/AWSAPIPluginTests/SubscriptionFactory/AppSyncRealTimeClientFactoryTests.swift

+36
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
1717
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpoint),
1818
URL(string: "wss://abc.appsync-realtime-api.amazonaws.com/graphql")
1919
)
20+
21+
let appSyncEndpointCN = URL(string: "https://abc.appsync-api.amazonaws.com.cn/graphql")!
22+
XCTAssertEqual(
23+
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpointCN),
24+
URL(string: "wss://abc.appsync-realtime-api.amazonaws.com.cn/graphql")
25+
)
2026
}
2127

2228
func testAppSyncRealTimeEndpoint_withAWSAppSyncRealTimeDomain_returnTheSameDomain() {
@@ -25,6 +31,12 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
2531
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpoint),
2632
URL(string: "wss://abc.appsync-realtime-api.amazonaws.com/graphql")
2733
)
34+
35+
let appSyncEndpointCN = URL(string: "wss://abc.appsync-realtime-api.amazonaws.com.cn/graphql")!
36+
XCTAssertEqual(
37+
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpointCN),
38+
URL(string: "wss://abc.appsync-realtime-api.amazonaws.com.cn/graphql")
39+
)
2840
}
2941

3042
func testAppSyncRealTimeEndpoint_withCustomDomain_returnCorrectRealtimePath() {
@@ -33,6 +45,12 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
3345
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpoint),
3446
URL(string: "https://test.example.com/graphql/realtime")
3547
)
48+
49+
let appSyncEndpointCN = URL(string: "https://test.example.com.cn/graphql")!
50+
XCTAssertEqual(
51+
AppSyncRealTimeClientFactory.appSyncRealTimeEndpoint(appSyncEndpointCN),
52+
URL(string: "https://test.example.com.cn/graphql/realtime")
53+
)
3654
}
3755

3856
func testAppSyncApiEndpoint_withAWSAppSyncRealTimeDomain_returnCorrectApiDomain() {
@@ -41,6 +59,12 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
4159
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpoint),
4260
URL(string: "https://abc.appsync-api.amazonaws.com/graphql")
4361
)
62+
63+
let appSyncEndpointCN = URL(string: "wss://abc.appsync-realtime-api.amazonaws.com.cn/graphql")!
64+
XCTAssertEqual(
65+
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpointCN),
66+
URL(string: "https://abc.appsync-api.amazonaws.com.cn/graphql")
67+
)
4468
}
4569

4670
func testAppSyncApiEndpoint_withAWSAppSyncApiDomain_returnTheSameDomain() {
@@ -49,6 +73,12 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
4973
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpoint),
5074
URL(string: "https://abc.appsync-api.amazonaws.com/graphql")
5175
)
76+
77+
let appSyncEndpointCN = URL(string: "https://abc.appsync-api.amazonaws.com.cn/graphql")!
78+
XCTAssertEqual(
79+
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpointCN),
80+
URL(string: "https://abc.appsync-api.amazonaws.com.cn/graphql")
81+
)
5282
}
5383

5484
func testAppSyncApiEndpoint_withCustomDomain_returnCorrectRealtimePath() {
@@ -57,5 +87,11 @@ class AppSyncRealTimeClientFactoryTests: XCTestCase {
5787
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpoint),
5888
URL(string: "https://test.example.com/graphql")
5989
)
90+
91+
let appSyncEndpointCN = URL(string: "https://test.example.com.cn/graphql")!
92+
XCTAssertEqual(
93+
AppSyncRealTimeClientFactory.appSyncApiEndpoint(appSyncEndpointCN),
94+
URL(string: "https://test.example.com.cn/graphql")
95+
)
6096
}
6197
}

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

+23-20
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ final class AuthWebAuthnAppUITests: XCTestCase {
1919
private var deleteButton: XCUIElement!
2020
private var deleteUserButton: XCUIElement!
2121
private var springboard: XCUIApplication!
22-
private var continueButton: XCUIElement! {
23-
springboard.otherElements["ASAuthorizationControllerContinueButton"]
24-
}
2522

2623
private lazy var deviceIdentifier: String = {
2724
let paths = Bundle.main.bundleURL.pathComponents
@@ -81,35 +78,36 @@ final class AuthWebAuthnAppUITests: XCTestCase {
8178
}
8279

8380
guard associateAttempt else {
84-
XCTFail("Failed to trigger the Associate WebAuthn Credential workflow")
81+
XCTFail("Failed to trigger the Associate WebAuthn Credential workflow: \(lastResult)")
8582
return
8683
}
8784

8885
// Wait for the "Continue" button to appear in the FaceID popover and tap it
89-
guard continueButton.waitForExistence(timeout: timeout) else {
90-
XCTFail("Failed to find 'Continue' button")
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")
9189
return
9290
}
93-
continueButton.tap()
91+
associateContinueButton.tap()
9492

9593
// Trigger a matching face
9694
try await matchBiometrics()
9795
guard waitForResult("WebAuthn credential was associated") else {
98-
XCTFail("Failed to associate credential")
96+
XCTFail("Failed to associate credential: \(lastResult)")
9997
return
10098
}
10199

102100
// 2. List existing credentials
103101
listButton.tap()
104102
guard waitForResult("WebAuthn Credentials: 1") else {
105-
XCTFail("Failed to list credentials")
103+
XCTFail("Failed to list credentials: \(lastResult)")
106104
return
107105
}
108106

109107
// 3. Sign Out
110108
signOutButton.tap()
111109
guard waitForResult("User is signed out"), signInButton.exists else {
112-
XCTFail("Failed to sign out user")
110+
XCTFail("Failed to sign out user: \(lastResult)")
113111
return
114112
}
115113

@@ -120,13 +118,14 @@ final class AuthWebAuthnAppUITests: XCTestCase {
120118
}
121119

122120
guard signInAttempt else {
123-
XCTFail("Failed to trigger the Assert WebAuthn Credential workflow")
121+
XCTFail("Failed to trigger the Assert WebAuthn Credential workflow: \(lastResult)")
124122
return
125123
}
126124

127125
// Wait for the "Continue" button to appear in the FaceID popover
128-
guard continueButton.waitForExistence(timeout: timeout) else {
129-
XCTFail("Failed to find 'Continue' button")
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")
130129
return
131130
}
132131

@@ -137,27 +136,27 @@ final class AuthWebAuthnAppUITests: XCTestCase {
137136
}
138137

139138
// Tap the "Continue" button
140-
continueButton.tap()
139+
signInContinueButton.tap()
141140

142141
// Trigger a matching face
143142
try await matchBiometrics()
144143

145144
guard waitForResult("User is signed in") else {
146-
XCTFail("Failed to Sign In with WebAuthn")
145+
XCTFail("Failed to Sign In with WebAuthn: \(lastResult)")
147146
return
148147
}
149148

150149
// 5. Delete credential
151150
deleteButton.tap()
152151
guard waitForResult("WebAuthn credential was deleted") else {
153-
XCTFail("Failed to delete credential")
152+
XCTFail("Failed to delete credential: \(lastResult)")
154153
return
155154
}
156155

157156
// 6. Verify deletion
158157
listButton.tap()
159158
guard waitForResult("WebAuthn Credentials: 0") else {
160-
XCTFail("Failed to list credentials")
159+
XCTFail("Failed to list credentials: \(lastResult)")
161160
return
162161
}
163162
}
@@ -194,7 +193,7 @@ final class AuthWebAuthnAppUITests: XCTestCase {
194193
return
195194
}
196195

197-
username = usernameElement.label
196+
username = usernameElement.label.lowercased()
198197

199198
// Once the Username label exists, all these button are expected to visible as well,
200199
// so we don't wait for them and instead just check for their existence
@@ -240,7 +239,7 @@ final class AuthWebAuthnAppUITests: XCTestCase {
240239
private func signUpAndSignInUser() {
241240
signUpButton.tap()
242241
guard waitForResult("User is signed in"), signOutButton.exists else {
243-
XCTFail("Failed to Sign Up and Sign In")
242+
XCTFail("Failed to Sign Up and Sign In: \(lastResult)")
244243
return
245244
}
246245
}
@@ -253,7 +252,7 @@ final class AuthWebAuthnAppUITests: XCTestCase {
253252
}
254253
deleteUserButton.tap()
255254
guard waitForResult("User was deleted"), signUpButton.exists else {
256-
XCTFail("Failed to delete the user")
255+
XCTFail("Failed to delete the user: \(lastResult)")
257256
return
258257
}
259258
}
@@ -275,4 +274,8 @@ final class AuthWebAuthnAppUITests: XCTestCase {
275274
}
276275
return result
277276
}
277+
278+
private var lastResult: String {
279+
app.staticTexts["LastResult"].label
280+
}
278281
}

0 commit comments

Comments
 (0)