48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
/**
|
|
* Queue E2E Tests (v0.102)
|
|
*
|
|
* Parcours : navigation /queue, affichage queue vide ou pleine,
|
|
* présence des actions Clear et Save Queue.
|
|
*/
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
import {
|
|
TEST_CONFIG,
|
|
TEST_USERS,
|
|
loginAsUser,
|
|
setupErrorCapture,
|
|
} from '../utils/test-helpers';
|
|
|
|
test.describe('Queue Flow', () => {
|
|
test.use({ storageState: { cookies: [], origins: [] } });
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
setupErrorCapture(page);
|
|
});
|
|
|
|
test('should show queue page with empty state or tracks', async ({ page }) => {
|
|
test.setTimeout(45000);
|
|
|
|
await loginAsUser(page, TEST_USERS.default.email, TEST_USERS.default.password);
|
|
|
|
await page.goto(`${TEST_CONFIG.FRONTEND_URL}/queue`, {
|
|
waitUntil: 'domcontentloaded',
|
|
});
|
|
await page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {});
|
|
|
|
await expect(page).toHaveURL(/\/queue/);
|
|
|
|
const heading = page.getByRole('heading', { name: /play queue/i });
|
|
await expect(heading).toBeVisible({ timeout: 8000 });
|
|
|
|
const emptyState = page.getByText(/nothing in your queue|start playing music/i);
|
|
const saveButton = page.getByRole('button', { name: /save queue/i });
|
|
const clearButton = page.getByRole('button', { name: /clear/i });
|
|
const hasEmptyOrActions =
|
|
(await emptyState.isVisible({ timeout: 3000 }).catch(() => false)) ||
|
|
(await saveButton.isVisible({ timeout: 3000 }).catch(() => false)) ||
|
|
(await clearButton.isVisible({ timeout: 3000 }).catch(() => false));
|
|
|
|
expect(hasEmptyOrActions || (await heading.isVisible())).toBe(true);
|
|
});
|
|
});
|