How to install an empty Cypress project?
I am trying to install Cypress on an empty project. However, Cypress is not installed in the package.js file and Cypress is not included on the project. How can I make it work? I cannot install Cypress as part of the development project, so i am trying to create a separate test automation project with Cypress.
To install Cypress outside your dev project, download it from https://www.cypress.io. Unzip it, open a bash or cmd prompt in that folder, and type Cypress.
Though warnings suggest installing in your project is preferred, running Cypress outside the project works fine. In the Cypress runner, select the same folder, and Cypress will set up the testing structure:
/cypress
/integration
/examples -- includes sample tests
/support
/plugins
/fixtures
etc
Installation steps for Cypress:
-
Create Project Folder: Set up your project folder and navigate to it in the terminal using cd folder_path/folder_name
.
- Run
npm init
to generate the package.json file.
-
Install Cypress:
- Execute
npm install cypress --save-dev
to add Cypress as a dev dependency to your package.json.
- This command will create the package-lock.json file and the node_modules folder.
-
Run Cypress:
- Launch Cypress using either
node_modules/.bin/cypress open
or node_modules/.bin/cypress run
.
These steps ensure proper setup and installation of Cypress for your project.