Browser Testing
Wave supports authoring functional tests in Python for the Cypress test framework. This feature lets you automate browser-based point-and-click tests for your app.
Installation
Step 1: Install Node.js
Install a recent version of Node.js.
Step 2: Set up Cypress
Using your terminal, go to your Wave installation's test
directory and install Cypress
Writing a test
See the Wizard example to understand how to author tests for your interactive app. Specifically, note how the @cypress
attribute is used. Refer to the Cypress API to learn how to author assertions.
Running your test
Step 1: Start the Cypress test runner
Step 2: Start the Wave server as usual
Step 3: Translate your Python tests to Javascript
To translate your Python tests to Javascript, execute the Python module or file containing your tests like this:
The CYPRESS_INTEGRATION_TEST_DIR
environment variable indicates where the Wave SDK should write translated files to. This must be set to the cypress/integration
directory.
Alternatively, you can set the CYPRESS_INTEGRATION_TEST_DIR
environment variable in your shell (or IDE) to simplify running your test file:
Step 4: Run your tests
At this point, you should find all your tests displayed in the Cypress UI. Simply click on a test to run it. Happy testing!