Testing Chatbot Metadata Display Implementation in Gradio
This test suite validates the chatbot’s ability to handle agentic demos and display messages with metadata in the Gradio application. It focuses on testing the interaction with weather-related functionality and verifies proper display of error states and tool usage indicators.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gradio-app/gradio
js/spa/test/chatbot_with_tools.spec.ts
import { test, expect } from "@self/tootils";
test("Chatbot can support agentic demos by displaying messages with metadata", async ({
page
}) => {
await page.getByRole("button", { name: "Get San Francisco Weather" }).click();
await expect(
await page.locator("div").filter({ hasText: "đź’Ą Error" }).nth(1)
).toBeVisible();
await expect(
page.locator("span").filter({ hasText: "🛠️ Used tool" })
).toBeVisible();
await expect(
page.locator("button").filter({ hasText: "It's a sunny day in San" })
).toBeVisible();
});