Cypress test case execution in CI/CD using CircleCI
What is CircleCI
CircleCI is a modern continuous integration and continuous delivery (CI/CD) platform.
Set up CircleCI and Integration of CircleCI with the repository
Pre -Condition: Some repo in Git Hub is already created
1.Login > Login /Sign up into CircleCI with existing .git account
2. Add Project > After login into the CircleCI click on Add Project
3.Created repo is displayed in Circle Ci project dashboard e.g see below one example
4.Click on “Set up Project” against the above repo “Hello-World” Below Screen is open
5.Click on “Use Existing Config”
6. Since in our repo “Hello-World” we don’t have a .yml file we have to create .circleci/config.yml and can Start building the project
.yml file given below
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
# Use a package of configuration called an orb.
# Declare a dependency on the welcome-orb
welcome: circleci/[email protected]
# Orchestrate or schedule a set of jobs
# Name the workflow “welcome”
# Run the welcome/run job in its own container
One-Click on Start building should pipeline start to run automatically — and pass! So, what just happened? Click on the green Success button on your pipeline to investigate the following parts of the run
- Pipeline: Represents the entirety of the configuration. Available in CircleCI Cloud only.
- Workflows: Responsible for organizing multiple jobs.
- Jobs: Responsible for running a series of steps that perform commands.
- Steps: Run commands (such as installing dependencies or running tests) and shell scripts to do the work7.Investigate the steps of our job
What are obs
CircleCI orbs are shareable packages of configuration elements, including jobs, commands, and executors.
Use orbs to reduce configuration complexity and help you integrate with your software and services stack quickly and easily across many projects.
How to Run Cypress Test case in Circle CI
Pre-condition: GitHub and Circleci mapping already done as per the above steps
Step 1: Install cypress
Step 2:Create .circleci folder in the root level and create config.yml file (*e.g Given below)
Step 3:Push the code
Step 4: View in Circleci dashboard
cypress/run job started and passed after few second