Skip to content

Commit 566916f

Browse files
committed
Add local e2e test for webpack
1 parent 2394f64 commit 566916f

29 files changed

+34329
-1978
lines changed

.changeset/unlucky-tables-crash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'integration-tests': minor
3+
'@aws-amplify/data-schema': minor
4+
---
5+
6+
Add local e2e test for webpack
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- test_name: webpack_basic
2+
desc: 'TypeScript + Webpack 5'
3+
framework: webpack
4+
browser: [chrome]
5+
spec: webpack
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Local Webpack E2E Test
2+
3+
on: workflow_call
4+
5+
jobs:
6+
unit_test:
7+
name: Local Webpack E2E Tests
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
13+
with:
14+
path: amplify-data
15+
- name: Setup node and build the repository
16+
uses: ./amplify-data/.github/actions/node-and-build
17+
- name: Load Verdaccio with AmplifyData
18+
uses: ./amplify-data/.github/actions/load-verdaccio-with-amplify-data
19+
- name: Run cypress tests for webpack e2e test dev
20+
shell: bash
21+
working-directory: ./amplify-data
22+
env:
23+
E2E_ENV: ${{ '{}' }}
24+
run: |
25+
if [ -z “” ]; then
26+
../amplify-data/scripts/retry-yarn-script.sh -s \
27+
"ci:test-webpack \
28+
webpack \
29+
webpack \
30+
chrome \
31+
dev \
32+
cli \
33+
--env $(echo $E2E_ENV | jq -r 'tostring')" \
34+
else
35+
echo "Skipping specialized yarn script execution in the dev environment."
36+
fi
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce
39+
if: failure()
40+
with:
41+
name: ${{ inputs.test_name }}
42+
if-no-files-found: ignore
43+
path: |
44+
amplify-js-samples-staging/cypress/videos
45+
amplify-js-samples-staging/cypress/screenshots
46+
retention-days: 14

.github/workflows/callable-npm-publish-preid.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ jobs:
3939
- name: Setup node and build the repository
4040
uses: ./amplify-data/.github/actions/node-and-build
4141

42-
- name: Run npm publish
43-
uses: ./amplify-data/.github/actions/npm-publish
44-
with:
45-
target: preid
46-
preid: ${{ inputs.preid }}
47-
npm_token: ${{ secrets.NPM_TOKEN }}
48-
github_user: ${{ vars.GH_USER}}
49-
github_email: ${{ vars.GH_EMAIL}}
42+
# - name: Run npm publish
43+
# uses: ./amplify-data/.github/actions/npm-publish
44+
# with:
45+
# target: preid
46+
# preid: ${{ inputs.preid }}
47+
# npm_token: ${{ secrets.NPM_TOKEN }}
48+
# github_user: ${{ vars.GH_USER}}
49+
# github_email: ${{ vars.GH_EMAIL}}

.github/workflows/callable-npm-publish-release.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ jobs:
1616
- name: Setup node and build the repository
1717
uses: ./amplify-data/.github/actions/node-and-build
1818

19-
- name: Run npm publish
20-
uses: ./amplify-data/.github/actions/npm-publish
21-
with:
22-
target: release
23-
npm_token: ${{ secrets.NPM_TOKEN }}
24-
github_user: ${{ vars.GH_USER}}
25-
github_email: ${{ vars.GH_EMAIL}}
19+
# - name: Run npm publish
20+
# uses: ./amplify-data/.github/actions/npm-publish
21+
# with:
22+
# target: release
23+
# npm_token: ${{ secrets.NPM_TOKEN }}
24+
# github_user: ${{ vars.GH_USER}}
25+
# github_email: ${{ vars.GH_EMAIL}}
2626

27-
- name: Set github commit user
28-
env:
29-
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
30-
GITHUB_USER: ${{ vars.GH_USER }}
31-
run: |
32-
git config --global user.email $GITHUB_EMAIL
33-
git config --global user.name $GITHUB_USER
27+
# - name: Set github commit user
28+
# env:
29+
# GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
30+
# GITHUB_USER: ${{ vars.GH_USER }}
31+
# run: |
32+
# git config --global user.email $GITHUB_EMAIL
33+
# git config --global user.name $GITHUB_USER
3434

35-
- name: Update lockfile with newly published version
36-
working-directory: ./amplify-data
37-
run: npm i
35+
# - name: Update lockfile with newly published version
36+
# working-directory: ./amplify-data
37+
# run: npm i
3838

39-
- name: Commit version and changelog
40-
working-directory: ./amplify-data
41-
run: |
42-
git add .
43-
git commit -m "release: publish [ci skip]"
44-
git push origin main
45-
git push --follow-tags
39+
# - name: Commit version and changelog
40+
# working-directory: ./amplify-data
41+
# run: |
42+
# git add .
43+
# git commit -m "release: publish [ci skip]"
44+
# git push origin main
45+
# git push --follow-tags

.github/workflows/callable-release-verification.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@ jobs:
1010
prebuild-samples-staging:
1111
secrets: inherit
1212
uses: ./.github/workflows/callable-prebuild-samples-staging.yml
13-
unit-tests:
13+
# unit-tests:
14+
# needs:
15+
# - prebuild-ubuntu
16+
# uses: ./.github/workflows/callable-unit-tests.yml
17+
# local-e2e:
18+
# needs:
19+
# - prebuild-ubuntu
20+
# secrets: inherit
21+
# uses: ./.github/workflows/callable-local-e2e-tests.yml
22+
# e2e:
23+
# needs:
24+
# - prebuild-ubuntu
25+
# - prebuild-samples-staging
26+
# secrets: inherit
27+
# uses: ./.github/workflows/callable-e2e-tests.yml
28+
webpack-e2e:
1429
needs:
1530
- prebuild-ubuntu
16-
uses: ./.github/workflows/callable-unit-tests.yml
17-
local-e2e:
18-
needs:
19-
- prebuild-ubuntu
20-
secrets: inherit
21-
uses: ./.github/workflows/callable-local-e2e-tests.yml
22-
e2e:
23-
needs:
24-
- prebuild-ubuntu
25-
- prebuild-samples-staging
2631
secrets: inherit
27-
uses: ./.github/workflows/callable-e2e-tests.yml
32+
uses: ./.github/workflows/callable-local-e2e-webpack-test.yml

.github/workflows/push-main-release.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
# Must disable publishing to NPM prior to adding this branch to avoid
1515
# accidentally publishing changes.
1616
- main
17+
- lzhouq/feat/e2e-webpack
1718

1819
jobs:
1920
prebuild-ubuntu:
@@ -26,32 +27,32 @@ jobs:
2627
# token when run from a nested workflow.
2728
# TODO: Find a workaround or alternative so that this can be included in a
2829
# nested workflow (e.g. `callable-sandbox-e2e-tests.yml`).
29-
sandbox_test:
30-
name: Sandbox E2E Tests
31-
needs: prebuild-ubuntu
32-
runs-on: ubuntu-latest
33-
permissions:
34-
# these permissions are required for the `configure-aws-credentials` action to get a JWT:
35-
id-token: write
36-
contents: read
37-
steps:
38-
- name: Checkout repository
39-
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
40-
with:
41-
path: amplify-data
42-
- name: Setup node and build the repository
43-
uses: ./amplify-data/.github/actions/node-and-build
44-
- name: Configure AWS test execution credentials
45-
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
46-
with:
47-
role-to-assume: ${{ secrets.SANDBOX_E2E_RUNNER_ROLE_ARN }}
48-
aws-region: us-west-2
49-
- name: Install Sandbox E2E Dependencies
50-
working-directory: ./amplify-data
51-
run: npm run e2e-sandbox:install
52-
- name: Run E2E sandbox tests
53-
working-directory: ./amplify-data
54-
run: npm run e2e-sandbox:test
30+
# sandbox_test:
31+
# name: Sandbox E2E Tests
32+
# needs: prebuild-ubuntu
33+
# runs-on: ubuntu-latest
34+
# permissions:
35+
# # these permissions are required for the `configure-aws-credentials` action to get a JWT:
36+
# id-token: write
37+
# contents: read
38+
# steps:
39+
# - name: Checkout repository
40+
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
41+
# with:
42+
# path: amplify-data
43+
# - name: Setup node and build the repository
44+
# uses: ./amplify-data/.github/actions/node-and-build
45+
# - name: Configure AWS test execution credentials
46+
# uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
47+
# with:
48+
# role-to-assume: ${{ secrets.SANDBOX_E2E_RUNNER_ROLE_ARN }}
49+
# aws-region: us-west-2
50+
# - name: Install Sandbox E2E Dependencies
51+
# working-directory: ./amplify-data
52+
# run: npm run e2e-sandbox:install
53+
# - name: Run E2E sandbox tests
54+
# working-directory: ./amplify-data
55+
# run: npm run e2e-sandbox:test
5556
release-verification-testing:
5657
secrets: inherit
5758
uses: ./.github/workflows/callable-release-verification.yml

cypress.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from "cypress";
2+
3+
export default defineConfig({
4+
e2e: {
5+
setupNodeEvents(on, config) {
6+
// implement node event listeners here
7+
},
8+
},
9+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('webpack spec', () => {
2+
it('passes', () => {
3+
cy.visit('http://localhost:3000');
4+
});
5+
});

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

0 commit comments

Comments
 (0)