const { test, expect } = require('@playwright/test'); test('lyrics queue exposes issue filters and reuses LRCLIB and Whisper routes', async ({ page }) => { const calls = []; await page.route('**/api/**', async route => { const req = route.request(), url = new URL(req.url()); calls.push({ path: url.pathname, method: req.method() }); let body = { ok: true }; if (url.pathname === '/api/admin/me') body = { enabled: true, admin: true }; if (url.pathname === '/api/admin/lyrics/quality') body = { ok: true, total: 1, offset: 0, songs: [{ id: 'QualMiss001', title: 'Missing lyric sample', channel: 'Choir', lines: 0, reasons: ['missing'], openReports: 0 }] }; if (url.pathname === '/api/notes/QualMiss001/lyrics/web') body = { ok: true, rev: 2, lines: 12 }; if (url.pathname === '/api/admin/transcriptions/QualMiss001') body = { ok: true, job: { status: 'queued' } }; if (url.pathname === '/api/admin/media') body = { ok: true, media: [] }; if (url.pathname === '/api/uploads') body = { ok: true, uploads: [] }; if (url.pathname === '/api/admin/flags') body = { ok: true, open: 0, flags: [] }; await route.fulfill({ contentType: 'application/json', body: JSON.stringify(body) }); }); await page.goto('/admin.html#quality'); await expect(page.locator('#p-quality')).toBeVisible(); await expect(page.locator('#qualityTable')).toContainText('Missing lyric sample'); await page.locator('#qualityCategory').selectOption('untimed'); await page.locator('#qualityFilterForm button').click(); await expect(page.locator('#qualityTable')).toContainText('Pull LRCLIB'); await page.locator('[data-quality-pull]').click(); await expect(page.locator('#qualityStatus')).toContainText('revision 2'); await page.locator('[data-quality-whisper]').click(); await expect(page.locator('#qualityStatus')).toContainText('Whisper queued'); expect(calls.some(x => x.path.endsWith('/lyrics/web') && x.method === 'POST')).toBe(true); expect(calls.some(x => x.path.endsWith('/transcriptions/QualMiss001') && x.method === 'POST')).toBe(true); });