mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
4a55157ed9
* changes * changes * add changeset * changes * changes * changes * changes * Update guides/04_building-with-blocks/04_dynamic-apps-with-render-decorator.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { test, expect } from "@gradio/tootils";
|
|
|
|
test("clicking through tabs shows correct content", async ({ page }) => {
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (0)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (0)");
|
|
|
|
const input_text = page.getByLabel("Task Name");
|
|
|
|
await input_text.fill("eat");
|
|
await input_text.press("Enter");
|
|
|
|
await expect(page.locator("body")).not.toContainText("Incomplete Tasks (0)");
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (1)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (0)");
|
|
await expect(page.locator("textarea").nth(1)).toHaveValue("eat");
|
|
|
|
await input_text.fill("pray");
|
|
await input_text.press("Enter");
|
|
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (2)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (0)");
|
|
await expect(page.locator("textarea").nth(2)).toHaveValue("pray");
|
|
|
|
await input_text.fill("love");
|
|
await input_text.press("Enter");
|
|
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (3)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (0)");
|
|
await expect(page.locator("textarea").nth(1)).toHaveValue("eat");
|
|
await expect(page.locator("textarea").nth(2)).toHaveValue("pray");
|
|
await expect(page.locator("textarea").nth(3)).toHaveValue("love");
|
|
|
|
const done_btn_for_eat = page
|
|
.locator("button")
|
|
.filter({ hasText: "Done" })
|
|
.first();
|
|
await done_btn_for_eat.click();
|
|
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (2)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (1)");
|
|
|
|
const delete_btn_for_love = page
|
|
.locator("button")
|
|
.filter({ hasText: "Delete" })
|
|
.last();
|
|
await delete_btn_for_love.click();
|
|
|
|
await expect(page.locator("body")).toContainText("Incomplete Tasks (1)");
|
|
await expect(page.locator("body")).toContainText("Complete Tasks (1)");
|
|
});
|