mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
5e66e01abc
* changes * add changeset * changes * changes * changes * changes * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
19 lines
655 B
TypeScript
19 lines
655 B
TypeScript
import { test, expect } from "@gradio/tootils";
|
|
|
|
test("audio streams correctly", async ({ page }) => {
|
|
const uploader = await page.locator("input[type=file]");
|
|
await uploader.setInputFiles(["../../test/test_files/audio_sample.wav"]);
|
|
await page.getByRole("button", { name: "Stream as File" }).click();
|
|
await page.waitForSelector("audio");
|
|
const isAudioPlaying = await page.evaluate(async () => {
|
|
const audio = document.querySelector("audio");
|
|
if (!audio) {
|
|
return false;
|
|
}
|
|
await audio.play();
|
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
return audio.currentTime > 0;
|
|
});
|
|
await expect(isAudioPlaying).toBeTruthy();
|
|
});
|