gradio-app--gradio
adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
69 行
2.4 KiB
TypeScript
69 行
2.4 KiB
TypeScript
import { test, expect } from "@self/tootils";
|
|
|
|
test("component props", async ({ page }) => {
|
|
const numberInput = page.getByLabel("Input A");
|
|
const outputJson = page.locator("#output");
|
|
const showValueBtn = page.getByRole("button", { name: "Show Value" });
|
|
const doubleBtn = page.getByRole("button", {
|
|
name: "Double Value and Maximum"
|
|
});
|
|
const resetBtn = page.getByRole("button", { name: "Reset", exact: true });
|
|
|
|
await expect(numberInput).toHaveValue("5");
|
|
|
|
await showValueBtn.click();
|
|
await expect(outputJson).toContainText('"value": 5');
|
|
await expect(outputJson).toContainText('"maximum": 10');
|
|
await expect(outputJson).toContainText('"minimum": 0');
|
|
|
|
await doubleBtn.click();
|
|
|
|
await expect(numberInput).toHaveValue("10");
|
|
await expect(outputJson).toContainText('"value": 10');
|
|
await expect(outputJson).toContainText('"maximum": 20');
|
|
await expect(outputJson).toContainText('"minimum": 0');
|
|
|
|
await doubleBtn.click();
|
|
await expect(numberInput).toHaveValue("20");
|
|
await expect(outputJson).toContainText('"value": 20');
|
|
await expect(outputJson).toContainText('"maximum": 40');
|
|
|
|
await resetBtn.click();
|
|
await expect(outputJson).toContainText('"value": 5');
|
|
await expect(outputJson).toContainText('"maximum": 10');
|
|
await expect(outputJson).toContainText('"minimum": 0');
|
|
|
|
await numberInput.fill("7");
|
|
await showValueBtn.click();
|
|
|
|
await expect(outputJson).toContainText('"value": 7');
|
|
await expect(outputJson).toContainText('"maximum": 10');
|
|
await expect(outputJson).toContainText('"minimum": 0');
|
|
|
|
const imageOutputJson = page.locator("#image-output");
|
|
const showImagePropsBtn = page.getByRole("button", {
|
|
name: "Show Image Props"
|
|
});
|
|
const changeImageSizeBtn = page.getByRole("button", {
|
|
name: "Change Image Size"
|
|
});
|
|
const resetImageBtn = page.getByRole("button", {
|
|
name: "Reset Image"
|
|
});
|
|
|
|
await showImagePropsBtn.click();
|
|
await expect(imageOutputJson).toContainText('"width": 300');
|
|
await expect(imageOutputJson).toContainText('"height": 300');
|
|
await expect(imageOutputJson).toContainText('"type": "filepath"');
|
|
await expect(imageOutputJson).toContainText("cheetah.jpg");
|
|
|
|
await changeImageSizeBtn.click();
|
|
await expect(imageOutputJson).toContainText('"width": 400');
|
|
await expect(imageOutputJson).toContainText('"height": 400');
|
|
|
|
await resetImageBtn.click();
|
|
await expect(imageOutputJson).toContainText('"width": 300');
|
|
await expect(imageOutputJson).toContainText('"height": 300');
|
|
await expect(imageOutputJson).toContainText("cheetah.jpg");
|
|
});
|