Testing Gradio Sub-Block Form Submission and Example Handling in gradio-app
This test suite validates core form submission and example handling functionality in a Gradio application interface. The tests focus on textbox input submission and pre-defined example interaction, ensuring proper state management and value propagation.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gradio-app/gradio
js/spa/test/sub_block_render.spec.ts
import { test, expect } from "@self/tootils";
test("submit works", async ({ page }) => {
await page.getByTestId("textbox").first().focus();
await page.getByTestId("textbox").first().fill("test");
await page.keyboard.press("Enter");
await expect(page.getByLabel("Prompt", { exact: true })).toHaveValue("image");
});
test("examples work", async ({ page }) => {
await page.getByText("A serious capybara at work, wearing a suit").click();
await expect(page.getByLabel("Prompt", { exact: true })).toHaveValue("image");
});