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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user