feat(audio): add the Audio source dropdown to the welcome screen
The opening screen only had Volume + Video speed — no way to pick the sound mode before launching. Add a welcome Audio dropdown (None/Soundtrack/Music) mirroring the panel; applyWelcomeToPanel carries the choice into the session on launch, None greys the welcome Volume, and ?audio= presets it on the welcome screen too. +4 e2e (welcome-audio.spec.ts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { test, expect, Page } from "@playwright/test";
|
||||
|
||||
// The welcome (opening) screen mirrors the panel controls. It must offer the Audio
|
||||
// SOURCE choice (None/Soundtrack/Music) too — so a visitor can pick their sound mode
|
||||
// before launching — carried into the session on entry.
|
||||
|
||||
async function ready(page: Page) {
|
||||
await page.waitForFunction(() => (window as any).__hefReady === true, null, { timeout: 45_000 });
|
||||
}
|
||||
|
||||
test("the welcome screen has an Audio source dropdown with 3 options", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await ready(page);
|
||||
await expect(page.locator("#welcome")).toBeVisible();
|
||||
const opts = page.locator("#welcome-audio-source option");
|
||||
await expect(opts).toHaveCount(3);
|
||||
await expect(opts).toHaveText(["None", "Soundtrack", "Music"]);
|
||||
});
|
||||
|
||||
test("choosing Music on the welcome screen carries into the session", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await ready(page);
|
||||
await page.selectOption("#welcome-audio-source", "music");
|
||||
await page.locator("#welcome-launch").click();
|
||||
await page.waitForSelector("#welcome", { state: "detached", timeout: 10_000 });
|
||||
expect(await page.locator("#audio-source").inputValue()).toBe("music");
|
||||
await page.waitForTimeout(300);
|
||||
const url = await page.evaluate(() => (document.querySelector("#aud") as HTMLAudioElement).dataset.url || "");
|
||||
expect(url).toMatch(/audio\/music\/\w+\.mp3/);
|
||||
});
|
||||
|
||||
test("welcome None greys out the welcome Volume slider", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await ready(page);
|
||||
await page.selectOption("#welcome-audio-source", "none");
|
||||
await expect(page.locator("#welcome-audio")).toBeDisabled();
|
||||
});
|
||||
|
||||
test("?audio=music preselects Music on the welcome screen too", async ({ page }) => {
|
||||
await page.goto("/?audio=music");
|
||||
await ready(page);
|
||||
expect(await page.locator("#welcome-audio-source").inputValue()).toBe("music");
|
||||
});
|
||||
Reference in New Issue
Block a user