Because Dash3d is still in experimental stage, we opt for only high-level integration testing at this point.
To run tests, install node js:
conda install -c conda-forge nodejs
Make sure to install system dependencies required by Cypress.
Most front end dependencies are managed by npm, automatically installed with node. To install front end dependencies, run the following from the root of kaolin:
npm install
All integration tests are wrapped in python. To run all tests from the root of kaolin:
pytest --capture=tee-sys tests/integration/experimental/dash3d/
Currently, the only javascript tests are integration, and we call the javascript test from a python test file. In the future, this may change.
Javascript tests that can run outside of the browser are implemented using Mocha. Note that currently, all js tests are called from python. To run Mocha tests manually, run:
npx mocha "./tests/integration/experimental/dash3d/*.js"
Note: his will fail, because it expects data generated by python wrapper tests.
Failing mocha tests can be debugged in Chrome by running:
./node_modules/mocha/bin/mocha --inspect --inspect-brk path/to/test.js
Then, in Chrome navigate to chrome://inspect/ and
click "Open dedicated DevTools for Node". You may need to manually add
the test and static
sibdirectories under sources.
End-to-end tests that require a browser are implemented
using Cypress. Note that currently, all cypress
tests are called from python, but the tests themselves
are written in javascript and located in tests/integration/experimental/dash3d/cypress/integration/
. It is essential to be able
to run them manually for debugging.
First run a python test that spins up a dash3d instance in the
background (note that multiple invokations of this may require you
to set --skip_start_dash3d
at the end of the command in case
dash3d is already running):
python -m tests.integration.experimental.dash3d.run_e2e_test
This test also runs cypress tests, but in case they fail it's useful to invoke cypress manually.
To open cypress UI:
npx cypress open --config-file tests/integration/experimental/dash3d/cypress.json
Alternatively, run cypress tests automatically (this is called from run_e2e_test
):
npx cypress run --config-file tests/integration/experimental/dash3d/cypress.json
Cypress writes a lot of diagnostic information during testing. Opening debug console in the browser during test execution is helpful. Also, check out the following directories:
- screenshots:
tests/integration/experimental/dash3d/cypress/screenshots/
- videos:
tests/integration/experimental/dash3d/cypress/videos/
- renderings from tests:
tests/integration/experimental/dash3d/cypress/test_output/
Most of the tests perform visual regression to ensure that the right
geometry is passed from the server to the client. As a consequence,
changes to rendering properties will break the test and require
change to golden files. The test_output
directory will contain
the updated golden files.