Files
BanGUI/e2e/resources/auth.resource
Lukas 23c3a0d9e6 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.
2026-05-04 08:29:12 +02:00

31 lines
1.3 KiB
Plaintext

*** 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.