2023-11-04 06:39:25 +08:00
|
|
|
import { test, expect } from "@gradio/tootils";
|
|
|
|
|
|
|
|
test("Gallery preview mode displays all images correctly.", async ({
|
|
|
|
page
|
|
|
|
}) => {
|
|
|
|
await page.getByRole("button", { name: "Run" }).click();
|
|
|
|
await page.getByLabel("Thumbnail 2 of 3").click();
|
|
|
|
|
|
|
|
expect(await page.getByTestId("detailed-image").getAttribute("src")).toEqual(
|
|
|
|
"https://gradio-builds.s3.amazonaws.com/assets/lite-logo.png"
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(await page.getByTestId("thumbnail 1").getAttribute("src")).toEqual(
|
|
|
|
"https://gradio-builds.s3.amazonaws.com/assets/cheetah-003.jpg"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Gallery select event returns the right value", async ({ page }) => {
|
|
|
|
await page.getByRole("button", { name: "Run" }).click();
|
|
|
|
await page.getByLabel("Thumbnail 2 of 3").click();
|
2023-11-07 07:40:08 +08:00
|
|
|
await page.waitForTimeout(200);
|
2023-11-04 06:39:25 +08:00
|
|
|
expect(await page.getByLabel("Select Data")).toHaveValue(
|
|
|
|
"https://gradio-builds.s3.amazonaws.com/assets/lite-logo.png"
|
|
|
|
);
|
|
|
|
});
|