├── .vscode └── settings.json ├── index.html ├── .gitignore ├── cypress.json ├── screenshots └── workflow.png ├── cypress └── integration │ ├── a-spec.js │ └── b-spec.js ├── package.json ├── README.md └── circle.yml /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.enable": false 3 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 |

A test

3 |

This is a test page

4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cypress/videos/ 2 | test-results.xml 3 | results/ 4 | .DS_Store 5 | node_modules/ 6 | -------------------------------------------------------------------------------- /cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "pluginsFile": false, 3 | "fixturesFolder": false, 4 | "supportFile": false 5 | } 6 | -------------------------------------------------------------------------------- /screenshots/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cypress-io/cypress-example-docker-circle-workflows/HEAD/screenshots/workflow.png -------------------------------------------------------------------------------- /cypress/integration/a-spec.js: -------------------------------------------------------------------------------- 1 | describe('a-spec', () => { 2 | describe('page', () => { 3 | beforeEach(() => { 4 | cy.visit(Cypress.env('HOST') || 'index.html') 5 | }) 6 | 7 | it('has h2', () => { 8 | cy.contains('h2', 'test') 9 | }) 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /cypress/integration/b-spec.js: -------------------------------------------------------------------------------- 1 | describe('b-spec', () => { 2 | describe('page', () => { 3 | beforeEach(() => { 4 | cy.visit(Cypress.env('HOST') || 'index.html') 5 | }) 6 | 7 | it('has h2', () => { 8 | cy.contains('h2', 'test') 9 | }) 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cypress-example-docker-circle-workflows", 3 | "version": "1.0.0", 4 | "description": "> Cypress + Docker + CircleCI Workflows = ❤️", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/cypress-io/cypress-example-docker-circle-workflows.git" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "bugs": { 17 | "url": "https://github.com/cypress-io/cypress-example-docker-circle-workflows/issues" 18 | }, 19 | "homepage": "https://github.com/cypress-io/cypress-example-docker-circle-workflows#readme", 20 | "devDependencies": { 21 | "cypress": "4.9.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cypress-example-docker-circle-workflows [![CircleCI](https://circleci.com/gh/cypress-io/cypress-example-docker-circle-workflows.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress-example-docker-circle-workflows) 2 | 3 | [![Greenkeeper badge](https://badges.greenkeeper.io/cypress-io/cypress-example-docker-circle-workflows.svg)](https://greenkeeper.io/) 4 | 5 | > Cypress + Docker + CircleCI Workflows = ❤️ 6 | 7 | You can run multiple Cypress tests in parallel after "building" the code 8 | using CircleCI [Workflows feature](https://circleci.com/docs/2.0/workflows/). 9 | See [circle.yml](circle.yml) in this repo how the dependencies and cached 10 | code is setup among the jobs. 11 | 12 | ![CircleCI workflow](screenshots/workflow.png) 13 | 14 | Note: if you want to see "plain" CircleCI v2 example without workflows, 15 | check out [cypress-example-docker-circle][plain]. 16 | 17 | [plain]: https://github.com/cypress-io/cypress-example-docker-circle 18 | 19 | ## Happy testing 20 | 21 | If you find problems with Cypress and CI, please 22 | 23 | - consult the [documentation](https://on.cypress.io) 24 | - ask in our [Gitter channel](https://gitter.im/cypress-io/cypress) 25 | - find an existing [issue](https://github.com/cypress-io/cypress/issues) 26 | or open a new one 27 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | # build job parameters as a template 4 | defaults: &defaults 5 | working_directory: ~/app 6 | docker: 7 | # the Docker image with Cypress dependencies 8 | - image: cypress/base:8 9 | environment: 10 | ## this enables colors in the output 11 | TERM: xterm 12 | 13 | jobs: 14 | build: 15 | <<: *defaults 16 | steps: 17 | - checkout 18 | - run: pwd 19 | - run: ls 20 | - restore_cache: 21 | keys: 22 | - v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} 23 | - v2-deps-{{ .Branch }}- 24 | - v2-deps- 25 | - run: npm ci 26 | - save_cache: 27 | key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} 28 | paths: 29 | - ~/.npm 30 | - ~/.cache 31 | - persist_to_workspace: 32 | root: ~/ 33 | paths: 34 | - .cache 35 | - app 36 | 37 | testA: 38 | <<: *defaults 39 | steps: 40 | - attach_workspace: 41 | at: ~/ 42 | - run: ls -la cypress 43 | - run: ls -la cypress/integration 44 | - run: 45 | name: Running E2E tests A 46 | command: $(npm bin)/cypress run --spec cypress/integration/a-spec.js --reporter junit --reporter-options "mochaFile=results/my-test-output.xml" 47 | - store_test_results: 48 | path: results 49 | - store_artifacts: 50 | path: cypress/videos 51 | - store_artifacts: 52 | path: cypress/screenshots 53 | 54 | 55 | testB: 56 | <<: *defaults 57 | steps: 58 | - attach_workspace: 59 | at: ~/ 60 | - run: 61 | name: Running E2E tests B 62 | command: $(npm bin)/cypress run --spec cypress/integration/b-spec.js --reporter junit --reporter-options "mochaFile=results/my-test-output.xml" 63 | - store_test_results: 64 | path: results 65 | - store_artifacts: 66 | path: cypress/videos 67 | - store_artifacts: 68 | path: cypress/screenshots 69 | 70 | workflows: 71 | version: 2 72 | build_and_test: 73 | jobs: 74 | - build 75 | - testA: 76 | requires: 77 | - build 78 | - testB: 79 | requires: 80 | - build 81 | --------------------------------------------------------------------------------