Files
Aniworld/tests/robot/ui/login.robot
Lukas 706aa37f18 Add data-testid to toast, update selector and login test
- Add data-testid='toast' to toast element in ui-utils.js
- Update toast selector in ui_keywords.resource to use [data-testid='toast']
- Update login rate limit test to check for 'invalid' instead of 'lockout'
  (testing mode disables lockout, so test verifies proper error message)
- Remove completed task docs from tasks.md
2026-06-28 17:34:27 +02:00

88 lines
3.9 KiB
Plaintext

*** Settings ***
Documentation Login UI tests for Aniworld.
... Covers login page load, valid/invalid login, rate limit UI, password visibility, and logout.
Resource ${CURDIR}/../resources/common.resource
Resource ${CURDIR}/../resources/ui_keywords.resource
Test Setup Run Keywords
... Create Anonymous Session
... AND Setup Master Password
Test Teardown Close Browser
*** Test Cases ***
# ---------------------------------------------------------------------------
# Login Page Load
# ---------------------------------------------------------------------------
Login Page Loads
[Documentation] Verify the login page loads with all form elements.
Open Browser To Page /login
Page Title Should Contain Login
Element Should Be Visible id=password-input
Element Should Be Visible id=login-submit-btn
Element Should Be Visible id=password-toggle
# ---------------------------------------------------------------------------
# Valid Login
# ---------------------------------------------------------------------------
Login With Valid Password
[Documentation] Log in with the correct password and verify redirect to dashboard.
Open Browser To Page /login
Perform Login ${SETUP_PASSWORD}
Page Title Should Contain AniWorld
Element Should Be Visible id=search-input
# ---------------------------------------------------------------------------
# Invalid Login
# ---------------------------------------------------------------------------
Login With Invalid Password
[Documentation] Log in with an incorrect password and verify error message.
Open Browser To Page /login
Fill Text id=password-input WrongPass123!
Click id=login-submit-btn
Element Should Be Visible id=login-error
Element Text Should Contain id=login-error invalid
# ---------------------------------------------------------------------------
# Rate Limit UI
# ---------------------------------------------------------------------------
Login Rate Limit UI
[Documentation] Submit multiple failed logins and verify error message.
... NOTE: With ANIWORLD_TESTING=1 (lockout disabled), only invalid credentials shown.
... In production without testing flag, lockout message would appear after 5 attempts.
Open Browser To Page /login
FOR ${i} IN RANGE 6
Fill Text id=password-input WrongPass123!
Click id=login-submit-btn
Wait For Elements State id=login-error visible timeout=3s
END
Element Text Should Contain id=login-error invalid
# ---------------------------------------------------------------------------
# Password Visibility Toggle
# ---------------------------------------------------------------------------
Password Visibility Toggle
[Documentation] Click the eye icon and verify the password field type toggles.
Open Browser To Page /login
Fill Text id=password-input ${SETUP_PASSWORD}
${type_before}= Get Attribute id=password-input type
Should Be Equal As Strings ${type_before} password
Click id=password-toggle
${type_after}= Get Attribute id=password-input type
Should Be Equal As Strings ${type_after} text
Click id=password-toggle
${type_final}= Get Attribute id=password-input type
Should Be Equal As Strings ${type_final} password
# ---------------------------------------------------------------------------
# Logout
# ---------------------------------------------------------------------------
Logout
[Documentation] Log in then log out and verify redirect to login page.
Open Browser To Page /login
Perform Login ${SETUP_PASSWORD}
Perform Logout
Page Title Should Contain Login
Element Should Be Visible id=password-input