Cypress-file-upload: [Feature] Run example cypress test on pull request as E2E

Created on 19 Mar 2019  路  2Comments  路  Source: abramenal/cypress-file-upload

It would be convenient if you run cypress tests on PR.

enhancement wontfix

Most helpful comment

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

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings