Showing posts with label cypress. Show all posts
Showing posts with label cypress. Show all posts

Getting started with Cypress: Installation and Version check for angular projects


Cypress is used to test web applications just like a real user with automated end-to-end tests.
Cypress is a fast, easy, and reliable E2E testing framework that can test anything that runs in the browser.

To check the Cypress version in your project follow these steps:
Open a terminal or command prompt in your project directory.
Check the current Cypress version (if it's already installed) by running the following command:


npx cypress --version



If Cypress is not installed, or you want to upgrade to the latest version, you can do so by running:
npm install cypress --save -dev

This will install Cypress as a dev dependency in your project.

After installation, you can open Cypress by running:
cmd > npx cypress open 

This command will open the Cypress Test Runner, where you can write and run your tests.

Additionally, you can also add some scripts to your package.json file for easier access to Cypress commands. Open package.json and add the following lines inside the "scripts" section:

"scripts": { 
   "cypress:open" : "cypress open", 
   "cypress:run" : "cypress run" 
 } 

Now, you can run Cypress using:

cmd > npm run cypress:open 


or for running tests headlessly:

cmd > npm run cypress:run 


That's it! Now you have Cypress installed in your project, and you can start writing and executing your tests.
for more information check the official site, Cypress.