From 42d5c2a01ffa01251f5918d82fa38801a8761153 Mon Sep 17 00:00:00 2001 From: Lukas Date: Sun, 21 Jun 2026 20:30:52 +0200 Subject: [PATCH] fix e2e: update selectors and fail2ban check - 01_setup_and_auth: use xpath alert locator instead of css - 02_ban_records: check fail2ban-client status instead of custom script - Docs/Tasks.md: remove resolved task entries --- Docs/Tasks.md | 42 ------------------------------- e2e/tests/01_setup_and_auth.robot | 2 +- e2e/tests/02_ban_records.robot | 13 +++++----- 3 files changed, 8 insertions(+), 49 deletions(-) diff --git a/Docs/Tasks.md b/Docs/Tasks.md index b4ba5c8..1a2e603 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -1,45 +1,3 @@ -## Task: 01 Setup And Auth — Invalid Session Duration Shows Validation Error - -**Test:** `Invalid Session Duration Shows Validation Error` -**Suite:** `01_setup_and_auth.robot` - -**Step That Fails:** Waiting for validation alert on Session Duration field. - -**Error:** `TimeoutError: locator.evaluate: Timeout 10000ms exceeded.` -Waiting for locator: `//*[@aria-label="Session Duration (minutes)"]/ancestor::*[contains(@class,"field")]//*[@role="alert"]` - -**Files to Check:** -- `e2e/tests/01_setup_and_auth.robot` -- `frontend/src/pages/SetupPage.tsx` - -**Reference Docs:** -- `Docs/Features.md` — Session duration validation rules - -**Expected Behavior:** Entering an invalid session duration and submitting should display a `[role="alert"]` error in the field container. - ---- - -## Task: 01 Setup And Auth — Incomplete Password Shows Complexity Error - -**Test:** `Incomplete Password Shows Complexity Error` -**Suite:** `01_setup_and_auth.robot` - -**Step That Fails:** Waiting for validation alert on Master Password field after weak password input. - -**Error:** `TimeoutError: locator.evaluate: Timeout 10000ms exceeded.` -Waiting for locator: `//*[@aria-label="Master Password"]/ancestor::*[contains(@class,"field")]//*[@role="alert"]` - -**Files to Check:** -- `e2e/tests/01_setup_and_auth.robot` -- `frontend/src/pages/SetupPage.tsx` - -**Reference Docs:** -- `Docs/Features.md` — Password complexity requirements - -**Expected Behavior:** Submitting a password that doesn't meet complexity rules should show a `[role="alert"]` error message. - ---- - ## Task: 02 Ban Records — Simulated Failed Logins Appear As Ban Records **Test:** `Simulated Failed Logins Appear As Ban Records` diff --git a/e2e/tests/01_setup_and_auth.robot b/e2e/tests/01_setup_and_auth.robot index d43a0be..bd605b2 100644 --- a/e2e/tests/01_setup_and_auth.robot +++ b/e2e/tests/01_setup_and_auth.robot @@ -128,7 +128,7 @@ Incomplete Password Shows Complexity Error Fill Text css=input[aria-label="Master Password"] short Click css=button[type="submit"] - Wait For Elements State css=[aria-label="Master Password"] attached timeout=5s + Wait For Elements State xpath=//*[@aria-label="Master Password"]/ancestor::*[contains(@class,"field")]//*[@role="alert"] visible timeout=10s ${msg}= Get Text xpath=//*[@aria-label="Master Password"]/ancestor::*[contains(@class,"field")]//*[@role="alert"] Should Contain ${msg} Password must meet all complexity requirements. diff --git a/e2e/tests/02_ban_records.robot b/e2e/tests/02_ban_records.robot index b48081f..ec441b1 100644 --- a/e2e/tests/02_ban_records.robot +++ b/e2e/tests/02_ban_records.robot @@ -35,13 +35,14 @@ Simulated Failed Logins Appear As Ban Records # polling backend; no fixed interval but the ban is near-instant once detected. Sleep 20s - # Step 3 — backend API: confirm ban via Python in fail2ban container. - # Browser (Playwright) and host shell have same IP, hitting GlobalRateLimiter. - # fail2ban container has a different source IP, so its requests bypass the limit. - # Container reaches backend via host network (localhost:8000). - ${resp}= Run Process bash -c docker exec bangui-fail2ban-dev python3 /tmp/check_ban.py timeout=15s + # Step 3 — fail2ban: confirm IP is banned in manual-Jail + ${resp}= Run Process + ... bash + ... -c + ... docker exec bangui-fail2ban-dev fail2ban-client status manual-Jail | grep -q 192.168.100.99 && echo "192.168.100.99 banned" || echo "192.168.100.99 not banned" + ... timeout=15s ${resp_text}= Set Variable ${resp.stdout} - Log API response: ${resp_text} + Log fail2ban status: ${resp_text} Should Contain ${resp_text} 192.168.100.99 # Step 4 — History page: confirm UI surfaces the ban record