Osura Hettiarachchi

Getting started with cypress

Object oriented blog cover

This article will guide you on how to download, install and run cypress for the first time

What is Cypress?

Cypress is an open-source JavaScript test automation framework which was initially focused on end-to-end and unit testing. From Cypress 10 onwards component testing support also has been added which still in the beta stage at the time of writing. Cypress is primarily designed to test any application which runs and can in web browsers ;)

System Requirements

Usually you will be able to run cypress comfortably locally if your machine is capable web development. But make sure the following requirements met.

Requirement Supported
Operating System macOS 10.9 and above (Intel or Apple Silicon 64-bit (x64 or arm64)) Linux Ubuntu 12.04 and above, Fedora 21 and Debian 8 (x86_64 or Arm 64-bit (x64 or arm64)) (see Linux Prerequisites down below) Windows 7 and above (64-bit only)
NodeJs Node.js 12 or 14 and above
Hardware

CPU:

  • 2 CPUs minimum to run Cypress
  • 1 additional CPU if video recording is enabled
  • 1 additional CPU per process you run outside of Cypress

Memory:

  • 4GB minimum, 8GB+ for longer test runs

If all the above minimum requirements are met, then you can start testing with cypress once done installing.

Installing Cypress

You can either use npm or yarn as the package manager to install cypress.

Installing with NPM

cd /your/project/path
npm install cypress -D


Installing with YARN

cd /your/project/path
yarn add cypress --dev

You can also directly download the cypress binary from the Cypress CDN if you are not using node or npm


Opening Cypress

Once you have successfully installed cypress by following the above steps, you can open cypress executing any of the following commands from the command line. Please note that cypress will be downloading cypress binary from the CDN once the below command is executed in the CLI, thus might take sometime depending on your internet connection speed.


Using npx (if you have npm > v5.2 installed)

npx cypress open

Using yarn

yarn run cypress open

Using full path of the installed cypress

./node_modules/.bin/cypress open

Using npm bin

$(npm bin)/cypress open

If you downloaded cypress binary from the CDN directly, you can open cypress by double clicking on cypress.exe after extracting the downloaded folder.


That's it for this article. Stay tuned for more blogs and tutorials on cypress. Wanna read more? See all blogs here