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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user