Skip to content

End-to-End Testing

Playwright-driven smoke tests live in tests/e2e/ — currently just test_settings_ui.py, which logs in, navigates to /settings/modules, toggles a module setting, and verifies the change hot-reloads into app.state without a server restart.

End-to-end tests are gated behind the e2e pytest marker (declared in pyproject.toml) and are excluded from the default make test run. They only execute under make test-e2e.

Prerequisites

One-time setup on the machine that will run the tests:

bash
uv sync --all-packages
uv run playwright install chromium

Then bring up the full stack (in a separate terminal, leave it running):

bash
make docker-up     # Postgres (skip if using the default SQLite config)
make migrate       # apply Alembic migrations
make dev           # FastAPI on :8000 + Vite on :5173

Create the first admin user (needed for e2e auth):

bash
uv run sm-users create-admin --email admin@example.com --password admin

Or set SM_USERS_BOOTSTRAP_EMAIL / SM_USERS_BOOTSTRAP_PASSWORD in .env before the first make dev run.

Running

bash
make test-e2e

Or directly:

bash
uv run pytest -m e2e tests/e2e

Configuration

When you write e2e tests, read these environment variables (all optional):

VariableDefaultNotes
E2E_BASE_URLhttp://localhost:8000Where the FastAPI host is listening.
E2E_USERNAMEadmin@example.comEmail of the admin user created via sm-users create-admin.
E2E_PASSWORDadminPassword of the above admin user.
SM_USERS_VERIFICATION_TOKEN_SECRETdev-verify-token-secret-change-meMust match the running server's value so locally-minted invite tokens are accepted.

Debugging

To see what the browser is doing, run headed with the Playwright trace viewer:

bash
uv run pytest -m e2e tests/e2e --headed --slowmo 250

Add --tracing on to capture a trace for post-mortem inspection via playwright show-trace.

Released under the MIT License.