Skip to content

Commit 19e17df

Browse files
AaronZyLeephani-srikaredupp
authored
feat: add E2e testing (#169)
* fix(e2e-testing): adding the first draft of e2e testing packages * fix(e2e-testing): lint fixes * fix(e2e-testing): update README * fix(e2e-testing): remove TODOs for CLI path and schema path * fix(e2e-testing): move sample apps to different branch * fix(e2e-testing): rename e2e-core and keep all contents * fix(e2e-testing): add e2e-testing jobs to circleci config * fix(e2e-testing): move pre and post steps to commands section * fix(e2e-testing): rename references to amplify-e2e-core * fix(e2e-testing): attach workspace to commands * fix(e2e-testing): rearrange jobs to persist workspace * fix(e2e-testing): use bash shell before sourcing to shell script * fix(e2e-testing): source into local_publish script only once * fix(e2e-testing): install npm-auth-to-token dependency * fix(e2e-testing): remove loginToLocalRegistry step * fix(e2e-testing): use unsetNpmRegistryUrl directly * fix(e2e-testing): use verdaccio-disconnect without yarn bash command * fix(e2e-testing): explicitly source the local_publish script * fix(e2e-testing): remove the kill process that fails * fix(e2e-testing): move install CLI to e2e-testing job * fix(e2e-testing): correct the job dependencies * fix(e2e-testing): correct getCLIPath method to use amplify binary * fix(e2e-testing): fix linting issue * fix(e2e-testing): remove select plugin step from codegen models prompts * chore(e2e-testing): define multiple executors and test if install-cli step uses the local codegen * chore(e2e-testing): add os parameter to defaults * chore(e2e-testing): add explicit call to local registry * chore(e2e-testing): declare and pass local registry url from circleci config * chore(e2e-testing): add windows os * chore(e2e-testing): keep different os steps separate * chore(e2e-testing): increase size of windows executor * ci(e2e-testing): move os types other than linux to different branch * ci(e2e-testing): add step to install old version of CLI * ci(e2e-testing): add feature flags test * ci(e2e-testing): change node image to 10 * ci(e2e-testing): remove unused dependency * ci: add cli-codegen e2e test suites (#151) *ci(e2e-testing): add P0 e2e tests Co-authored-by: Phani Srikar Edupuganti <[email protected]> * Split e2e tests based on frontend. Add e2e tests for codegen configure and add workflows (#156) *ci(e2e-testing): add codegen add, configure, remove e2e tests; split tests based on frontend type * Extend build and test jobs to windows and mac OS (#157) * ci: add windows and mac images * ci: fix windows image resource class type * ci: testing nvm install macos * fix(amplify-codegen): run unit tests from windows * ci(e2e-testing): changes to make unit tests run on windows * ci(graphql-types-generator): fix the tests on windows for typegen * ci(e2e-testing): use node 12 for macOS * ci(e2e-testing): store caches for different executors using unique keys * ci(e2e-testing): run single e2e test on all executors * ci(e2e-testing): fix permissions issue to run yarn on macOS * ci(e2e-testing): add exit 0 to terminate install cli script windows * ci(e2e-testing): remove windows e2e testing job * ci(e2e-testing): remove macos e2e job * ci(e2e-testing): remove feature branch from build-test-deploy workflow * ci(e2e-testing): remove macos specific step * ci: modify install_cli step * ci(e2e-testing): upgrade minimum node version to 12 Co-authored-by: edupp <[email protected]> * test: add split e2e test script (#163) * test: add split e2e test script * ci: regenerate config.yml * fix indent issue * fix: remove quote * change to array type * fix executor names * fix job name error * add todo for sorting test suites * add split-e2e branch * fix workspace * fix workspace * remove sudo in publish script * fix the region issue and cleanup * add cleaup context * fix configure tests and timeout * address CR * add tests in ascending order * fix package.json * remove unused coverage * change to node15 * change configure script * fix sudo * fix nexpect pathname * update nexpet * fix configure * remove node cmd * use npm instead of yarn * fix e2e * remove cli dependency * restore package.json change * add dependency * fix ff test * add script in setup-dev for cli setup * add hold job and resolve LGTM * remove arch * add conditional steps * add conditional steps * add conditional steps * add conditional steps * fix config file * fix ff tests Co-authored-by: phani-srikar <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> Co-authored-by: edupp <[email protected]>
1 parent f7de414 commit 19e17df

File tree

238 files changed

+20489
-554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+20489
-554
lines changed

.circleci/config.base.yml

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
version: 2.1
2+
machine:
3+
environment:
4+
PATH: '${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin'
5+
executors:
6+
linux_node12: &linux_node12
7+
docker:
8+
- image: circleci/node:12
9+
resource_class: large
10+
linux_node15: &linux_node15
11+
docker:
12+
- image: circleci/node:15
13+
resource_class: large
14+
windows_node12: &windows_node12
15+
machine:
16+
image: 'windows-server-2019-vs2019:stable'
17+
resource_class: windows.large
18+
shell: bash.exe
19+
macos_node12: &macos_node12
20+
macos:
21+
xcode: "11.2.1"
22+
resource_class: large
23+
24+
defaults: &defaults
25+
working_directory: ~/repo
26+
parameters:
27+
os:
28+
type: executor
29+
30+
install_cli_with_local_codegen: &install_cli
31+
name: install Amplify CLI and amplify-app with local Amplify Codegen
32+
command: |
33+
source .circleci/local_publish_helpers.sh
34+
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
35+
setNpmRegistryUrlToLocal
36+
sudo npm install -g @aws-amplify/cli
37+
sudo npm install -g amplify-app
38+
amplify -v
39+
amplify-app --version
40+
unsetNpmRegistryUrl
41+
working_directory: ~/repo
42+
43+
clean_up_e2e_resources: &cleanup_e2e
44+
name: Clean up e2e resources
45+
command: |
46+
cd packages/amplify-codegen-e2e-tests
47+
yarn clean-e2e-resources job ${CIRCLE_BUILD_NUM}
48+
working_directory: ~/repo
49+
50+
jobs:
51+
build:
52+
<<: *defaults
53+
executor: << parameters.os >>
54+
steps:
55+
- checkout
56+
- run: yarn config set workspaces-experimental true
57+
- run: yarn cache clean --force
58+
- run: yarn run production-build
59+
- save_cache:
60+
key: amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
61+
paths:
62+
- ~/.cache
63+
- save_cache:
64+
key: amplify-codegen-ssh-deps-{{ .Branch }}
65+
paths:
66+
- ~/.ssh
67+
- persist_to_workspace:
68+
root: .
69+
paths: .
70+
71+
test:
72+
<<: *defaults
73+
executor: << parameters.os >>
74+
steps:
75+
- when:
76+
condition:
77+
or:
78+
- equal: [ *macos_node12, << parameters.os >> ]
79+
- equal: [ *windows_node12, << parameters.os >> ]
80+
steps:
81+
- checkout
82+
- run: yarn config set workspaces-experimental true
83+
- run: yarn cache clean --force
84+
- run: yarn run production-build
85+
- when:
86+
condition:
87+
or:
88+
- equal: [ *linux_node12, << parameters.os >> ]
89+
- equal: [ *linux_node15, << parameters.os >> ]
90+
steps:
91+
- attach_workspace:
92+
at: ./
93+
- restore_cache:
94+
key: amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
95+
- run:
96+
name: Lint
97+
command: yarn lint
98+
- run:
99+
name: Run tests
100+
command: yarn test-ci
101+
- run:
102+
name: Collect code coverage
103+
command: yarn coverage
104+
105+
deploy:
106+
<<: *defaults
107+
executor: << parameters.os >>
108+
steps:
109+
- attach_workspace:
110+
at: ./
111+
- restore_cache:
112+
keys:
113+
- amplify-codegen-ssh-deps-{{ .Branch }}
114+
- amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
115+
- run:
116+
name: Authenticate with npm
117+
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
118+
- run:
119+
name: Publish Amplify Codegen
120+
command: |
121+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
122+
git config --global user.email $GITHUB_EMAIL
123+
git config --global user.name $GITHUB_USER
124+
npm run publish:$CIRCLE_BRANCH
125+
else
126+
echo "Skipping deploy."
127+
fi
128+
129+
publish_to_local_registry:
130+
<<: *defaults
131+
executor: << parameters.os >>
132+
steps:
133+
- attach_workspace:
134+
at: ./
135+
- restore_cache:
136+
key: amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
137+
- run:
138+
name: Publish to verdaccio
139+
command: |
140+
source .circleci/local_publish_helpers.sh
141+
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
142+
setNpmRegistryUrlToLocal
143+
loginToLocalRegistry
144+
git config user.email [email protected]
145+
git config user.name "Doesnt Matter"
146+
yarn publish-to-verdaccio
147+
unsetNpmRegistryUrl
148+
- save_cache:
149+
key: amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}
150+
paths:
151+
- ~/verdaccio-cache/
152+
153+
e2e-test:
154+
<<: *defaults
155+
executor: << parameters.os >>
156+
steps:
157+
- attach_workspace:
158+
at: ./
159+
- restore_cache:
160+
key: amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}
161+
- run: *install_cli
162+
- run:
163+
name: Run e2e tests
164+
command: |
165+
cd packages/amplify-codegen-e2e-tests
166+
yarn e2e --maxWorkers=3 $TEST_SUITE
167+
no_output_timeout: 20m
168+
- store_test_results:
169+
path: packages/amplify-codegen-e2e-tests/
170+
- store_artifacts:
171+
path: ~/repo/packages/amplify-codegen-e2e-tests/amplify-e2e-reports
172+
173+
done_with_node_e2e_tests:
174+
<<: *defaults
175+
executor: << parameters.os >>
176+
steps:
177+
- run: echo 'Done with Node CLI E2E Tests'
178+
workflows:
179+
version: 2
180+
build_test_deploy:
181+
jobs:
182+
- build:
183+
os: linux_node12
184+
- test:
185+
name: test-<< matrix.os >>
186+
matrix:
187+
parameters:
188+
os: [linux_node15, linux_node12, windows_node12, macos_node12]
189+
requires:
190+
- build
191+
- publish_to_local_registry:
192+
os: linux_node12
193+
requires:
194+
- build
195+
filters:
196+
branches:
197+
only:
198+
- master
199+
- e2e-testing
200+
- approval_for_e2e_test:
201+
type: approval
202+
requires:
203+
- publish_to_local_registry
204+
- e2e-test:
205+
context:
206+
- cleanup-resources
207+
os: linux_node12
208+
requires:
209+
- approval_for_e2e_test
210+
post-steps:
211+
- run: *cleanup_e2e
212+
filters:
213+
branches:
214+
only:
215+
- master
216+
- e2e-testing
217+
- deploy:
218+
os: linux_node12
219+
requires:
220+
- build
221+
- test
222+
- done_with_node_e2e_tests
223+
filters:
224+
branches:
225+
only:
226+
- release
227+
- master
228+
- done_with_node_e2e_tests:
229+
os: linux_node12
230+
requires:
231+
- e2e-test

0 commit comments

Comments
 (0)