mobilizon/docs/contribute/tests.md
Thomas Citharel 4fab4e1d25
Move docs to mkdocs and improve them
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-11-17 20:00:09 +01:00

1.4 KiB

Tests

Backend

The backend uses ExUnit.

To launch all the tests:

mix test

!!! info If you're using Docker, you can use make test

If you want test coverage:

mix coveralls.html

It will show the coverage and will output a cover/excoveralls.html file.

If you want to test a single file:

mix test test/mobilizon/actors/actors_test.exs

If you want to test a specific test, block or line:

mix test test/mobilizon/actors/actors_test.exs:85

!!! tip Note: The coveralls.html also works the same

Front-end

Unit tests

Not done yet.

End-to-end tests

We use Cypress for End-to-end testing.

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.

When inside the js directory, you can do either

npx cypress run

to run the tests, or

npx cypress open

to open the interactive GUI.

!!! info Cypress provided a subscription to their recording dashboard since Mobilizon is an Open-Source project. Thanks!