It would be convenient if you run cypress tests on PR.
i've used gitlab or circleci to run my cypress test per build
Here is a example of my .gitlab-ci.yml file -
# Docker images provided by https://github.com/cypress-io/cypress-docker-images
# first, install Cypress, then run all tests (in parallel)
stages:
- build
- test
# to cache both npm modules and Cypress binary we use environment variables
# to point at the folders we can list as paths in "cache" job settings
variables:
npm_config_cache: /builds/cypress-io/cypress-example-docker-gitlab/.npm
CYPRESS_CACHE_FOLDER: /builds/cypress-io/cypress-example-docker-gitlab/cache/Cypress
# cache using branch name
# https://gitlab.com/help/ci/caching/index.md
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm
- ~/.cache/Cypress
- node_modules
# this job installs NPM dependencies and Cypress
install:
image: cypress/base:10
stage: build
script:
- npm ci
- $(npm bin)/cypress verify
# two jobs that run after "install" job finishes
# NPM dependencies and Cypress binary should be already installed
cypress-e2e:
image: cypress/base:10
stage: test
script:
- npx cypress install
- $(npm bin)/cypress run --spec 'cypress/e2e/tests.spec.js'
artifacts:
expire_in: 1 week
when: always
paths:
- cypress/screenshots
- cypress/videos
That's for latter
Most helpful comment
i've used
gitlaborcirclecito run my cypress test per buildHere is a example of my
.gitlab-ci.ymlfile -