Testing Blocks Input Handling and Form Submission in Gradio
This test suite focuses on validating input handling and form submission functionality in the Gradio application’s blocks interface. It ensures proper interaction between multiple textbox inputs and verifies the correct concatenation of input values in the output field.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gradio-app/gradio
js/spa/test/blocks_inputs.spec.ts
import { test, expect } from "@self/tootils";
test("renders the correct elements", async ({ page }) => {
const textboxes = await page.getByLabel("Input");
const textboxOne = await textboxes.first();
const textboxTwo = await textboxes.last();
await textboxOne.fill("hi");
await textboxTwo.fill("dawood");
await page.click('text="Submit"');
await expect(await page.getByLabel("Output")).toHaveValue("hi dawood");
});