*** Settings *** Resource ${CURDIR}/../../resources/common.resource Resource ${CURDIR}/../../resources/auth.resource Suite Setup Login As Admin *** Test Cases *** Config Field Edit Persists After Reload [Documentation] Verifies auto-save round-trip: UI edit → debounced PATCH → reload rehydration. ... ... - Waits for "Saved" indicator rather than fixed Sleep (debounce may delay PATCH). ... - Restores original value in teardown so subsequent tests are not affected. ... - Runs last in suite ordering to avoid destabilising fail2ban health for other tests. [Teardown] Restore Original Ban Time # Step 1 — navigate to config page and activate the Jails tab. Go To ${FRONTEND_URL}/config Wait For Elements State css=[role="tablist"] visible timeout=15s Click role=tab name=Jails # Step 2 — wait for jail list to render, then select the first jail. Wait For Elements State css=[role="listbox"] visible timeout=15s ${jail_items}= Get Elements css=[role="option"] ${count}= Get Length ${jail_items} IF ${count} == 0 Fatal Error No jails found in config list — cannot run test. END Click css=[role="option"]:first-child # Step 3 — read current ban_time value for teardown. Wait For Elements State css=input[aria-label="Ban Time"] visible timeout=10s ${original}= Get Value css=input[aria-label="Ban Time"] Set Suite Variable ${ORIGINAL_BANTIME} ${original} Log Original bantime: ${original} # Step 4 — edit ban_time to a safe, valid integer (7200 s = 2 h). Fill Text css=input[aria-label="Ban Time"] 7200 # Step 5 — wait for auto-save debounce to fire PATCH and backend to respond. # The indicator shows "Saved" (role=status, Badge with text "Saved"). Wait For Elements State css=[role="status"]:has-text("Saved") visible timeout=15s Log Auto-save confirmed — PATCH completed. # Step 6 — verify via API that the value was actually written to the jail config file. ${resp}= GET ${BACKEND_URL}/api/jails Should Contain ${resp.text} 7200 # Step 7 — reload the page and confirm the new value is rehydrated from the backend. Reload Wait For Elements State css=[role="tablist"] visible timeout=15s Click role=tab name=Jails Wait For Elements State css=[role="listbox"] visible timeout=15s Click css=[role="option"]:first-child Wait For Elements State css=input[aria-label="Ban Time"] visible timeout=10s ${reloaded}= Get Value css=input[aria-label="Ban Time"] Should Be Equal As Strings ${reloaded} 7200 Log Reload verification passed — value persisted. *** Keywords *** Restore Original Ban Time [Documentation] Restore the jail's original ban_time so subsequent tests are unaffected. ... Runs as Test Teardown so it executes even if the test fails mid-way. Go To ${FRONTEND_URL}/config Wait For Elements State css=[role="tablist"] visible timeout=15s Click role=tab name=Jails Wait For Elements State css=[role="listbox"] visible timeout=15s ${jail_items}= Get Elements css=[role="option"] ${count}= Get Length ${jail_items} IF ${count} > 0 Click css=[role="option"]:first-child END Wait For Elements State css=input[aria-label="Ban Time"] visible timeout=10s Fill Text css=input[aria-label="Ban Time"] ${ORIGINAL_BANTIME} Wait For Elements State css=[role="status"]:has-text("Saved") visible timeout=15s Log Restored original ban_time: ${ORIGINAL_BANTIME}