Permalink
Fetching contributors…
Cannot retrieve contributors at this time
234 lines (177 sloc) 4.03 KB

Examples

simple

Runs all Cypress tests without recording results on the Dashboard

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run

using-node6

Runs all Cypress tests on Node 6 image

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run:
          executor: cypress/base-6

recording

Runs all Cypress tests and records them on the Cypress Dashboard

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run:
          record: true

artifacts

Stores test screenshots and videos as CircleCI artifacts

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.2.0
workflows:
  build:
    jobs:
      - cypress/run:
          store_artifacts: true

chrome

Runs tests using Chrome browser in custom executor (Cypress docker image)

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run:
          executor: cypress/browsers-chrome69
          browser: chrome

start-server

Starts server and then runs all Cypress tests

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run:
          start: npm start

wait-for-server-to-respond

Starts server, waits for it to respond and then runs all Cypress tests. Uses npx wait-on ... command under the hood, see wait-on

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/run:
          start: npm start
          wait-on: 'http://localhost:4200'

parallel-on-2-machines

Runs all Cypress tests by load balancing them on two machines

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/install
      - cypress/run:
          requires:
            - cypress/install
          record: true
          parallel: true
          parallelism: 2
          group: 2 machines

build-app

Install dependencies and run custom build command on one machine. Then run on 3 machines tests in load balancing mode.

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/install:
          build: npm run build
      - cypress/run:
          requires:
            - cypress/install
          record: true
          parallel: true
          parallelism: 3
          group: 3x

groups

Runs all tests on 4 machines using Electron browser (default). Also runs some tests using "spec" parameter on Chrome browser. Records both groups on Cypress dashboard. Notice "name" under each "cypress/run" job which will be shown in the Circle workflow UI to tell jobs apart.

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
workflows:
  build:
    jobs:
      - cypress/install
      - cypress/run:
          name: 4 machines
          requires:
            - cypress/install
          record: true
          parallel: true
          parallelism: 4
          group: 4 machines
      - cypress/run:
          name: Chrome
          requires:
            - cypress/install
          executor: cypress/browsers-chrome69
          record: true
          parallel: true
          parallelism: 2
          group: smoke tests
          browser: chrome
          spec: cypress/integration/smoke/*

release

If you want to run a job after running Cypress tests, you can reuse the workspace from the cypress/run job. For example, to run a semantic release script you could do the following

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.1.0
jobs:
  release:
    executor: cypress/base-10
    steps:
      - attach_workspace:
          at: ~/
      - run: npm run semantic-release
workflows:
  build:
    jobs:
      - cypress/install
      - cypress/run:
          requires:
            - cypress/install
      - release:
          requires:
            - cypress/run