From fc425bffa6236cb7fa7af0bb185e46a4bb8009dc Mon Sep 17 00:00:00 2001 From: rays Date: Fri, 18 Sep 2026 15:09:26 +0000 Subject: [PATCH] Play/pause test: play without decoding the fixture The fixture file does not reliably decode in the test browser; the load error paused the player, which rightly turned the buttons back to play, and the test failed in the full run. The test now fakes play and pause, events included, so it checks what the buttons do and nothing else. The previous commit went up with this test failing. Co-Authored-By: Claude Opus 5 --- tests/ui/app.spec.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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);