Reliable and straightforward UI automation with CyTest. Leverage the power of Cypress for your testing needs.
-
Download Visual Studio Code:
- Go to the Visual Studio Code website.
- Click the download button for your operating system (Windows, macOS, or Linux).
-
Install Visual Studio Code:
- Run the downloaded installer and follow the on-screen instructions to complete the installation.
-
Download and Install Node.js:
- Go to the Node.js website and download the LTS version.
- Follow the installation instructions to install Node.js and npm.
-
Verify Installation:
- Open a terminal (you can use VS Code’s integrated terminal).
- Check the Node.js version by running:
node -v
- Check the npm version by running:
npm -v
-
Open Visual Studio Code:
- Launch Visual Studio Code.
-
Open a New Terminal:
- Go to
View > Terminalto open a new terminal window inside VS Code.
- Go to
-
Create a New Directory for Your Project:
- In the terminal, navigate to the location where you want to create your project and create a new directory:
mkdir cypress-automation cd cypress-automation
- In the terminal, navigate to the location where you want to create your project and create a new directory:
-
Initialize a New npm Project:
- In the terminal, run the following command to create a
package.jsonfile:npm init -y
- In the terminal, run the following command to create a
- Install Cypress:
- In the terminal, run the following command to install Cypress:
npm install cypress --save-dev
- In the terminal, run the following command to install Cypress:
-
Open Cypress:
- Run the following command in the terminal to open Cypress:
npx cypress open
- This will launch the Cypress Test Runner and create a
cypressfolder with some example test files.
- Run the following command in the terminal to open Cypress:
-
Create a New Test File:
- Inside the
cypress/integrationfolder, create a new file for your tests, for example,example_spec.js.
- Inside the
-
Write Your First Test:
- Open the new test file and add the following example test:
describe('My First Test', () => { it('Visits the Cypress Documentation', () => { cy.visit('https://docs.cypress.io'); cy.contains('Getting Started').click(); cy.url().should('include', '/getting-started'); }); });
- Open the new test file and add the following example test:
-
Run Tests from Cypress Test Runner:
- With the Cypress Test Runner open, click on the test file you created (e.g.,
example_spec.js). This will run your test in the Cypress Test Runner.
- With the Cypress Test Runner open, click on the test file you created (e.g.,
-
Run Tests from Command Line:
- You can also run your tests from the command line using:
npx cypress run
- You can also run your tests from the command line using: