Test Automation
Cypress Installation and Setup
Pre-Requisites

Cypress requires the following packages to be installed:

  • Node.js
  • npm
1. Install Node.js and npm

First, ensure you have Node.js and npm installed on your Ubuntu system.

Install Node.js and npm

Open a terminal and run the following commands:

sudo apt update
sudo apt install nodejs npm

This command installs Node.js and npm, the package manager for Node.js.

Note: Install the latest version of node.js

Verify Node.js and npm installation

After installation, verify the versions to ensure everything is set up correctly:

node -v
npm -v

You should see the installed versions of Node.js and npm printed in the terminal.

2. Install Cypress

Installation command

Create a new directory for your project and navigate into it. Then, initialize a new Node.js project and install Cypress:

mkdir my-cypress-project
cd my-cypress-project
npm init -y
npm install cypress

This creates a new package.json file and installs Cypress as a dependency.

Verify Cypress installation

To confirm that Cypress is installed correctly, run:

npx cypress verify

This command verifies the installation and ensures Cypress is ready to use.

3. Open Cypress

Finally, open your Cypress directory in vs code editor and run the follwing command in that terminal.

npx cypress open 

This command launches the Cypress Test Runner, where you can start creating and running tests.

With these steps, you should have Cypress installed and ready to use on your Ubuntu system.

Have a doubt?
Post it here, our mentors will help you out.