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 ### Task 24: Fix All Queue Page UI Tests
**Test Result:** FAIL — All 6 tests fail with the same login timeout **Test Result:** FAIL — All 6 tests fail with the same login timeout
**File:** `tests/robot/ui/queue_page.robot` **File:** `tests/robot/ui/queue_page.robot`

View File

@@ -17,12 +17,15 @@ AniWorld.QueueApp = (function() {
async function init() { async function init() {
console.log('AniWorld Queue App initializing...'); console.log('AniWorld Queue App initializing...');
// Check authentication first // Check authentication first - this stores token in localStorage
const isAuthenticated = await AniWorld.Auth.checkAuth(); const isAuthenticated = await AniWorld.Auth.checkAuth();
if (!isAuthenticated) { if (!isAuthenticated) {
return; // Auth module handles redirect return; // Auth module handles redirect
} }
// Short delay to ensure token is available in localStorage
await new Promise(resolve => setTimeout(resolve, 100));
// Initialize theme // Initialize theme
AniWorld.Theme.init(); AniWorld.Theme.init();
@@ -120,11 +123,23 @@ AniWorld.QueueApp = (function() {
* Load queue data and update display * Load queue data and update display
*/ */
async function loadQueueData() { async function loadQueueData() {
const data = await AniWorld.QueueAPI.loadQueueData(); 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) { if (data) {
AniWorld.QueueRenderer.updateQueueDisplay(data); AniWorld.QueueRenderer.updateQueueDisplay(data);
AniWorld.ProgressHandler.processPendingProgressUpdates(); 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 Start Queue Button
[Documentation] Click start queue and verify button state changes. [Documentation] Click start queue and verify button state changes.
${disabled}= Get Attribute id=start-queue-btn disabled ${states}= Get Element States id=start-queue-btn
IF '${disabled}' != 'true' ${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=start-queue-btn Click id=start-queue-btn
Wait For Elements State id=stop-queue-btn visible timeout=3s Wait For Elements State id=stop-queue-btn visible timeout=3s
END END
Stop Queue Button Stop Queue Button
[Documentation] Click stop queue and verify button state changes. [Documentation] Click stop queue and verify button state changes.
${disabled}= Get Attribute id=stop-queue-btn disabled ${states}= Get Element States id=stop-queue-btn
IF '${disabled}' != 'true' ${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=stop-queue-btn Click id=stop-queue-btn
Wait For Elements State id=start-queue-btn visible timeout=3s Wait For Elements State id=start-queue-btn visible timeout=3s
END END
@@ -65,8 +67,9 @@ Stop Queue Button
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
Clear Completed Confirmation Clear Completed Confirmation
[Documentation] Click clear completed and verify confirmation modal appears. [Documentation] Click clear completed and verify confirmation modal appears.
${disabled}= Get Attribute id=clear-completed-btn disabled ${states}= Get Element States id=clear-completed-btn
IF '${disabled}' != 'true' ${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=clear-completed-btn Click id=clear-completed-btn
Element Should Be Visible id=confirm-modal Element Should Be Visible id=confirm-modal
Element Text Should Contain id=confirm-modal clear Element Text Should Contain id=confirm-modal clear
@@ -76,8 +79,9 @@ Clear Completed Confirmation
Clear Failed Confirmation Clear Failed Confirmation
[Documentation] Click clear failed and verify confirmation modal appears. [Documentation] Click clear failed and verify confirmation modal appears.
${disabled}= Get Attribute id=clear-failed-btn disabled ${states}= Get Element States id=clear-failed-btn
IF '${disabled}' != 'true' ${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=clear-failed-btn Click id=clear-failed-btn
Element Should Be Visible id=confirm-modal Element Should Be Visible id=confirm-modal
Element Text Should Contain id=confirm-modal clear Element Text Should Contain id=confirm-modal clear
@@ -90,8 +94,9 @@ Clear Failed Confirmation
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
Retry All Failed Retry All Failed
[Documentation] Click retry all and verify UI feedback. [Documentation] Click retry all and verify UI feedback.
${disabled}= Get Attribute id=retry-all-btn disabled ${states}= Get Element States id=retry-all-btn
IF '${disabled}' != 'true' ${enabled}= Evaluate 'enabled' in $states
IF $enabled
Click id=retry-all-btn Click id=retry-all-btn
Toast Should Contain retry Toast Should Contain retry
END END