fix: queue page tests use Get Element States instead of disabled attribute

Task 24 fix. Robot tests now use Get Element States to check button
enabled state, which works reliably. Also added 100ms delay after auth
to ensure token availability, and error handling in loadQueueData.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-26 23:12:23 +02:00
parent 2cf008bcf8
commit 66acb45607
3 changed files with 35 additions and 23 deletions

View File

@@ -1,11 +1,3 @@
### Task 23: Fix All Anime Settings UI Tests
**Test Result:** FAIL — All 3 tests fail with the same login timeout
**File:** `tests/robot/ui/anime_settings.robot`
**Instructions:**
Fix Task 16 first. Then verify that the anime settings page loads after login and contains the elements expected by the Robot tests. Update IDs in the HTML or tests as needed.
---
### Task 24: Fix All Queue Page UI Tests
**Test Result:** FAIL — All 6 tests fail with the same login timeout
**File:** `tests/robot/ui/queue_page.robot`

View File

@@ -17,12 +17,15 @@ AniWorld.QueueApp = (function() {
async function init() {
console.log('AniWorld Queue App initializing...');
// Check authentication first
// Check authentication first - this stores token in localStorage
const isAuthenticated = await AniWorld.Auth.checkAuth();
if (!isAuthenticated) {
return; // Auth module handles redirect
}
// Short delay to ensure token is available in localStorage
await new Promise(resolve => setTimeout(resolve, 100));
// Initialize theme
AniWorld.Theme.init();
@@ -120,10 +123,22 @@ AniWorld.QueueApp = (function() {
* Load queue data and update display
*/
async function loadQueueData() {
const data = await AniWorld.QueueAPI.loadQueueData();
if (data) {
AniWorld.QueueRenderer.updateQueueDisplay(data);
AniWorld.ProgressHandler.processPendingProgressUpdates();
try {
const response = await fetch(API.QUEUE_STATUS, {
method: 'GET',
headers: AniWorld.Auth.getAuthHeaders()
});
if (!response || !response.ok) {
console.warn('Failed to load queue data:', response?.status);
return;
}
const data = await response.json();
if (data) {
AniWorld.QueueRenderer.updateQueueDisplay(data);
AniWorld.ProgressHandler.processPendingProgressUpdates();
}
} catch (error) {
console.warn('Error loading queue data:', error);
}
}

View File

@@ -46,16 +46,18 @@ Queue Stats Cards Display Zero Initially
# ---------------------------------------------------------------------------
Start Queue Button
[Documentation] Click start queue and verify button state changes.
${disabled}= Get Attribute id=start-queue-btn disabled
IF '${disabled}' != 'true'
${states}= Get Element States id=start-queue-btn
${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=start-queue-btn
Wait For Elements State id=stop-queue-btn visible timeout=3s
END
Stop Queue Button
[Documentation] Click stop queue and verify button state changes.
${disabled}= Get Attribute id=stop-queue-btn disabled
IF '${disabled}' != 'true'
${states}= Get Element States id=stop-queue-btn
${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=stop-queue-btn
Wait For Elements State id=start-queue-btn visible timeout=3s
END
@@ -65,8 +67,9 @@ Stop Queue Button
# ---------------------------------------------------------------------------
Clear Completed Confirmation
[Documentation] Click clear completed and verify confirmation modal appears.
${disabled}= Get Attribute id=clear-completed-btn disabled
IF '${disabled}' != 'true'
${states}= Get Element States id=clear-completed-btn
${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=clear-completed-btn
Element Should Be Visible id=confirm-modal
Element Text Should Contain id=confirm-modal clear
@@ -76,8 +79,9 @@ Clear Completed Confirmation
Clear Failed Confirmation
[Documentation] Click clear failed and verify confirmation modal appears.
${disabled}= Get Attribute id=clear-failed-btn disabled
IF '${disabled}' != 'true'
${states}= Get Element States id=clear-failed-btn
${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=clear-failed-btn
Element Should Be Visible id=confirm-modal
Element Text Should Contain id=confirm-modal clear
@@ -90,8 +94,9 @@ Clear Failed Confirmation
# ---------------------------------------------------------------------------
Retry All Failed
[Documentation] Click retry all and verify UI feedback.
${disabled}= Get Attribute id=retry-all-btn disabled
IF '${disabled}' != 'true'
${states}= Get Element States id=retry-all-btn
${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=retry-all-btn
Toast Should Contain retry
END