1.6 KiB
Testing
Setup
If you haven't setup matrix-viewer
yet, see the Setup section in the root README.md
Then we need to setup the federation cluster of homeservers that we will test with. Sorry, this isn't automated yet when you run the tests 🙇
# Build the test homeserver image that are pre-configured to federate with each other
$ docker pull matrixdotorg/synapse:latest
$ docker build -t matrix-viewer-test-homeserver -f test/dockerfiles/Synapse.Dockerfile test/dockerfiles/
# Start the test homeservers
$ docker-compose --project-name matrix_viewer_test -f test/docker-compose.yml up -d --no-recreate
Running the tests
$ npm run test
Or if you want to keep the Matrix Viewer server running after the tests run and explore the UI from the interactive URL's printed on the screen to better debug, use:
$ npm run test-interactive
Caveat: You might not see the same result that a test is seeing when visiting the
interactive URL. Some tests set config like the messageLimit
which is reset
after each test case unless you are using npm run test-interactive
and visiting the
interactive URL for a failed test. Otherwise, we reset config between each test case so
they don't leak and contaminate each other.
Developer utility
Some copy-pasta to help you manage the Docker containers for the test homeservers:
$ docker ps --all | grep test_hs
$ docker logs -f --tail 10 matrix_viewer_test_hs1_1
$ docker logs -f --tail 10 matrix_viewer_test_hs2_1
$ docker stop matrix_viewer_test_hs1_1 matrix_viewer_test_hs2_1
$ docker rm matrix_viewer_test_hs1_1 matrix_viewer_test_hs2_1