gradio/js/app/test/function_values.spec.ts
aliabid94 2943d6d688
Add Timer component (#8505)
* chagnes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* change

* add docs

* add changeset

* remove demo

* add changeset

* add changeset

* changes

* changes

* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* Update gradio/components/timer.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* changes

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-06-28 16:53:44 -07:00

44 lines
1.8 KiB
TypeScript

import { test, expect } from "@gradio/tootils";
test("Test Country Filter", async ({ page }) => {
const countries_list = page.getByTestId("json");
await expect(countries_list).toContainText("Algeria");
await expect(countries_list).not.toContainText("Argentina");
await page.getByLabel("range slider for Country Count").fill("3");
await expect(countries_list).toContainText("Algeria");
await expect(countries_list).toContainText("Argentina");
await page.getByLabel("Alphabetical Order").uncheck();
await expect(countries_list).not.toContainText("Algeria");
await expect(countries_list).toContainText("Sudan");
});
test("Test Random Country List", async ({ page }) => {
const random_country_box = page.getByLabel("Random Country");
const random_countries_box = page.getByLabel("Random Countries");
await expect(random_country_box).not.toBeEmpty();
await expect(random_countries_box).not.toBeEmpty();
const first_country_value = await random_country_box.inputValue();
const first_countries_value = await random_countries_box.inputValue();
await expect(random_country_box).not.toHaveValue(
first_country_value as string
);
await expect(random_countries_box).not.toHaveValue(
first_countries_value as string
);
await page.getByRole("button", { name: "Stop" }).click();
await page.waitForTimeout(2000);
const current_country_value = await random_country_box.inputValue();
const current_countries_value = await random_countries_box.inputValue();
await expect(random_country_box).toHaveValue(current_country_value as string);
await expect(random_countries_box).toHaveValue(
current_countries_value as string
);
await page.getByRole("button", { name: "Start" }).click();
await expect(random_country_box).not.toHaveValue(
current_country_value as string
);
await expect(random_countries_box).not.toHaveValue(
current_countries_value as string
);
});