ci: add e2e tests with cypress
* Creates E2E tests using Cypress and includes two tests * Improves yarn.lock file * Includes documentation * Cypress project id * test e2e w/ ci and video * run unit command before e2e * Also cache cypress * Persist cypress to next build step * Try a different path * Try without working dir * Persist less data, but restore yarn/cypress cache in next step * Install cypress to invalidate cache * Add e2e as a blocker for merged publishing
This commit is contained in:
1 parent
30bcc07dda
commit
612832069d
14 files changed
+741
-55
No files matched your search
+39
-14
@@ -21,7 +21,7 @@ jobs:
|
||||
# Download and cache dependencies
|
||||
- checkout
|
||||
- restore_cache:
|
||||
name: Restore Yarn Package Cache
|
||||
name: Restore Yarn and Cypress Package Cache
|
||||
keys:
|
||||
# when lock file changes, use increasingly general patterns to restore cache
|
||||
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||
@@ -33,14 +33,14 @@ jobs:
|
||||
- save_cache:
|
||||
name: Save Yarn Package Cache
|
||||
paths:
|
||||
- ~/.cache/yarn
|
||||
- ~/.cache ## Cache yarn and Cypress
|
||||
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||
# Build & Test
|
||||
- run: yarn build:package:ci
|
||||
# https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/
|
||||
- run:
|
||||
name: 'JavaScript Test Suite'
|
||||
command: yarn test:ci
|
||||
command: yarn test:unit:ci
|
||||
environment:
|
||||
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
|
||||
# Store result
|
||||
@@ -53,6 +53,29 @@ jobs:
|
||||
root: ~/repo
|
||||
paths: .
|
||||
|
||||
e2e_test:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: cypress/base:8
|
||||
environment:
|
||||
## this enables colors in the output
|
||||
TERM: xterm
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/repo
|
||||
- restore_cache:
|
||||
name: Restore Yarn and Cypress Package Cache
|
||||
keys:
|
||||
# when lock file changes, use increasingly general patterns to restore cache
|
||||
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||
- yarn-packages-v1-{{ .Branch }}-
|
||||
- yarn-packages-v1-
|
||||
# - run: $(yarn bin)/cypress run --record
|
||||
# Shouldn't be needed if we're using a package cache that contains Cypress
|
||||
# Could do a check here, if it doesn't exist, install cypress?
|
||||
- run: yarn install
|
||||
- run: yarn run test:e2e:ci
|
||||
|
||||
npm_publish:
|
||||
<<: *defaults
|
||||
steps:
|
||||
@@ -121,6 +144,7 @@ jobs:
|
||||
docker push ohif/$IMAGE_NAME:$IMAGE_VERSION_FULL
|
||||
docker push ohif/$IMAGE_NAME:latest
|
||||
fi
|
||||
|
||||
build_demo_site:
|
||||
<<: *defaults
|
||||
steps:
|
||||
@@ -157,10 +181,11 @@ jobs:
|
||||
- persist_to_workspace:
|
||||
root: ~/repo
|
||||
paths: .
|
||||
|
||||
demo_site_publish:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: google/cloud-sdk
|
||||
- image: google/cloud-sdk
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/repo
|
||||
@@ -203,25 +228,25 @@ workflows:
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
- e2e_test:
|
||||
requires:
|
||||
- build_and_test
|
||||
# Update NPM
|
||||
- npm_publish:
|
||||
requires:
|
||||
- build_and_test
|
||||
- e2e_test
|
||||
# Update docs.ohif.org
|
||||
- docs_publish:
|
||||
requires:
|
||||
- build_and_test
|
||||
- e2e_test
|
||||
# Update hub.docker.org
|
||||
- docker_publish:
|
||||
requires:
|
||||
- build_and_test
|
||||
- npm_publish
|
||||
# Update viewer.ohif.org
|
||||
- build_demo_site:
|
||||
requires:
|
||||
- build_and_test
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
- e2e_test
|
||||
- demo_site_publish:
|
||||
requires:
|
||||
- build_demo_site
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
Reference in new issue
Block a user