gradio/js/spa/test/datetimes.spec.ts
pngwn 2b6cbf2590
Fix published package exports (#9163)
* rename

* save patch

* fix everything

* format

* rm file

* fix stuff

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* fix

* Fix scripts/run_lite.sh and scripts/build_lite.sh (#9170)

* fixes

* fixes

* asd

* asd

* asd

* review comments

* fiux types

* fiux types

* make fileexpolorer public

* format

* lint

* lint

---------

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <t.yic.yt@gmail.com>
2024-08-22 16:38:45 +00:00

54 lines
2.1 KiB
TypeScript

import { test, expect } from "@self/tootils";
test("gr.DateTime shows correct values", async ({ page }) => {
await page.locator("#date1").getByRole("textbox").first().click();
await page
.locator("#date1")
.getByRole("textbox")
.first()
.fill("2020-10-01 10:50:00");
await page.locator("body").first().click();
await expect(page.getByLabel("Last Change")).toHaveValue(
"2020-10-01 10:50:00"
);
await expect(page.getByLabel("Last Submit")).toHaveValue("");
await page.locator("#date1").getByRole("textbox").first().press("Enter");
await expect(page.getByLabel("Last Submit")).toHaveValue(
"2020-10-01 10:50:00"
);
await expect(page.getByLabel("Last Load")).toHaveValue("");
await page.locator("#date2").getByRole("textbox").first().click();
await page.locator("#date2").getByRole("textbox").first().fill("2000-02-22");
await page.locator("body").first().click();
await expect(page.getByLabel("Last Change")).toHaveValue("2000-02-22");
await page.getByRole("button", { name: "Load Date 1" }).click();
await expect(page.getByLabel("Last Load")).toHaveValue("2020-10-01 10:50:00");
await page.getByRole("button", { name: "Load Date 2" }).click();
await expect(page.getByLabel("Last Load")).toHaveValue("2000-02-22");
await page.locator("#date2").getByRole("textbox").first().click();
await page
.locator("#date2")
.getByRole("textbox")
.first()
.fill("2020-05-01xxx");
await page.locator("body").first().click();
await expect(page.getByLabel("Last Change")).toHaveValue("2000-02-22");
await page.locator("#date2").getByRole("textbox").first().click();
await page.locator("#date2").getByRole("textbox").first().fill("2020-05-02");
await page.locator("body").first().click();
await expect(page.getByLabel("Last Change")).toHaveValue("2020-05-02");
await page.locator("#date3").getByRole("textbox").first().click();
await page
.locator("#date3")
.getByRole("textbox")
.first()
.fill("2020-10-10 05:01:01");
await page.getByRole("button", { name: "Load Date 3" }).click();
await expect(page.getByLabel("Last Load")).toHaveValue("1602298861.0");
});