Skip to content

Commit 0cdb7a8

Browse files
committed
Clean up
1 parent 49cd570 commit 0cdb7a8

File tree

6 files changed

+95
-54
lines changed

6 files changed

+95
-54
lines changed

.github/workflows/callable-local-e2e-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ jobs:
128128
name: ${{ inputs.test_name }}
129129
if-no-files-found: ignore
130130
path: |
131-
amplify-js-samples-staging/cypress/videos
132-
amplify-js-samples-staging/cypress/screenshots
131+
cypress/videos
132+
cypress/screenshots
133133
retention-days: 14

.github/workflows/callable-local-e2e-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,41 @@ jobs:
2626
- name: Run tests
2727
working-directory: ./amplify-data
2828
run: npm run e2e-node:test
29+
30+
e2e-prep:
31+
name: Get E2E test config
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
36+
with:
37+
path: amplify-data
38+
- name: Read integ config files
39+
id: load_config
40+
run: |
41+
echo "INTEG_CONFIG=$(cat .github/integ-config/local-integ-all.yml | yq '.tests' -o=json | jq -c .)" >> $GITHUB_OUTPUT
42+
working-directory: ./amplify-data
43+
outputs:
44+
integ-config: ${{ steps.load_config.outputs.INTEG_CONFIG }}
45+
46+
e2e-test-runner:
47+
name: E2E test runnner
48+
needs: e2e-prep
49+
secrets: inherit
50+
strategy:
51+
matrix:
52+
integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config) }}
53+
fail-fast: false
54+
uses: ./.github/workflows/callable-local-e2e-test.yml
55+
with:
56+
test_name: ${{ matrix.integ-config.test_name }}
57+
framework: ${{ matrix.integ-config.framework }}
58+
spec: ${{ matrix.integ-config.spec || '' }}
59+
sample_name: ${{ toJSON(matrix.integ-config.sample_name) || '[""]' }}
60+
browser: ${{ toJSON(matrix.integ-config.browser) || '[""]' }}
61+
backend: ${{ matrix.integ-config.backend }}
62+
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
63+
retry_count: ${{ matrix.integ-config.retry_count || 3 }}
64+
npm_script: ${{ matrix.integ-config.npm_script || '' }}
65+
npm_script_args: ${{ matrix.integ-config.npm_script_args || 15 }}
66+
env: ${{ matrix.integ-config.env && toJSON(matrix.integ-config.env) || '{}' }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ packages/*/temp
1919

2020
# rollup
2121
**/.rollup.cache
22-
**/buildMeta
22+
**/buildMeta
23+
24+
# cypress
25+
cypress/videos
26+
cypress/screenshots

e2e-TEST-COVERAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The following table outlines the current e2e test coverage for various runtimes
66
|---------------------|-----------|
77
| Chrome | [](.github/workflows/callable-e2e-test.yml) |
88
| Node | [](packages/e2e-tests/node/jest.config.ts) |
9-
| Webpack | ⚠️ |
9+
| Webpack | [](packages/e2e-tests/webpack/basic-bundle/webpack.config.js) |
1010
| Rollup | ⚠️ |
1111
| Metro | ⚠️ |
1212
| React Natives | ⚠️ |

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"test": "turbo run test && npm run test:scripts && npm run e2e-exports",
4646
"test:scripts": "npx jest scripts/",
4747
"ci:test": "node scripts/test.js",
48-
"ci:test-webpack": "node scripts/webpack-test.js",
4948
"turbo": "turbo",
5049
"vend": "npm run start:npm-proxy && npm run publish:local"
5150
},

packages/data-schema/src/runtime/internals/operations/get.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -109,55 +109,55 @@ function _get(
109109
const userAgentOverride = createUserAgentOverride(customUserAgentDetails);
110110

111111
try {
112-
// const basePromise = context
113-
// ? ((client as BaseSSRClient).graphql(
114-
// context,
115-
// {
116-
// ...auth,
117-
// query,
118-
// variables,
119-
// },
120-
// headers,
121-
// ) as Promise<GraphQLResult>)
122-
// : ((client as BaseBrowserClient).graphql(
123-
// {
124-
// ...auth,
125-
// query,
126-
// variables,
127-
// ...userAgentOverride,
128-
// },
129-
// headers,
130-
// ) as Promise<GraphQLResult>);
131-
// const extendedPromise = extendCancellability(basePromise, resultPromise);
132-
// const { data, extensions } = await extendedPromise;
133-
// // flatten response
134-
// if (data) {
135-
// const [key] = Object.keys(data);
136-
// const flattenedResult = flattenItems(
137-
// modelIntrospection,
138-
// name,
139-
// data[key],
140-
// );
141-
// if (flattenedResult === null) {
142-
// return { data: null, extensions };
143-
// } else if (options?.selectionSet) {
144-
// return { data: flattenedResult, extensions };
145-
// } else {
146-
// // TODO: refactor to avoid destructuring here
147-
// const [initialized] = initializeModel(
148-
// client,
149-
// name,
150-
// [flattenedResult],
151-
// modelIntrospection,
152-
// auth.authMode,
153-
// auth.authToken,
154-
// !!context,
155-
// );
156-
// return { data: initialized, extensions };
157-
// }
158-
// } else {
159-
// return { data: null, extensions };
160-
// }
112+
const basePromise = context
113+
? ((client as BaseSSRClient).graphql(
114+
context,
115+
{
116+
...auth,
117+
query,
118+
variables,
119+
},
120+
headers,
121+
) as Promise<GraphQLResult>)
122+
: ((client as BaseBrowserClient).graphql(
123+
{
124+
...auth,
125+
query,
126+
variables,
127+
...userAgentOverride,
128+
},
129+
headers,
130+
) as Promise<GraphQLResult>);
131+
const extendedPromise = extendCancellability(basePromise, resultPromise);
132+
const { data, extensions } = await extendedPromise;
133+
// flatten response
134+
if (data) {
135+
const [key] = Object.keys(data);
136+
const flattenedResult = flattenItems(
137+
modelIntrospection,
138+
name,
139+
data[key],
140+
);
141+
if (flattenedResult === null) {
142+
return { data: null, extensions };
143+
} else if (options?.selectionSet) {
144+
return { data: flattenedResult, extensions };
145+
} else {
146+
// TODO: refactor to avoid destructuring here
147+
const [initialized] = initializeModel(
148+
client,
149+
name,
150+
[flattenedResult],
151+
modelIntrospection,
152+
auth.authMode,
153+
auth.authToken,
154+
!!context,
155+
);
156+
return { data: initialized, extensions };
157+
}
158+
} else {
159+
return { data: null, extensions };
160+
}
161161
} catch (error: any) {
162162
/**
163163
* The `data` type returned by `error` here could be:

0 commit comments

Comments
 (0)