feat: add e2e test suite with Robot Framework

Add e2e/ dir with Robot Framework tests for page loading, ban records,
blocklist import, config edit. Add requirements.txt. Update Makefile with
test commands. Update .gitignore, backend docs, testing requirements docs.
This commit is contained in:
2026-05-04 08:29:12 +02:00
parent 5fa67d3288
commit 23c3a0d9e6
11 changed files with 161 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
*** Settings ***
Resource ${CURDIR}/common.resource
*** Keywords ***
Login As Admin
# Check setup status.
${response}= GET ${BACKEND_URL}/api/setup/status
${body}= Set Variable ${response.json()}
IF ${body}[setup_complete] == ${false}
# Complete the setup wizard with the dev master password ("Hallo123!").
${password}= Set Variable Hallo123!
${hashed}= Evaluate "sha256('${password}'.encode()).hexdigest()" modules=hashlib
${setup_payload}= Create Dictionary password=${hashed}
POST ${BACKEND_URL}/api/setup/complete json=${setup_payload}
# Retry login after setup.
${response}= GET ${BACKEND_URL}/api/auth/login
END
# Perform login.
${password}= Set Variable Hallo123!
${hashed}= Evaluate "sha256('${password}'.encode()).hexdigest()" modules=hashlib
${login_payload}= Create Dictionary password=${hashed}
${response}= POST ${BACKEND_URL}/api/auth/login json=${login_payload}
# Store session cookie for subsequent requests.
${cookies}= Get Cookies
${session_cookie}= Get Cookie Value bangui_session
Set Browser Variables session_cookie=${session_cookie}
Log Logged in as admin.

View File

@@ -0,0 +1,25 @@
*** Settings ***
Library Browser
Library HttpLibrary
Variables ${CURDIR}/../../.env
# Health check timeout for suite setup (120 s poll interval).
Suite Setup Wait For Backend Health timeout=120 interval=5
*** Variables ***
${FRONTEND_URL} http://localhost:5173
${BACKEND_URL} http://localhost:8000
*** Keywords ***
Wait For Backend Health
[Arguments] ${timeout}=120 ${interval}=5
${deadline}= Evaluate time.time() + ${timeout}
WHILE True
${now}= Evaluate time.time()
IF ${now} >= ${deadline} FAIL Backend did not become healthy within ${timeout} seconds
${response}= GET ${BACKEND_URL}/api/health expected_status=200
IF ${response.status} == 200 BREAK
Sleep ${interval}
END
Log Backend is healthy.