2019-03-14 14:00:34 +00:00
# Tests
## Backend
The backend uses `ExUnit` .
To launch all the tests:
```bash
mix test
```
2019-11-17 17:11:33 +00:00
!!! info
If you're using Docker, you can use `make test`
2019-10-16 09:20:30 +00:00
2019-05-19 09:38:09 +00:00
If you want test coverage:
2019-03-14 14:00:34 +00:00
```bash
mix coveralls.html
```
It will show the coverage and will output a `cover/excoveralls.html` file.
If you want to test a single file:
```bash
mix test test/mobilizon/actors/actors_test.exs
```
If you want to test a specific test, block or line:
```bash
mix test test/mobilizon/actors/actors_test.exs:85
```
2019-11-17 17:11:33 +00:00
!!! tip
Note: The `coveralls.html` also works the same
2019-03-14 14:00:34 +00:00
## Front-end
2019-10-11 15:03:18 +00:00
### Unit tests
Not done yet.
### End-to-end tests
We use [Cypress ](https://cypress.io ) for End-to-end testing.
2019-10-16 09:20:30 +00:00
You first need to run the webserver with the `e2e` environment: `MIX_ENV=e2e mix phx.server` . The same environment parameters as the `dev` environment must be provided.
This allows to run database operations in the sandbox and not pollute your database.
Then, run `MIX_ENV=e2e mix run priv/repo/e2e.seed.exs` to have some initial data inside your instance for the tests.
2019-10-11 15:03:18 +00:00
When inside the `js` directory, you can do either
```bash
npx cypress run
```
to run the tests, or
```bash
npx cypress open
```
to open the interactive GUI.
2019-11-17 17:11:33 +00:00
!!! info
Cypress provided [a subscription ](https://www.cypress.io/oss-plan ) to their recording dashboard since Mobilizon is an Open-Source project. Thanks!