Skip to content
Snippets Groups Projects
Commit 632d4326 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[docs] add dev section on E2E tests

parent 2aeefe03
No related branches found
No related tags found
1 merge request!10JS & Python Testing
...@@ -119,3 +119,24 @@ How does the webapp operate on the local BEAT prefix? Through the small Python R ...@@ -119,3 +119,24 @@ How does the webapp operate on the local BEAT prefix? Through the small Python R
* ``layout/``: Only accepts POST requests - given the toolchain as the request body, generates a layout for the toolchain using Graphviz's ``dot`` layout algorithm and returns it. * ``layout/``: Only accepts POST requests - given the toolchain as the request body, generates a layout for the toolchain using Graphviz's ``dot`` layout algorithm and returns it.
.. automodule:: beat.editor .. automodule:: beat.editor
E2E Testing
-----------
There are selenium tests found in ``conda/js/test/``. These tests are set up to be ran in Firefox in headless mode with the REST server running locally. To run these tests:
* A relatively recent version of Firefox with headless support
* You need the contents of the tutorial's prefix in your local BEAT prefix (find it at ``https://gitlab.idiap.ch/beat/beat.tutorial.prefix``)
* A recent version of `the Geckodriver executable <https://github.com/mozilla/geckodriver/releases/>`_ available in your path for Selenium to use
* The ``beat.editor`` REST server running locally
Just do ``node conda/js/<selenium test>`` to run the test. Please see inside the tests for additional notes.
The tests should always be cleaning up test artifacts in your prefix after the test finishes. If tests do not finish successfully, some of these artifacts may still be present in your prefix and will cause future runs of that test to fail. So, if a test doesn't finish successfully, you will have to delete the test artifacts manually. To make it easier, all BEAT objects created by these tests have the username "selenium" so you know what to delete.
Developing E2E Tests
********************
The webdriver & all its functionality is `well documented <http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/>`_.
It's recommended to debug tests by not using headless mode and inserting plenty of long pauses via ``driver.sleep()``. You'll need to know the modern ``async``/``await`` pattern as well as be comfortable with CSS selector syntax. See the ``selenium_tutorial_test.js`` test file for working examples of these concepts and how to use selenium's API.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment