fcc8514847
- Add Playwright-based E2E tests in tests/e2e/dashboard/ - Authenticate via /auth/telegram-webapp using helpers/telegram_init_data.py - Cover dashboard load and session edit flow - Add requirements.txt and package dashboard folder - Update README with setup and test descriptions Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GmRelay E2E Tests
This module contains locally-run end-to-end tests for the GmRelay Telegram bot and Blazor/Web dashboard. It is deliberately not wired into CI because it requires real Telegram infrastructure (MTProto user client) and a running Web instance.
Status
Tracked as a Gitea milestone: E2E Automation
| Issue | Title | Status |
|---|---|---|
| #144 | initData / Login Widget helper for mock Telegram auth | ✅ Done |
| #145 | Playwright tests for Blazor dashboard with mocked Telegram auth | 🚧 In progress |
| #146 | Telegram user client (MTProto) | ⏳ Planned |
| #147 | Automate group creation and bot invitation | ⏳ Planned |
| #148 | Scenario: /newsession from creation to publication | ⏳ Planned |
| #149 | Join/leave, waitlist, reschedule and notification scenarios | ⏳ Planned |
| #150 | Dashboard display and editing verification | ⏳ Planned |
| #151 | Console runner and cleanup | ⏳ Planned |
Structure
tests/e2e/
├── README.md
├── requirements.txt
├── .gitignore
├── helpers/
│ ├── telegram_init_data.py # Build valid Telegram auth payloads
│ ├── test_telegram_init_data.py # Self-contained sanity tests for the helper
│ └── __init__.py
└── dashboard/
├── test_dashboard_auth_and_sessions.py # Playwright tests for the Blazor dashboard
└── __init__.py
Install dependencies
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r tests/e2e/requirements.txt
playwright install chromium
Run helper tests
python tests/e2e/helpers/test_telegram_init_data.py
Run Playwright dashboard tests
- Start the Web dashboard (and PostgreSQL) locally. The fastest way:
dotnet run --project src/GmRelay.AppHost/GmRelay.AppHost.csproj - Export environment variables that match the running Web instance:
export GMRELAY_E2E_BASE_URL="http://localhost:8080" export GMRELAY_E2E_BOT_TOKEN="<same-token-as-web>" export GMRELAY_E2E_TELEGRAM_ID="9000000001" export GMRELAY_E2E_DATABASE_URL="Host=localhost;Database=gmrelay;Username=postgres;Password=<password>" - Run the tests:
python tests/e2e/dashboard/test_dashboard_auth_and_sessions.py
What the dashboard tests cover
test_dashboard_authenticates_and_shows_groups
Builds a valid Mini App initData payload, posts it to/auth/telegram-webapp, and verifies that the Blazor home page renders the authenticated greeting.test_dashboard_session_edit_flow
Seeds a player, group, and session directly in PostgreSQL, opens the group details page, clicks through to the session editor, changes the title, and asserts the updated title appears on the page.
Notes
- Authentication is mocked using
helpers/telegram_init_data.py, which mirrorsGmRelay.Shared.Telegram.TelegramAuthPayloadBuilder. - The Web instance validates HMAC-SHA256 with the same bot token, so the test payload is indistinguishable from a real Telegram Mini App payload.
- For headful debugging, change
headless=Truetoheadless=Falsein the test file.