Screenshots on a real Open-WebUI¶
The unit tests run against a mock. The screenshots are the other half: the example plugins deployed to a real Open-WebUI, with a browser following their By hand steps. They show a reviewer what each check looks like, and they catch what the mock cannot. The first run found two bugs that every unit test had passed (see what it found).
They are in docs/screenshots/, with screenshots.json saying which plugin tests each one illustrates. The test catalogue shows each one under those tests, each example's page has its own, and all screenshots lists them with the Open-WebUI version and commit they were taken from.
Taking them¶
uv sync --group screenshots # Python 3.11+
uv run --group screenshots playwright install chromium
uv run --group screenshots python tools/screenshots/run.py # all of them
uv run --group screenshots python tools/screenshots/run.py -- -k banner # some of them
uv run --group screenshots python tools/screenshots/run.py --keep # leave it running
It needs Docker, which your user must be able to reach (in the docker group; without it, sudo -u "$USER" -g docker env "PATH=$PATH" uv run ... runs it as you), and internet access (the Excalidraw editor loads from esm.sh). A full run takes about two minutes once the images are pulled. Commit the changed PNGs and screenshots.json with the change they show. To check rather than photograph, run the live suite. .github/workflows/screenshots.yml does the same on GitHub when run by hand (Actions > screenshots > Run workflow) and uploads the result as an artifact.
What happens¶
tools/screenshots/run.py:
- Starts
tools/screenshots/compose.yaml. It holds Open-WebUI at the version the protocol targets (v0.13.4, the-slimimage), aimock as its models, and fixed files standing in for a LiteLLM gateway and mcpo. iframe Sandbox Allow Same Origin is on by default there (DEFAULT_INTERFACE_SETTINGS), as the examples with pages in the Artifacts panel require. Nothing is kept between runs. - Signs up the admin (the first account always is) and adds a user, both throwaway.
- Deploys
examples/pluginswithowpp deploy, exactly as a plugin repository would. - Runs the scripts in
tools/screenshots/shots_*.pywith pytest and Playwright. Each signs in on Open-WebUI's own login page, does what a person would, and saves a screenshot at each step worth seeing. - Removes the containers.
The model is aimock, answering from fixtures in tools/screenshots/aimock/, the same way every run, with no API key and no real model: how it answers.
Adding one¶
In the right shots_*.py (or a new one), write a test as a person would do it, and call shot:
def test_the_dashboard_lists_what_is_old(admin, shot):
"""By hand: as an admin, open /stale-data. ..."""
admin.goto(f"{URL}/stale-data")
admin.get_by_text("Q3 roadmap draft").wait_for()
shot(
admin,
"stale_data",
"dashboard",
"What the caption says.",
illustrates=["test_it_lists_what_is_older_than_the_threshold_and_not_the_rest"],
)
| Fixture | What it is |
|---|---|
admin, user, signed_out |
A browser page signed in as the admin, as the user, or not at all. |
api, user_api |
Open-WebUI's HTTP API as that account, for setting things up: data to show, a valve to change. What is photographed goes through the browser. |
shot(page, plugin, name, caption, illustrates=[...]) |
Saves docs/screenshots/<plugin>/<name>.png and records it. illustrates names plugin tests, which then show the picture in the catalogue. |
Put back whatever a script changes (valves, a function switched off), so the order the scripts run in does not matter.
What it found¶
The first run, on 2026-11-19, found two things wrong with Excalidraw that no unit test could see:
- The editor never loaded from esm.sh. A comment in
templates/viewer.htmlmentioned theesm.shandhostedblock markers by name. The code that keeps one block and drops the other matched the marker in the comment, and cut out the editor's imports with it. The page then failed withconvertToExcalidrawElements is not defined. The unit tests only checked the page's head, and that no marker was left, which was true because too much had been removed. Fixed, with a test that the script imports everything it uses. - On a default Open-WebUI, the editor answers 401. The Artifacts panel sends no session cookie unless iframe Sandbox Allow Same Origin is on, and Open-WebUI has it off by default. Turning it on lets any artifact's script reach Open-WebUI's origin, so the requirement is kept and documented rather than worked around (why, and what it costs; issue #6).