Selenium-based end-to-end tests for the AarhusAI web UI.
- Copy
.env.exampleto.envand fill inTEST_DOMAINplus the role credentials. - Install dependencies (uv):
uv sync. - Run all tests:
uv run python -m unittest.
The image (.docker/app/Dockerfile) bundles Python 3.13, Chromium, chromedriver and Xvfb, so tests run without any local browser setup. Credentials are passed from .env at runtime (not baked into the image).
- Build:
docker compose build - Run all tests:
docker compose run --rm tests - Run a single test:
docker compose run --rm tests python -m unittest tests.user.test_chat - Explore a page:
docker compose run --rm tests python exploration/explore.py <url_path> --login user(outputs land inexploration/on the host via the bind mount)
The container entrypoint wraps commands in xvfb-run, which provides the virtual display the non-headless dictation test needs.
test_login_as_builder— logs in with builder credentials and asserts the browser lands onTEST_DOMAIN.
test_login_as_user— logs in with user credentials and asserts the browser lands onTEST_DOMAIN.
test_user_can_send_prompt_and_receive_response— sends "Say only the word: hello" and asserts a non-empty response is returned.
test_available_assistants_are_listed— asks the chatbot which assistants are available and asserts the response lists Korrekturlæseren, Det gode stillingsopslag, Opsummering, and Klarsprog-bot.
test_user_can_upload_file_and_ask_about_content— uploadstests/fixtures/test_document.txt, asks for the secret code word inside, and asserts the response contains "BANANA".
test_user_can_enable_web_search_and_find_mayor_of_aarhus— opens the integration menu, toggles on Websøgning, asks who the mayor of Aarhus is, and asserts the response contains "Anders Winnerskjold".
test_user_can_dictate_into_chat_input— pipestests/fixtures/dictation_sample.wavinto Chrome's fake microphone, clicks the Dikter button, confirms the recording, and asserts the transcribed text "Hej med dig" appears in the chat input.
exploration/explore.py is a helper for writing new tests: it navigates to a path (optionally logging in first) and dumps a screenshot plus the rendered page source so selectors can be inspected without running a full test. Pass --click <selector> (repeatable; CSS, or XPath if it starts with //) to click elements — e.g. open a menu or flip a toggle — before the capture:
uv run python exploration/explore.py --login user --click "#integration-menu-button"