2022-03-24 18:59:09 +08:00
|
|
|
import { test, expect, Page } from "@playwright/test";
|
2023-05-12 23:22:25 +08:00
|
|
|
import { mock_theme, wait_for_page, mock_api, mock_demo } from "./utils";
|
2022-03-24 18:59:09 +08:00
|
|
|
|
|
|
|
test("a component acts as both input and output", async ({ page }) => {
|
2022-08-18 03:43:26 +08:00
|
|
|
await mock_demo(page, "input_output");
|
2022-05-27 16:53:50 +08:00
|
|
|
await mock_api(page, [["tset"]]);
|
2023-03-27 22:52:07 +08:00
|
|
|
await mock_theme(page);
|
|
|
|
await wait_for_page(page);
|
2022-03-24 18:59:09 +08:00
|
|
|
|
2022-10-13 00:30:42 +08:00
|
|
|
const textbox = await page.getByLabel("Input-Output");
|
2022-03-24 18:59:09 +08:00
|
|
|
|
2022-05-27 16:53:50 +08:00
|
|
|
await textbox.fill("test");
|
2022-10-13 00:30:42 +08:00
|
|
|
await Promise.all([
|
|
|
|
page.click("button"),
|
2023-03-08 00:36:25 +08:00
|
|
|
page.waitForResponse("**/run/predict")
|
2022-10-13 00:30:42 +08:00
|
|
|
]);
|
|
|
|
await expect(await textbox).toHaveValue("tset");
|
2022-03-24 18:59:09 +08:00
|
|
|
});
|