2023-06-20 04:02:03 +08:00
|
|
|
import { test, expect } from "@gradio/tootils";
|
2022-07-26 00:48:59 +08:00
|
|
|
import { BASE64_PLOT_IMG } from "./media_data";
|
|
|
|
|
|
|
|
test("matplotlib", async ({ page }) => {
|
2023-02-24 05:32:18 +08:00
|
|
|
await page.getByLabel("Plot Type").click();
|
|
|
|
await page.getByRole("button", { name: "Matplotlib" }).click();
|
|
|
|
await page.getByLabel("Month").click();
|
|
|
|
await page.getByRole("button", { name: "January" }).click();
|
2022-10-13 00:30:42 +08:00
|
|
|
await page.getByLabel("Social Distancing?").check();
|
|
|
|
|
2022-07-26 00:48:59 +08:00
|
|
|
await Promise.all([
|
2022-10-13 00:30:42 +08:00
|
|
|
page.click("text=Submit"),
|
2023-03-08 00:36:25 +08:00
|
|
|
page.waitForResponse("**/run/predict")
|
2022-07-26 00:48:59 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
const matplotlib_img = await page.locator("img").nth(0);
|
|
|
|
const matplotlib_img_data = await matplotlib_img.getAttribute("src");
|
2023-06-20 04:02:03 +08:00
|
|
|
await expect(matplotlib_img_data).toBeTruthy();
|
2022-07-26 00:48:59 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test("plotly", async ({ page }) => {
|
2023-02-24 05:32:18 +08:00
|
|
|
await page.getByLabel("Plot Type").click();
|
2023-06-20 04:02:03 +08:00
|
|
|
await page.getByRole("button", { name: "Plotly" }).click();
|
2023-02-24 05:32:18 +08:00
|
|
|
await page.getByLabel("Month").click();
|
|
|
|
await page.getByRole("button", { name: "January" }).click();
|
2022-10-13 00:30:42 +08:00
|
|
|
await page.getByLabel("Social Distancing?").check();
|
|
|
|
|
2022-07-26 00:48:59 +08:00
|
|
|
await Promise.all([
|
2022-10-13 00:30:42 +08:00
|
|
|
page.click("text=Submit"),
|
2023-03-08 00:36:25 +08:00
|
|
|
page.waitForResponse("**/run/predict")
|
2022-07-26 00:48:59 +08:00
|
|
|
]);
|
|
|
|
await expect(page.locator(".js-plotly-plot")).toHaveCount(1);
|
|
|
|
});
|