Files
GenAIExamples/Text2Image/ui/svelte/tests/txt2Img.spec.ts
WenjiaoYue c6fc92d37c Add Text2Image UI, UI tests, Readme, and Docker support (#927)
Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-14 13:36:33 +08:00

29 lines
856 B
TypeScript

// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
import { test, expect, type Page } from "@playwright/test";
// Initialization before each test
test.beforeEach(async ({ page }) => {
await page.goto("/");
});
// Constants definition
const CHAT_ITEMS = ["An astronaut riding a green horse"];
// Helper function: Enter message to chat
async function enterMessageToChat(page: Page, message: string) {
await page.getByTestId("img-input").click();
await page.getByTestId("img-input").fill(message);
await page.waitForTimeout(1000);
await page.getByTestId("img-gen").click();
}
// Test description: New Chat
test.describe("New Image", () => {
// Test: Enter message to generate new images
test("should enter message to generate new images", async ({ page }) => {
await enterMessageToChat(page, CHAT_ITEMS[0]);
});
});