gradio/js/app/test/image_mod.spec.ts
Abubakar Abid 4030f28af6
Allows updating the dataset of a gr.Examples (#8745)
* helpers

* add changeset

* changes

* add changeset

* changes

* tweak

* format

* example to docs

* add changeset

* fixes

* add tuple

* add changeset

* print

* format

* clean'

* clean

* format

* format backend

* fix backend tests

* format

* notebooks

* comment

* delete demo

* add changeset

* docstring

* docstring

* changes

* add changeset

* components

* changes

* changes

* format

* add test

* fix python test

* use deep_equal

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-07-15 09:19:52 -07:00

21 lines
811 B
TypeScript

import { test, expect } from "@gradio/tootils";
test("examples_get_updated_correctly", async ({ page }) => {
await page.locator(".gallery-item").first().click();
let image = await page.getByTestId("image").locator("img").first();
await expect(await image.getAttribute("src")).toContain("cheetah1.jpg");
await page.getByRole("button", { name: "Update Examples" }).click();
let example_image;
await expect(async () => {
example_image = await page.locator(".gallery-item").locator("img").first();
await expect(await example_image.getAttribute("src")).toContain("logo.png");
}).toPass();
await example_image.click();
await expect(async () => {
image = await page.getByTestId("image").locator("img").first();
await expect(await image.getAttribute("src")).toContain("logo.png");
}).toPass();
});