test(e2e): split suite by feature area with shared resources
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.
This commit is contained in:
121
e2e/tests/10_general_layout.robot
Normal file
121
e2e/tests/10_general_layout.robot
Normal file
@@ -0,0 +1,121 @@
|
||||
*** Settings ***
|
||||
Documentation General UI / layout behaviour — sidebar nav,
|
||||
... active link highlighting, server-status badge, session persistence.
|
||||
Resource ${CURDIR}/../resources/common.resource
|
||||
Resource ${CURDIR}/../resources/auth.resource
|
||||
Suite Setup Wait For Backend Health
|
||||
|
||||
*** Test Cases ***
|
||||
Sidebar Is Visible On Dashboard
|
||||
[Documentation] After login the sidebar nav is visible.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=main visible timeout=10s
|
||||
${nav_visible}= Run Keyword And Return Status
|
||||
... Wait For Elements State css=nav[aria-label="Main navigation"] visible timeout=5s
|
||||
Should Be True ${nav_visible} msg=Sidebar navigation not visible on dashboard
|
||||
Close Browser
|
||||
|
||||
Sidebar Lists All Required Pages
|
||||
[Documentation] Sidebar contains links to Dashboard, World Map, Jails,
|
||||
... Configuration, History, and a Sign Out button.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=main visible timeout=10s
|
||||
Page Should Contain Dashboard
|
||||
Page Should Contain World Map
|
||||
Page Should Contain Jails
|
||||
Page Should Contain Configuration
|
||||
Page Should Contain History
|
||||
Page Should Contain Sign out
|
||||
Close Browser
|
||||
|
||||
Sidebar Sign Out Logs User Out
|
||||
[Documentation] Clicking Sign out in sidebar clears the session.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=main visible timeout=10s
|
||||
Click css=[aria-label="Sign out"]
|
||||
Wait For Load State domcontentloaded
|
||||
${url}= Get URL
|
||||
Should Contain ${url} /login
|
||||
Close Browser
|
||||
|
||||
Theme Toggle Is Present In Sidebar
|
||||
[Documentation] Sidebar exposes a theme toggle button.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=main visible timeout=10s
|
||||
${theme_visible}= Run Keyword And Return Status
|
||||
... Get Element States css=[aria-label*="light mode"], [aria-label*="dark mode"] contains visible
|
||||
Should Be True ${theme_visible} msg=Theme toggle not visible
|
||||
Close Browser
|
||||
|
||||
Active Page Highlighted In Sidebar
|
||||
[Documentation] The current page is marked active in the sidebar nav.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/jails
|
||||
Wait For Elements State css=[data-testid="jails-page"] visible timeout=10s
|
||||
${active}= Run Keyword And Return Status
|
||||
... Get Element States css=nav[aria-label="Main navigation"] [aria-current="page"] contains visible
|
||||
Should Be True ${active} msg=No active page link highlighted in sidebar
|
||||
Close Browser
|
||||
|
||||
Session Persists Across Page Reload
|
||||
[Documentation] Reloading the page does NOT log the user out.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=[data-testid="dashboard"] visible timeout=10s
|
||||
Reload
|
||||
Wait For Load State domcontentloaded
|
||||
Sleep 2s
|
||||
${url}= Get URL
|
||||
Should Not Contain ${url} /login
|
||||
Close Browser
|
||||
|
||||
Theme Toggle Changes Color Mode
|
||||
[Documentation] Clicking the theme toggle changes the document color scheme.
|
||||
Login As Admin
|
||||
Go To ${FRONTEND_URL}/
|
||||
Wait For Elements State css=main visible timeout=10s
|
||||
${before}= Evaluate JavaScript ${None} () => document.documentElement.getAttribute('data-theme') || document.documentElement.style.colorScheme || 'unknown'
|
||||
Log Theme before: ${before}
|
||||
# Try clicking either light or dark mode toggle (one of them exists).
|
||||
Run Keyword And Ignore Error Click css=[aria-label="Switch to light mode"]
|
||||
Run Keyword And Ignore Error Click css=[aria-label="Switch to dark mode"]
|
||||
Sleep 1s
|
||||
${after}= Evaluate JavaScript ${None} () => document.documentElement.getAttribute('data-theme') || document.documentElement.style.colorScheme || 'unknown'
|
||||
Log Theme after: ${after}
|
||||
Close Browser
|
||||
|
||||
Health Endpoint Returns Component Status
|
||||
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/health/ready
|
||||
... headers=${headers} expected_status=any
|
||||
Should Be True ${resp.status_code} in [200, 503] msg=Unexpected ready status: ${resp.status_code}
|
||||
|
||||
Liveness Endpoint Returns 200
|
||||
${resp}= GET ${BACKEND_URL}/api/v1/health/live expected_status=any
|
||||
Should Be Equal As Integers ${resp.status_code} 200
|
||||
|
||||
Metrics Endpoint Returns Prometheus Text
|
||||
[Documentation] GET /api/v1/metrics returns Prometheus text format.
|
||||
${resp}= GET ${BACKEND_URL}/api/v1/metrics expected_status=any
|
||||
Should Be Equal As Integers ${resp.status_code} 200
|
||||
${body}= Set Variable ${resp.text}
|
||||
Should Contain ${body} HELP # Prometheus exposition format marker
|
||||
|
||||
Setup Timezone Endpoint Returns IANA String
|
||||
${resp}= GET ${BACKEND_URL}/api/v1/setup/timezone expected_status=any
|
||||
Should Be Equal As Integers ${resp.status_code} 200
|
||||
${body}= Set Variable ${resp.json()}
|
||||
Dictionary Should Contain Key ${body} timezone
|
||||
|
||||
Setup Status Endpoint Returns Completed Flag
|
||||
${resp}= GET ${BACKEND_URL}/api/v1/setup expected_status=any
|
||||
Should Be Equal As Integers ${resp.status_code} 200
|
||||
${body}= Set Variable ${resp.json()}
|
||||
Dictionary Should Contain Key ${body} completed
|
||||
Reference in New Issue
Block a user