2024-11-10 22:27:25 +00:00
---
id: testing
title: Testing
---
Follow the steps below to setup and run the test specifications using Cypress. We recommend [setting up ToolJet locally ](/docs/contributing-guide/setup/macos ) before proceeding.
## Setting up
- Navigate to the `cypress-tests` directory and enter the following command:
```bash
npm install
```
## Running Tests
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
#### Headed mode
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
- To run cypress in **headed** mode, run the following command:
```bash
npm run cy:open
```
- In **headed** mode, the user will be able to choose the test specs from the test runner:
< div style = {{textAlign: ' center ' } } >
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
< img className = "screenshot-full" src = "/img/testing/headed.png" alt = "Cypress headed mode" / >
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
< / div >
#### Headless mode
- To run cypress in **headless** mode, run the following command:
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
```bash
2024-12-24 10:18:14 +00:00
npm run cy:run
```
- To run a specific spec in headless mode, run the following command:
2024-11-10 22:27:25 +00:00
```bash
npm run cy:run -- --spec "cypress/e2e/dashboard/multi-workspace/manageSSO.cy.js
```
< div style = {{textAlign: ' center ' } } >
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
< img className = "screenshot-full" src = "/img/testing/headless.png" alt = "Cypress headless mode" / >
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
< / div >
:::caution
If some test specs need the environment variables, the user can pass them similar to the following command:
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
```bash
npm run cy:open -- --env='{"pg_host":"localhost","pg_user":"postgres", "pg_password":"postgres"}'
```
2024-12-24 10:18:14 +00:00
2024-11-10 22:27:25 +00:00
or the user can add env-vars in the **cypress.config.js** file
:::
:::info
Check all the Cypress commands [here ](https://docs.cypress.io/guides/guides/command-line#Commands )
2024-12-24 10:18:14 +00:00
:::