2023-11-17 08:10:12 +08:00
|
|
|
import { test, expect } from "@gradio/tootils";
|
|
|
|
|
2023-12-20 04:42:41 +08:00
|
|
|
test.skip("UploadButton properly dispatches load event and click event for the single file case.", async ({
|
2023-11-17 08:10:12 +08:00
|
|
|
page
|
|
|
|
}) => {
|
|
|
|
await page.getByRole("button", { name: "Upload Single File" }).click();
|
|
|
|
const uploader = await page.getByTestId("Upload Single File-upload-button");
|
2023-12-15 04:40:36 +08:00
|
|
|
await uploader.setInputFiles(["./test/files/cheetah1.jpg"]);
|
2023-11-17 08:10:12 +08:00
|
|
|
|
|
|
|
await expect(page.getByLabel("# Load Upload Single File")).toHaveValue("1");
|
|
|
|
await expect(
|
|
|
|
page.getByLabel("# Click Upload Single File Output")
|
|
|
|
).toHaveValue("1");
|
|
|
|
|
|
|
|
const downloadPromise = page.waitForEvent("download");
|
|
|
|
await page.getByRole("link").nth(0).click();
|
|
|
|
const download = await downloadPromise;
|
2023-12-15 04:40:36 +08:00
|
|
|
await expect(download.suggestedFilename()).toBe("cheetah1.jpg");
|
2023-11-17 08:10:12 +08:00
|
|
|
});
|
|
|
|
|
2023-12-20 04:42:41 +08:00
|
|
|
test.skip("UploadButton properly dispatches load event and click event for the multiple file case.", async ({
|
2023-11-17 08:10:12 +08:00
|
|
|
page
|
|
|
|
}) => {
|
|
|
|
await page.getByRole("button", { name: "Upload Multiple Files" }).click();
|
|
|
|
const uploader = await page.getByTestId(
|
|
|
|
"Upload Multiple Files-upload-button"
|
|
|
|
);
|
2023-12-15 04:40:36 +08:00
|
|
|
await uploader.setInputFiles([
|
|
|
|
"./test/files/face.obj",
|
|
|
|
"./test/files/cheetah1.jpg"
|
2023-11-17 08:10:12 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
await expect(page.getByLabel("# Load Upload Multiple Files")).toHaveValue(
|
|
|
|
"1"
|
|
|
|
);
|
|
|
|
await expect(
|
|
|
|
page.getByLabel("# Click Upload Multiple Files Output")
|
|
|
|
).toHaveValue("1");
|
|
|
|
|
|
|
|
const downloadPromise = page.waitForEvent("download");
|
|
|
|
await page.getByRole("link").nth(1).click();
|
|
|
|
const download = await downloadPromise;
|
|
|
|
await expect(download.suggestedFilename()).toBe("cheetah1.jpg");
|
|
|
|
});
|