QA Automation Labs

Cypress test case execution in CI/CD using CircleCI

1_cKpUhX44rs0oOBKxAfNwVw

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

version: 2.1

# Use a package of configuration called an orb.

orbs:

# Declare a dependency on the welcome-orb

welcome: circleci/[email protected]

# Orchestrate or schedule a set of jobs

workflows:

# Name the workflow “welcome”

welcome:

# Run the welcome/run job in its own container

jobs:

– welcome/run

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.

https://circleci.com/developer/orbs/orb/cypress-io/cypress?version=1.27.0

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

Test case execution report is attached below

Video of all steps attached below

Leave a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

Let’s Play with Cypress Feature “Test Replay”

Problem Statement Before Cypress v13, test failures in CI have historically been captured through screenshots, videos, and stack trace outputs, b
Read More

Handling Shadow DOM Using Cypress

The idea of componentization has completely changed how we design and maintain user interfaces in the field of web development. The advent of Shadow D
Read More

Gear up for upcoming Conferences of 2024! ✨✨

Gear up for our upcoming Conferences of 2024! ✨ ✨ #TheTestTribe #SoftwareTesting #Testers #Community #Worqference #Worqference2024 #QonfX 
Read More