All Projects → cypress-io → Circleci Orb

cypress-io / Circleci Orb

Licence: mit
Install, cache and run Cypress.io tests on CircleCI with minimal configuration.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Circleci Orb

Cypress Example Docker Circle
Cypress + Docker + CircleCI = ❤️
Stars: ✭ 119 (-1.65%)
Mutual labels:  circleci, circle
Bento Starter
🍱 Full-Stack solution to quickly build PWA applications with Vue.js and Firebase
Stars: ✭ 1,519 (+1155.37%)
Mutual labels:  circleci
Circleci Demo Php Laravel
Example CircleCI project using PHP and Laravel
Stars: ✭ 85 (-29.75%)
Mutual labels:  circleci
Presently
Android app for recording gratitude journal entries
Stars: ✭ 109 (-9.92%)
Mutual labels:  circleci
React Native Circle Button
A Customizable React Native Circle Button
Stars: ✭ 87 (-28.1%)
Mutual labels:  circle
Android Livedata Viewmodel
Android app that demonstrates how to use new Architecture components.
Stars: ✭ 114 (-5.79%)
Mutual labels:  circleci
Gatsby Themes
Get high-quality and customizable Gatsby themes to quickly bootstrap your website! Choose from many professionally created and impressive designs with a wide variety of features and customization options.
Stars: ✭ 1,208 (+898.35%)
Mutual labels:  circleci
Circleci Demo Ios
A sample iOS app that builds on CircleCI
Stars: ✭ 103 (-14.88%)
Mutual labels:  circleci
Terraform Multienv
A template for maintaining a multiple environments infrastructure with Terraform. This template includes a CI/CD process, that applies the infrastructure in an AWS account.
Stars: ✭ 107 (-11.57%)
Mutual labels:  circleci
Circleci Bundle Update Pr
Provide continues bundle update using CircleCI
Stars: ✭ 115 (-4.96%)
Mutual labels:  circleci
Xlcircleprogress
iOS 圆环进度指示器
Stars: ✭ 93 (-23.14%)
Mutual labels:  circle
Vue Ellipse Progress
A Vue.js component to create beautiful animated circular progress bars
Stars: ✭ 101 (-16.53%)
Mutual labels:  circle
Arcseekbar
🎡 ArcSeekBar 一个弧形可拖动进度条控件。弧形大小,弧度,颜色渐变等配置完全可定制化
Stars: ✭ 115 (-4.96%)
Mutual labels:  circle
Ci Yarn Upgrade
Keep NPM dependencies up-to-date with CI, providing version-to-version diff for each library
Stars: ✭ 85 (-29.75%)
Mutual labels:  circleci
Swiftfortunewheel
The ultimate spinning wheel view that supports dynamic content and rich customization.
Stars: ✭ 114 (-5.79%)
Mutual labels:  circle
Proprogressviews
Progress Views Library
Stars: ✭ 84 (-30.58%)
Mutual labels:  circle
Drupal8ci
One-line installers for implementing Continuous Integration in Drupal 8
Stars: ✭ 113 (-6.61%)
Mutual labels:  circleci
Ci Matters
Integration (comparison) of different continuous integration services on Android project
Stars: ✭ 119 (-1.65%)
Mutual labels:  circleci
Circleci Demo Workflows
Demonstrations of various Workflows features
Stars: ✭ 116 (-4.13%)
Mutual labels:  circleci
Circleci Demo Javascript Express
Sample Javascript/Express app building on CircleCI
Stars: ✭ 115 (-4.96%)
Mutual labels:  circleci

Cypress CircleCI Orb CircleCI CircleCI Orb Version renovate-app badge GitHub license

The Cypress CircleCI Orb is a piece of configuration set in your circle.yml file to correctly install, cache and run Cypress.io tests on CircleCI with very little effort. See this orb in CircleCI Registry.

Contents

How to enable

Note ⚠️: To use CircleCI Orbs in your projects, you need to enable two settings:

  • From organization settings allow using uncertified orbs Settings -> Security -> Allow uncertified orbs
  • From the project's settings allow beta features Settings -> Advanced Settings -> Enable pipelines

See the official CircleCI documentation.

Examples

Each example below should be placed into circle.yml or .circleci/config.yml file:

simple

Install dependencies (using npm ci) and run all Cypress tests:

# to use orbs, must use version >= 2.1
version: 2.1
orbs:
  # import Cypress orb by specifying an exact version x.y.z
  # or the latest version 1.x.x using "@1" syntax
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      # "cypress" is the name of the imported orb
      # "run" is the name of the job defined in Cypress orb
      - cypress/run

See cypress-io/circleci-orb-example CircleCI

record on Dashboard

Runs all Cypress tests and records them on the Cypress Dashboard:

version: 2.1
orbs:
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      - cypress/run:
          record: true

Note: recording test results and artifacts requires Cypress Dashboard account. You should also set your record key as CYPRESS_RECORD_KEY environment variable in the CircleCI project.

parallel

A more complex project that needs to install dependencies, build an application and run tests across 4 CI machines in parallel may have:

version: 2.1
orbs:
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      # first get the source code and install npm dependencies
      - cypress/install:
          # run a custom app build step
          build: 'npm run build'
      - cypress/run:
          # make sure app has been installed and built
          # before running tests across multiple machines
          # this avoids installing same dependencies 10 times
          requires:
            - cypress/install
          record: true # record results on Cypress Dashboard
          parallel: true # split all specs across machines
          parallelism: 4 # use 4 CircleCI machines to finish quickly
          group: 'all tests' # name this group "all tests" on the dashboard
          start: 'npm start' # start server before running tests

In all cases, you are using run and install job definitions that Cypress provides inside the orb. Using the orb brings simplicity and static checks of parameters to CircleCI configuration.

Note: recording test results and spec parallelization requires Cypress Dashboard account. You should also set your record key as CYPRESS_RECORD_KEY environment variable in the CircleCI project.

other examples

All examples are in docs/examples.md and are generated from the src/orb.yml file.

Also take a look at cypress-io/cypress-example-circleci-orb and cypress-io/cypress-example-kitchensink. You can find more examples under GitHub topic cypress-orb-example.

Naming

When importing this orb, we suggest using local name "cypress" for consistency.

version: 2.1
orbs:
  #          ↱ official orb name in the registry (org + name)
  cypress: cypress-io/[email protected]
  #  ↳ your local name for the imported orb
workflows:
  build:
    jobs:
      #   ↱ local orb name
      - cypress/run
      #          ↳ job "run" defined in the orb

You can of course use another local name

version: 2.1
orbs:
  #             ↱ official orb name in the registry (org + name)
  e2eCypress: cypress-io/[email protected]
  #  ↳ your local name for the imported orb
workflows:
  build:
    jobs:
      #   ↱ local orb name
      - e2eCypress/run
      #             ↳ job "run" defined in the orb

We suggest importing the orb under the local name cypress and giving names to each job using the name parameter.

version: 2.1
orbs:
  #          ↱ official orb name in the registry (org + name)
  cypress: cypress-io/[email protected]
  #  ↳ your local name for the imported orb
workflows:
  build:
    jobs:
      - cypress/run:
          name: E2E tests

See Recipes for more examples.

Jobs and executors

See docs/jobs.md and docs/executors.md for a full list of public jobs and executors that this orb provides. For example, if you want to execute tests using Node 14

version: 2.1
orbs:
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      - cypress/run:
          executor: cypress/base-14

For more examples, search for executor in the docs/examples.md page.

The CircleCI Orb exports the following job definitions to be used by the user projects:

run

This job allows you to run Cypress tests on a one or more machines, record screenshots and videos, use the custom Docker image, etc.

A typical example:

# to use orbs, must use version >= 2.1
version: 2.1
orbs:
  # import Cypress orb by specifying an exact version x.y.z
  # or the latest version 1.x.x
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      # checks out code, installs npm dependencies
      # and runs all Cypress tests and records results on Cypress Dashboard
      # cypress/run job comes from "cypress" orb imported above
      - cypress/run:
          record: true

See all its parameters at the cypress/run job example.

install

⚠️ Warning: this job is only necessary if you plan to execute the run job later. If you only want to run all tests on a single machine, then you do not need a separate install job.

Sometimes you need to install the project's npm dependencies and build the application once before running tests, especially if you run the tests on multiple machines in parallel. For example:

version: 2.1
orbs:
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      # install dependencies first (on 1 machine)
      - cypress/install
      # now run tests
      - cypress/run:
          # give this job a custom name for clarity
          name: 'end-to-end tests'
          requires:
            # use previously installed dependencies
            # to avoid installing them on each machine running tests
            - cypress/install
          record: true # record results to Cypress Dashboard
          parallel: true # run tests in parallel
          parallelism: 3 # use 3 CircleCI machines
          group: 3 machines # name this group "3 machines"

See available parameters at the cypress/install job example.

To better understand why we use a separate install job, take a look at the workflow diagram below.

Workflow

The first job install runs on a single machine, and usually is very fast because it uses previously cached npm modules and Cypress binary to avoid reinstalling them. The second job run can run on multiple machines (in this case it runs on 3 machines), and uses workspace created by the install job to get 3 identical file systems before running tests. You can see the 3 parallel runs by clicking on the run job.

3 parallel jobs

Versions

Cypress orb is versioned so you can be sure that the configuration will not suddenly change as we change orb commands. We follow semantic versioning to make sure you can upgrade project configuration to minor and patch versions without breaking changes. See CircleCI Orb versioning documentation.

You can find all changes and published orb versions for Cypress orb at cypress-io/circleci-orb/releases.

We are using cypress-io/[email protected] version in our examples, so you get the latest published orb version 1.x.x. But we recommend locking it down to an exact version to prevent unexpected changes from suddenly breaking your builds.

Lock files

This orb requires the repository to use a lock file like package-lock.json or yarn.lock. These lock files are recommended for consistent repeatable installations of dependencies on the CI machines. If a lock file is not found, the Orb shows an error and stops.

Effective config

CircleCI expands orbs in your config file before running the workflows. You can see this effective config in their UI

Effective config on CircleCI

If you install Circle local CLI, you can see the final effective configuration your project resolves to by running circleci config process <config filename> from the terminal.

For example, if your current CircleCI configuration file is .circleci/config.yml and it contains the following:

version: 2.1
orbs:
  cypress: cypress-io/[email protected]
workflows:
  build:
    jobs:
      - cypress/run

The fully resolved configuration will show:

$ circleci config process .circleci/config.yml
# Orb 'cypress-io/[email protected]' resolved to 'cypress-io/[email protected]'
version: 2
jobs:
  cypress/run:
    docker:
    - image: cypress/base:12.14.0
    parallelism: 1
    steps:
    - checkout
    - restore_cache:
        keys:
        - cache-{{ .Branch }}-{{ checksum "package.json" }}
    - run:
        name: Npm CI
        command: npm ci
    - run:
        command: npx cypress verify
    - save_cache:
        key: cache-{{ .Branch }}-{{ checksum "package.json" }}
        paths:
        - ~/.npm
        - ~/.cache
    - persist_to_workspace:
        root: ~/
        paths:
        - project
        - .cache/Cypress
    - attach_workspace:
        at: ~/
    - run:
        name: Run Cypress tests
        command: 'npx cypress run'
workflows:
  build:
    jobs:
    - cypress/run
  version: 2

Ejecting

If you want to customize the orb configuration, you can save and tweak the output of the circleci config process ... to suit your needs.

⚠️ Warning: there is no automated way to go from the "ejected" configuration back to using the orb.

Development

If you want to develop this orb and publish new versions, see our Contributing Guide.

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].