mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
Fix tests (#6701)
This commit is contained in:
parent
fe40308894
commit
d95d647894
@ -68,7 +68,7 @@ test("Audio drag-and-drop displays a warning when the file is of the wrong mime
|
||||
test("Play, Pause, and stop events work correctly.", async ({ page }) => {
|
||||
const uploader = await page.locator("input[type=file]");
|
||||
await Promise.all([
|
||||
uploader.setInputFiles(["../../test/test_files/audio_sample.wav"]),
|
||||
uploader.setInputFiles(["../../demo/audio_debugger/cantina.wav"]),
|
||||
page.waitForResponse("**/upload?*")
|
||||
]);
|
||||
|
||||
@ -82,7 +82,15 @@ test("Play, Pause, and stop events work correctly.", async ({ page }) => {
|
||||
.getByLabel("Play", { exact: true })
|
||||
.click();
|
||||
|
||||
await expect(page.getByLabel("# Output Play Events")).toHaveValue("1");
|
||||
await expect(page.getByLabel("# Output Pause Events")).toHaveValue("1");
|
||||
await expect(page.getByLabel("# Output Stop Events")).toHaveValue("1");
|
||||
const event_triggered = async (label: string) => {
|
||||
const value = await page.getByLabel(label).inputValue();
|
||||
expect(Number(value)).toBeGreaterThan(0);
|
||||
};
|
||||
|
||||
// toPass will retry the function until it passes or times out
|
||||
// need this because the stop event is only triggered when the video is done playing
|
||||
// hard to time otherwise
|
||||
await expect(async () => event_triggered("# Output Play Events")).toPass();
|
||||
await expect(async () => event_triggered("# Output Pause Events")).toPass();
|
||||
await expect(async () => event_triggered("# Output Stop Events")).toPass();
|
||||
});
|
||||
|
@ -45,14 +45,16 @@ test("Image click-to-upload uploads image successfuly. Clear button dispatches e
|
||||
});
|
||||
|
||||
test("Image drag-to-upload uploads image successfuly.", async ({ page }) => {
|
||||
await drag_and_drop_file(
|
||||
page,
|
||||
"input[type=file]",
|
||||
"./test/files/cheetah1.jpg",
|
||||
"cheetag1.jpg",
|
||||
"image/*"
|
||||
);
|
||||
await page.waitForResponse("**/upload?*");
|
||||
await Promise.all([
|
||||
drag_and_drop_file(
|
||||
page,
|
||||
"input[type=file]",
|
||||
"./test/files/cheetah1.jpg",
|
||||
"cheetag1.jpg",
|
||||
"image/*"
|
||||
),
|
||||
page.waitForResponse("**/upload?*")
|
||||
]);
|
||||
await expect(page.getByLabel("# Change Events").first()).toHaveValue("1");
|
||||
await expect(page.getByLabel("# Upload Events")).toHaveValue("1");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user