gradio/js/app/test/model3d_component_events.spec.ts
Freddy Boulton da1e31832f
Fix Model3D download button and other issues (#6414)
* Add code

* add changeset

* add changeset

* add changeset

* Don't bind

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-11-13 17:13:20 -08:00

28 lines
1.0 KiB
TypeScript

import { test, expect } from "@gradio/tootils";
test("Model3D click-to-upload uploads file successfuly. Upload and clear events work correctly. Downloading works.", async ({
page
}) => {
await page
.getByRole("button", { name: "Drop File Here - or - Click to Upload" })
.click();
const uploader = await page.locator("input[type=file]");
await Promise.all([
uploader.setInputFiles(["./test/files/face.obj"]),
page.waitForResponse("**/upload?*?*")
]);
await expect(page.getByLabel("# Change Events")).toHaveValue("1");
await expect(page.getByLabel("# Upload Events")).toHaveValue("1");
await page.getByLabel("Clear").nth(0).click();
await expect(page.getByLabel("# Change Events")).toHaveValue("2");
await expect(page.getByLabel("# Clear Events")).toHaveValue("1");
await expect(page.getByLabel("Clear Value")).toHaveValue("");
const downloadPromise = page.waitForEvent("download");
await page.getByLabel("Download").click();
const download = await downloadPromise;
await expect(download.suggestedFilename()).toBe("face.obj");
});