docs: update documentation and e2e tests

- Add configuration docs for database and rate limiting
- Remove completed tasks from tracking list
- Update testing requirements with new test patterns
- Enhance web development docs with frontend guidelines
- Expand page loading and ban records e2e test coverage
This commit is contained in:
2026-05-04 08:34:18 +02:00
parent 23c3a0d9e6
commit e41831447f
6 changed files with 199 additions and 148 deletions

View File

@@ -1,13 +1,95 @@
*** Settings ***
Resource ${CURDIR}/../../resources/common.resource
Resource ${CURDIR}/../../resources/auth.resource
*** Test Cases ***
Page Loads And Shows Navigation
Login Page Loads Without Error
[Documentation] Login must run before Login As Admin — use New Page to avoid session cookie.
... Vite SPA always returns 200; focus on DOM assertions after client-side routing.
New Browser chromium headless=${TRUE}
New Page ${FRONTEND_URL}
New Page
Go To ${FRONTEND_URL}/login
Wait For Elements State css=form visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
# Confirm the page title or root element is present.
${title}= Get Title
Should Not Be Empty ${title}
Setup Page Loads Without Error
[Documentation] Setup wizard accessible before auth; may redirect to /login if already done.
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/setup
Wait For Elements State css=form,button visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Dashboard Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/
Wait For Elements State css=main visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Map Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/map
Wait For Elements State css=canvas,svg,.map-container visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Jails Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/jails
Wait For Elements State css=main,table,.jails-list visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Jail Detail Page Loads Without Error
[Documentation] Guard: check jail exists via GET /api/jails first; use first jail name.
New Browser chromium headless=${TRUE}
Login As Admin
# Guard: find an active jail before navigating to /jails/:name
${response}= GET ${BACKEND_URL}/api/jails
${jails}= Set Variable ${response.json()}
${count}= Get Length ${jails}
IF ${count} > 0
${first_jail}= Get From List ${jails} 0
${jail_name}= Set Variable ${first_jail}[name]
Log Using jail: ${jail_name}
ELSE
${jail_name}= Set Variable manual-Jail
Log No jails found; using fallback name: ${jail_name}
END
Go To ${FRONTEND_URL}/jails/${jail_name}
Wait For Elements State css=main,h1,h2,.jail-detail visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Config Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/config
Wait For Elements State css=main,.tabs,.config-editor visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
History Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/history
Wait For Elements State css=main,table,.history-table visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser
Blocklists Page Loads Without Error
New Browser chromium headless=${TRUE}
Login As Admin
Go To ${FRONTEND_URL}/blocklists
Wait For Elements State css=main,.blocklists-panel,.panel visible timeout=15s
Get Text css=body not contains Something went wrong
Close Browser

View File

@@ -2,15 +2,52 @@
Resource ${CURDIR}/../../resources/common.resource
Resource ${CURDIR}/../../resources/auth.resource
# Test IP — stable across runs so teardown can reliably unban it.
# Chosen from a non-routable test subnet (RFC 3927).
# Must NOT overlap with any ignoreip rule in the fail2ban jail config.
Suite Setup Login As Admin
*** Test Cases ***
Ban Records Are Visible
New Browser chromium headless=${TRUE}
Login As Admin
Simulated Failed Logins Appear As Ban Records
[Documentation] Verifies the full ban pipeline:
... fail2ban log parsing → fail2ban ban → backend socket poll → UI rendering.
...
... Key timing facts:
... - simulate_failed_logins.sh writes 5 lines (COUNT=5).
... - manual-Jail maxretry=3 → ban triggers after 3rd matching line.
... - fail2ban backend=polling → fail2ban re-reads auth.log on its own schedule.
... - Backend has no push mechanism; /api/bans/active queries fail2ban on demand.
... - history_sync runs every 300 s; history page reads from the archive DB.
... - A direct API assertion (Step 3) isolates backend from UI rendering issues.
[Teardown] Run Process
... bash
... ${CURDIR}/../../Docker/check_ban_status.sh
... --unban
... 192.168.100.99
... timeout=30s
shell truncate -s 0 ${CURDIR}/../../Docker/logs/auth.log
Go To ${FRONTEND_URL}/bans
# Step 1 — write authentication-failure lines
${result}= Run Process
... bash
... ${CURDIR}/../../Docker/simulate_failed_logins.sh
... 5
... 192.168.100.99
... timeout=15s
Should Be Equal As Integers ${result.rc} 0
# Basic presence check — the ban table or empty state should be present.
${content}= Get Page Source
Should Not Be Empty ${content}
# Step 2 — wait for fail2ban to process the ban
# polling backend; no fixed interval but the ban is near-instant once detected.
Sleep 15s
Close Browser
# Step 3 — backend API: confirm ban is visible via fail2ban socket query
${resp}= GET ${BACKEND_URL}/api/bans/active expected_status=200
Should Contain ${resp.text} 192.168.100.99
# Step 4 — History page: confirm UI surfaces the ban record
Go To ${FRONTEND_URL}/history?page_size=500
Wait For Elements State css=table,tbody visible timeout=20s
Get Text body contains 192.168.100.99
# Step 5 — confirm jail name is shown alongside the IP
Get Text body contains manual-Jail