Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev committed Oct 15, 2024
1 parent c17e6f8 commit ab6e471
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 149 deletions.
44 changes: 22 additions & 22 deletions .github/integ-config/detox-integ-all.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# - test_name: 'integ_rn_ios_storage'
# working_directory: amplify-js-samples-staging/samples/react-native/storage/StorageApp
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_storage_multipart_progress'
# working_directory: amplify-js-samples-staging/samples/react-native/storage/MultiPartUploadWithProgress
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_device_tracking'
# working_directory: amplify-js-samples-staging/samples/react-native/auth/deviceTracking
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_datastore_sqlite_adapter'
# working_directory: amplify-js-samples-staging/samples/react-native/datastore/SQLiteAdapter
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_api_gen2_rn_72_detox_cli'
# working_directory: amplify-js-samples-staging/samples/react-native/api/gen2/ApiGraphQLGen2
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_api_v6_rn_72_detox_cli'
# working_directory: amplify-js-samples-staging/samples/react-native/api/v6/ApiGRAPHQL
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_oidc_signout'
# working_directory: amplify-js-samples-staging/samples/react-native/auth/HosteduiApp
# timeout_minutes: 120
# host_signout_page: true
- test_name: 'integ_rn_ios_storage'
working_directory: amplify-js-samples-staging/samples/react-native/storage/StorageApp
timeout_minutes: 120
- test_name: 'integ_rn_ios_storage_multipart_progress'
working_directory: amplify-js-samples-staging/samples/react-native/storage/MultiPartUploadWithProgress
timeout_minutes: 120
- test_name: 'integ_rn_ios_device_tracking'
working_directory: amplify-js-samples-staging/samples/react-native/auth/deviceTracking
timeout_minutes: 120
- test_name: 'integ_rn_ios_datastore_sqlite_adapter'
working_directory: amplify-js-samples-staging/samples/react-native/datastore/SQLiteAdapter
timeout_minutes: 120
- test_name: 'integ_rn_ios_api_gen2_rn_72_detox_cli'
working_directory: amplify-js-samples-staging/samples/react-native/api/gen2/ApiGraphQLGen2
timeout_minutes: 120
- test_name: 'integ_rn_ios_api_v6_rn_72_detox_cli'
working_directory: amplify-js-samples-staging/samples/react-native/api/v6/ApiGRAPHQL
timeout_minutes: 120
- test_name: 'integ_rn_ios_oidc_signout'
working_directory: amplify-js-samples-staging/samples/react-native/auth/HosteduiApp
timeout_minutes: 120
host_signout_page: true
16 changes: 8 additions & 8 deletions .github/integ-config/integ-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,14 @@ tests:
browser: *minimal_browser_list

# GEO
# - test_name: integ_react_geo_display_map
# desc: 'Display Map'
# framework: react
# category: geo
# sample_name: [display-map]
# spec: display-map
# # Temp fix:
# browser: [chrome]
- test_name: integ_react_geo_display_map
desc: 'Display Map'
framework: react
category: geo
sample_name: [display-map]
spec: display-map
# Temp fix:
browser: [chrome]
- test_name: integ_react_geo_search_outside_map
desc: 'Search Outside Map'
framework: react
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/callable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ jobs:
# timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
# retry_count: ${{ matrix.integ-config.retry_count || 3 }}

# detox-e2e-test-runner:
# name: E2E test runner
# needs: e2e-prep
# strategy:
# matrix:
# integ-config: ${{ fromJson(needs.e2e-prep.outputs.detox-integ-config) }}
# fail-fast: false
# secrets: inherit
# uses: ./.github/workflows/callable-e2e-test-detox.yml
# with:
# test_name: ${{ matrix.integ-config.test_name }}
# working_directory: ${{ matrix.integ-config.working_directory }}
# timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 45 }}
# host_signout_page: ${{ matrix.integ-config.host_signout_page || false }}
detox-e2e-test-runner:
name: E2E test runner
needs: e2e-prep
strategy:
matrix:
integ-config: ${{ fromJson(needs.e2e-prep.outputs.detox-integ-config) }}
fail-fast: false
secrets: inherit
uses: ./.github/workflows/callable-e2e-test-detox.yml
with:
test_name: ${{ matrix.integ-config.test_name }}
working_directory: ${{ matrix.integ-config.working_directory }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 45 }}
host_signout_page: ${{ matrix.integ-config.host_signout_page || false }}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
// Optionally specify a single test file to run/debug:
"AWSAppSyncRealTimeProvider.test.ts",
"generateClient.test.ts",
"--runInBand",
"--testTimeout",
"600000", // 10 min timeout so jest doesn't error while we're stepping through code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jest.mock('@aws-amplify/core/internals/aws-client-utils', () => {
);
return {
...original,
signRequest: (_request, _options) => {
signRequest: (_request: any, _options: any) => {
return {
method: 'test',
headers: { test: 'test' },
Expand All @@ -47,7 +47,7 @@ jest.mock('@aws-amplify/core', () => {
};
return {
...original,
fetchAuthSession: (_request, _options) => {
fetchAuthSession: (_request: any, _options: any) => {
return Promise.resolve(session);
},
Amplify: {
Expand Down Expand Up @@ -628,7 +628,7 @@ describe('AWSAppSyncRealTimeProvider', () => {
});

test('subscription observer error is triggered when a connection is formed and a non-retriable connection_error data message is received', async () => {
expect.assertions(2);
expect.assertions(3);

const socketCloseSpy = jest.spyOn(
fakeWebSocketInterface.webSocket,
Expand Down Expand Up @@ -675,8 +675,9 @@ describe('AWSAppSyncRealTimeProvider', () => {
}),
);

// TODO: this method is getting called (validated via breakpoint) but test fails
// expect(socketCloseSpy).toHaveBeenCalledWith(3001);
await delay(1);

expect(socketCloseSpy).toHaveBeenCalledWith(3001);
});

test('subscription observer error is triggered when a connection is formed', async () => {
Expand Down Expand Up @@ -1180,7 +1181,7 @@ describe('AWSAppSyncRealTimeProvider', () => {
});

test('authenticating with AWS_LAMBDA/custom w/ custom header function that accepts request options', async () => {
expect.assertions(3); // TODO: check this; should be 2
expect.assertions(3);

provider
.subscribe({
Expand Down
Loading

0 comments on commit ab6e471

Please sign in to comment.