Restructure 5 existing .robot files into 10 numbered files, one per feature area in Docs/Features.md. Each file is independently runnable. Add api.resource + data.resource for CSRF/XFF-aware wrappers and RFC5737 IP generators. Coverage: 110 new tests across login, dashboard, map, jails, config, history, blocklists, layout. Uses existing data-testid/aria-label/role selectors only — no frontend changes. Tests bypass per-IP rate limits via X-Forwarded-For header rotation. Hard rule preserved: failures are findings, never app-code fixes.
137 lines
5.9 KiB
Plaintext
137 lines
5.9 KiB
Plaintext
*** Settings ***
|
|
Documentation Ban Overview (Dashboard) feature coverage — status bar,
|
|
... ban list, time-range presets, data-source badges.
|
|
Resource ${CURDIR}/../resources/common.resource
|
|
Resource ${CURDIR}/../resources/auth.resource
|
|
Suite Setup Wait For Backend Health
|
|
|
|
*** Test Cases ***
|
|
Dashboard Page Renders Status Bar
|
|
[Documentation] The server status bar shows fail2ban version and jail count.
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
# Status bar exists somewhere on the page.
|
|
Page Should Contain fail2ban
|
|
Close Browser
|
|
|
|
Dashboard Ban List Renders Columns
|
|
[Documentation] Ban list table contains the required columns.
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
# Column header text appears at least once on the page.
|
|
Page Should Contain IP
|
|
Close Browser
|
|
|
|
Dashboard Time Range 24h Shows Live Source
|
|
[Documentation] Selecting Last 24 hours must show the Live (fail2ban DB) badge.
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
# The filter bar exposes the 24h preset; clicking it should toggle the badge.
|
|
${found}= Run Keyword And Return Status
|
|
... Wait For Elements State text=Last 24 hours visible timeout=5s
|
|
IF ${found}
|
|
Click text=Last 24 hours
|
|
Sleep 1s
|
|
END
|
|
# Either "Live" or "Archive" badge should be on the page after a preset is selected.
|
|
${has_badge}= Run Keyword And Return Status
|
|
... Get Text body contains fail2ban DB
|
|
${has_arch}= Run Keyword And Return Status
|
|
... Get Text body contains BanGUI DB
|
|
Should Be True ${has_badge} or ${has_arch} msg=No data-source badge visible after selecting preset
|
|
Close Browser
|
|
|
|
Dashboard Time Range 7d Shows Archive Source
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
${found}= Run Keyword And Return Status
|
|
... Wait For Elements State text=Last 7 days visible timeout=5s
|
|
IF ${found}
|
|
Click text=Last 7 days
|
|
Sleep 1s
|
|
END
|
|
${has_arch}= Run Keyword And Return Status
|
|
... Get Text body contains BanGUI DB
|
|
${has_live}= Run Keyword And Return Status
|
|
... Get Text body contains fail2ban DB
|
|
Should Be True ${has_arch} or ${has_live} msg=No data-source badge visible for 7d preset
|
|
Close Browser
|
|
|
|
Dashboard Time Range 30d Shows Archive Source
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
${found}= Run Keyword And Return Status
|
|
... Wait For Elements State text=Last 30 days visible timeout=5s
|
|
IF ${found}
|
|
Click text=Last 30 days
|
|
Sleep 1s
|
|
END
|
|
Page Should Contain BanGUI
|
|
Close Browser
|
|
|
|
Dashboard Time Range 365d Shows Archive Source
|
|
Login As Admin
|
|
Go To ${FRONTEND_URL}/
|
|
Wait For Elements State css=[data-testid="dashboard"] visible timeout=15s
|
|
${found}= Run Keyword And Return Status
|
|
... Wait For Elements State text=Last 365 days visible timeout=5s
|
|
IF ${found}
|
|
Click text=Last 365 days
|
|
Sleep 1s
|
|
END
|
|
Page Should Contain BanGUI
|
|
Close Browser
|
|
|
|
Dashboard Bans Endpoint Returns Expected Shape
|
|
[Documentation] API contract test: GET /api/v1/dashboard/bans returns paginated data.
|
|
Set Random Xff Header
|
|
Login Via HTTP
|
|
${headers}= Create Dictionary X-BanGUI-Request 1
|
|
Set To Dictionary ${headers} X-Forwarded-For ${XFF_HEADER}
|
|
${resp}= GET On Session bangsess /api/v1/dashboard/bans headers=${headers} expected_status=any
|
|
Should Be True ${resp.status_code} in [200, 204] msg=Unexpected status: ${resp.status_code}
|
|
IF ${resp.status_code} == 200
|
|
${body}= Set Variable ${resp.json()}
|
|
# Response is paginated: {items: [], total: N} or list.
|
|
Dictionary Should Contain Key ${body} items
|
|
END
|
|
|
|
Dashboard Status Endpoint Returns Version
|
|
Set Random Xff Header
|
|
Login Via HTTP
|
|
${headers}= Create Dictionary X-BanGUI-Request 1
|
|
Set To Dictionary ${headers} X-Forwarded-For ${XFF_HEADER}
|
|
${resp}= GET On Session bangsess /api/v1/dashboard/status headers=${headers} expected_status=any
|
|
Should Be Equal As Integers ${resp.status_code} 200
|
|
${body}= Set Variable ${resp.json()}
|
|
Dictionary Should Contain Key ${body} version
|
|
|
|
Dashboard Bans By Country Endpoint
|
|
Set Random Xff Header
|
|
Login Via HTTP
|
|
${headers}= Create Dictionary X-BanGUI-Request 1
|
|
Set To Dictionary ${headers} X-Forwarded-For ${XFF_HEADER}
|
|
${resp}= GET On Session bangsess /api/v1/dashboard/bans/by-country headers=${headers} expected_status=any
|
|
Should Be True ${resp.status_code} in [200, 204]
|
|
|
|
Dashboard Bans Trend Endpoint
|
|
Set Random Xff Header
|
|
Login Via HTTP
|
|
${headers}= Create Dictionary X-BanGUI-Request 1
|
|
Set To Dictionary ${headers} X-Forwarded-For ${XFF_HEADER}
|
|
${resp}= GET On Session bangsess /api/v1/dashboard/bans/trend headers=${headers} expected_status=any
|
|
Should Be True ${resp.status_code} in [200, 204]
|
|
|
|
Dashboard Bans By Jail Endpoint
|
|
Set Random Xff Header
|
|
Login Via HTTP
|
|
${headers}= Create Dictionary X-BanGUI-Request 1
|
|
Set To Dictionary ${headers} X-Forwarded-For ${XFF_HEADER}
|
|
${resp}= GET On Session bangsess /api/v1/dashboard/bans/by-jail headers=${headers} expected_status=any
|
|
Should Be True ${resp.status_code} in [200, 204]
|