SDET Unicorns

Cypress Installation & Setup

cypress installation

Table of Content

In this Cypress testing tutorial, we will be doing the setup and installation on the local machine to get Cypress up and running for you. One of the great things about Cypress is that using just one command you can get all the necessary packages installed to start writing your first test using Cypress. Let’s take a look at that –

Installation

To install Cypress locally, you need to run through the following steps –

  • Create a new npm project:
    • mkdir your_project_name && cd your_project_name
    • npm init -y to initialize your project
  • Install Cypress:
    • npm install cypress --save-dev

This will download and unzip the Cypress desktop client and install all the necessary packages for you.


Opening Cypress Desktop App

Once Cypress is installed, you can open the Cypress desktop app by running the following command –

npx cypress open

This will open up the Cypress app for you and list all the initial pre-built tests –

Screen Shot 2021 04 05 at 4.11.27 AM

Run tests in Cypress Test Runner

Click on any of the pre-built example test and it will launch up the Cypress Test Runner and start running all the tests –

Cypress Test Runner

Cypress Folder Structure

When you install Cypress, it will setup the folder structure for you automatically –

  • Fixtures: used to store all the external static data for your tests i.e. JSON data files, images, etc…
  • Integration: this is where all your test files are stored
  • Plugins: You can extend Cypress functionalities by taking advantage of Cypress built as well as community-built plugins
  • Support: In the support folder, you can store custom commands which can be utilized by your tests
  • Cypress.json: this is the default configuration file where you can store information such as baseUrl, env, port, etc…
Screen Shot 2021 04 05 at 4.20.38 AM

Check out the video below to see how to Setup & Install Cypress in your local machine –


I hope this post helped you out, let me know if you have any questions in the comments below!

Happy testing! 

My Resources

Thrive Suite: The all-in-one WordPress theme I used to create my blog.
Jasper AI: My favorite AI writing tool.
Surfer SEO:  A tool to help you rank your content on the first page of Google.

Write Content Faster

5/5

Write blog posts that rank for affiliate terms!

Join our mailing list

Unlock the Secrets to Becoming a SDET Pro in the Industry!

Stay ahead of the curve! Join our mailing list for exclusive insights, tips, and the latest industry updates delivered straight to your inbox

Table of Content

Related Post

Differences Between CI/CD and DevOps

Key Differences Between CI/CD and DevOps

Software development is far from a simple journey that involves merely executing code and launching applications. It often presents challenges, as it’s rare to get everything right from the start. Each time you implement new or frequent code changes, you inadvertently introduce potential issues that can be time-consuming to resolve. This complexity necessitates a structured approach to ensure smooth production.

Read More »
image

Common Types of Software Bugs

Dealing with bugs is one of the biggest headaches in the software development lifecycle. No matter how carefully someone writes code, it’s impossible to create a software product that works perfectly every time. Skipping detailed testing often causes major issues later on.

Read More »