From fd8d9636cb03525fb8e51d7115d852ab2944c01f Mon Sep 17 00:00:00 2001 From: Lukas Date: Sun, 28 Jun 2026 17:19:54 +0200 Subject: [PATCH] Fix anime settings UI tests: add series via API before testing Tests were failing because settings page requires series in DB. Now call Add Series API before navigating to settings page. --- Docs/tasks.md | 16 ---------------- tests/robot/ui/anime_settings.robot | 24 +++++++++++++++++++++--- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Docs/tasks.md b/Docs/tasks.md index 2619f04..3924109 100644 --- a/Docs/tasks.md +++ b/Docs/tasks.md @@ -1,19 +1,3 @@ -## Task 12: UI Anime Settings - Anime Settings Page Loads - -**Suite:** `Robot.Ui.Anime Settings` -**Test:** `Anime Settings Page Loads` -**Result:** FAIL -**Error:** `TimeoutError: locator.waitFor: Timeout 5000ms exceeded. waiting for locator('id=settings-section') to be visible — locator resolved to hidden ` - -**Instructions:** -- The `#settings-section` element has the CSS class `hidden`, preventing it from becoming visible. -- Investigate the anime settings page frontend code to understand how the settings section is shown/hidden. -- The test may need to click a button or navigate differently to reveal the section. -- Update the test in `tests/robot/ui/anime_settings.robot` to perform the correct navigation steps before waiting for `#settings-section`. -- Alternatively, if the section should be visible by default, fix the frontend logic. - ---- - ## Task 13: UI Anime Settings - Regenerate NFO **Suite:** `Robot.Ui.Anime Settings` diff --git a/tests/robot/ui/anime_settings.robot b/tests/robot/ui/anime_settings.robot index 1e1e25a..0b20c35 100644 --- a/tests/robot/ui/anime_settings.robot +++ b/tests/robot/ui/anime_settings.robot @@ -4,6 +4,7 @@ Documentation Anime settings page UI tests for Aniworld. Resource ${CURDIR}/../resources/common.resource Resource ${CURDIR}/../resources/ui_keywords.resource +Resource ${CURDIR}/../resources/api_keywords.resource Test Setup Run Keywords ... Create Anonymous Session @@ -11,6 +12,8 @@ Test Setup Run Keywords ... AND Open Browser To Page /login ... AND Perform Login ... AND Wait For Elements State id=search-input visible timeout=5s +... AND Login And Get Token +... AND Create Session auth ${BASE_URL} headers={'Authorization': 'Bearer ${TOKEN}'} Test Teardown Close Browser @@ -20,7 +23,12 @@ Test Teardown Close Browser # --------------------------------------------------------------------------- Anime Settings Page Loads [Documentation] Navigate to anime settings page and verify form elements. - Go To ${BASE_URL}/anime/settings?key=attack-on-titan + # Add series to the database first so the settings page can load it + ${resp}= Add Series https://aniworld.to/anime/stream/attack-on-titan Attack on Titan 2013 + Response Should Have Status ${resp} 202 + ${key}= Get JSON Value ${resp} $.key + Should Not Be Empty ${key} + Go To ${BASE_URL}/anime/settings?key=${key} Wait For Elements State id=settings-section visible timeout=10s Page Title Should Contain Settings Element Should Be Visible id=settings-section @@ -32,7 +40,12 @@ Anime Settings Page Loads # --------------------------------------------------------------------------- Regenerate NFO [Documentation] Click regenerate NFO and verify success notification. - Go To ${BASE_URL}/anime/settings?key=attack-on-titan + # Add series to the database first so the settings page can load it + ${resp}= Add Series https://aniworld.to/anime/stream/attack-on-titan Attack on Titan 2013 + Response Should Have Status ${resp} 202 + ${key}= Get JSON Value ${resp} $.key + Should Not Be Empty ${key} + Go To ${BASE_URL}/anime/settings?key=${key} Wait For Elements State id=settings-section visible timeout=10s Click id=regenerate-nfo-btn Wait For Elements State css=#toast-container .toast visible timeout=5s @@ -42,7 +55,12 @@ Regenerate NFO # --------------------------------------------------------------------------- Update Series Settings [Documentation] Change series settings and save. - Go To ${BASE_URL}/anime/settings?key=attack-on-titan + # Add series to the database first so the settings page can load it + ${resp}= Add Series https://aniworld.to/anime/stream/attack-on-titan Attack on Titan 2013 + Response Should Have Status ${resp} 202 + ${key}= Get JSON Value ${resp} $.key + Should Not Be Empty ${key} + Go To ${BASE_URL}/anime/settings?key=${key} Wait For Elements State id=settings-section visible timeout=10s Fill Text id=field-folder Attack on Titan Custom Click id=save-db-btn