UNPKG

cypress-run

Version:

Cypress run replacement that supports parallel execution and retries

65 lines (61 loc) 2.18 kB
defaults: &defaults working_directory: ~/app docker: - image: cypress/browsers:chrome67 version: 2 jobs: build: <<: *defaults steps: - checkout # find compatible cache from previous build, # it should have same dependencies installed from package.json checksum - restore_cache: keys: - cache-{{ .Branch }}-{{ checksum "package.json" }} - run: name: Install Dependencies command: npm ci # run verify and then save cache. # this ensures that the Cypress verified status is cached too - run: npm run cypress:verify # save new cache folder if needed - save_cache: key: cache-{{ .Branch }}-{{ checksum "package.json" }} paths: - ~/.npm - ~/.cache # all other test jobs will run AFTER this build job finishes # to avoid reinstalling dependencies, we persist the source folder "app" # and the Cypress binary to workspace, which is the fastest way # for Circle jobs to pass files - persist_to_workspace: root: ~/ paths: - app - .cache/Cypress 4x-electron: <<: *defaults # tell CircleCI to execute this job on 4 machines simultaneously parallelism: 4 steps: - attach_workspace: at: ~/ # runs Cypress test in load balancing (parallel) mode # and groups them in Cypress Dashboard under name "4x-electron" - run: npm run cypress:run -- --parallel --group $CIRCLE_JOB --record --key $CYPRESS_KEY workflows: version: 2 # this workflow has 4 jobs to show case Cypress --parallel and --group flags # "build" installs NPM dependencies so other jobs don't have to # └ "1x-electron" runs all specs just like Cypress pre-3.1.0 runs them # └ "4x-electron" job load balances all specs across 4 CI machines # └ "2x-chrome" load balances all specs across 2 CI machines and uses Chrome browser build_and_test: jobs: - build # this group "4x-electron" will load balance all specs # across 4 CI machines - 4x-electron: requires: - build