mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
3a6406e5d5
* Icon testids * Simpler test * Add test * Demo check * Add notebook * Revert demo * Fix code * Add non-None callable value * change --------- Co-authored-by: pngwn <hello@pngwn.io>
29 lines
998 B
TypeScript
29 lines
998 B
TypeScript
import { test, expect } from "@gradio/tootils";
|
|
|
|
test("Components value can be set via callable to a non-None value", async ({
|
|
page
|
|
}) => {
|
|
const textBoxValue = await page.getByLabel(`component_00`).inputValue();
|
|
expect(textBoxValue.length).toBeGreaterThan(1);
|
|
|
|
const sliderValue = await page.getByLabel(`component_01`).inputValue();
|
|
expect(parseFloat(sliderValue)).toBeGreaterThan(0);
|
|
|
|
const dropDownValue = await page.getByLabel(`component_07`).inputValue();
|
|
expect(Array("a", "b", "c").includes(dropDownValue)).toBeTruthy();
|
|
});
|
|
|
|
test("gr.ClearButton clears every component's value", async ({ page }) => {
|
|
await Promise.all([
|
|
page.waitForResponse("**/run/predict"),
|
|
page.click("text=Get Values")
|
|
]);
|
|
await expect(page.getByLabel("Are all cleared?")).toHaveValue("False");
|
|
await page.click("text=Clear");
|
|
await Promise.all([
|
|
page.waitForResponse("**/run/predict"),
|
|
page.click("text=Get Values")
|
|
]);
|
|
await expect(page.getByLabel("Are all cleared?")).toHaveValue("True");
|
|
});
|