diff --git a/tests/ui/app.spec.js b/tests/ui/app.spec.js index 1cc624d..a514682 100644 --- a/tests/ui/app.spec.js +++ b/tests/ui/app.spec.js @@ -188,7 +188,15 @@ test('while an episode plays, its play buttons all say pause, and pause it', asy const downloaded = page.locator('.ep', { has: page.locator('.kind.here') }).first(); await expect(downloaded).toBeVisible({ timeout: 20_000 }); await downloaded.click(); - await page.evaluate(() => { audio.muted = true; }); + // What the buttons do, not whether this browser decodes the fixture: it does not, reliably, + // and a load error pauses the player, rightly turning every button back to play. So the + // player plays and pauses here as a real one does, events and all, with no file behind it. + await page.evaluate(() => { + let paused = true; + Object.defineProperty(audio, 'paused', { get: () => paused, configurable: true }); + audio.play = async () => { paused = false; audio.dispatchEvent(new Event('play')); }; + audio.pause = () => { paused = true; audio.dispatchEvent(new Event('pause')); }; + }); const pane = page.locator('#files [data-a="play"]'); await pane.click(); await expect.poll(() => page.evaluate(() => !audio.paused)).toBe(true);