Configure GitLab CI
https://docs.gitlab.com/ee/ci/yaml/
Write .gitlab-ci.yml file
Now we need to create the .gitlab-ci.yml
file in the root of the project:
.gitlab-ci.yml
image: node-protractor:latest
cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
- node_modules/
before_script:
- npm install
unit_tests:
script:
- npm run test-ci
e2e_tests:
before_script:
- npm run http-server-ci
script:
- npm run protractor-ci
It will use node-protractor:latest
docker image to run tests. We enable caching of node_modules
folder to avoid reinstalling modules between tests executions. In this configuration we create two tasks unit_tests
and e2e_tests
that will be run separately.