Update Playwright test and ChatMessage component (#1668)
This pull request includes updates to the Playwright test in `chat_io.spec.ts` and the `ChatMessage` component in `chatMessage/index.tsx`. The Playwright test now includes assertions for the chat output and input, ensuring that the correct messages are displayed. The `ChatMessage` component now includes `data-testid` attributes for the chat messages, allowing for easier testing and identification of specific messages.
This commit is contained in:
commit
7037af501e
3 changed files with 8 additions and 361 deletions
|
|
@ -164,7 +164,7 @@ export default function ChatMessage({
|
||||||
{chat.thought && chat.thought !== "" && !hidden && <br></br>}
|
{chat.thought && chat.thought !== "" && !hidden && <br></br>}
|
||||||
<div className="flex w-full flex-col">
|
<div className="flex w-full flex-col">
|
||||||
<div className="flex w-full flex-col dark:text-white">
|
<div className="flex w-full flex-col dark:text-white">
|
||||||
<div className="flex w-full flex-col">
|
<div data-testid={"chat-message-"+chat.sender_name+"-"+chatMessage} className="flex w-full flex-col">
|
||||||
{useMemo(
|
{useMemo(
|
||||||
() =>
|
() =>
|
||||||
chatMessage === "" && lockChat ? (
|
chatMessage === "" && lockChat ? (
|
||||||
|
|
@ -313,7 +313,7 @@ dark:prose-invert"
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<span>{chatMessage}</span>
|
<span data-testid={"chat-message-"+chat.sender_name+"-"+chatMessage}>{chatMessage}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
||||||
import { test } from "@playwright/test";
|
import { test,expect } from "@playwright/test";
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
|
|
||||||
test("chat_io_teste", async ({ page }) => {
|
test("chat_io_teste", async ({ page }) => {
|
||||||
|
|
@ -42,4 +42,8 @@ test("chat_io_teste", async ({ page }) => {
|
||||||
await page.getByPlaceholder("Send a message...").click();
|
await page.getByPlaceholder("Send a message...").click();
|
||||||
await page.getByPlaceholder("Send a message...").fill("teste");
|
await page.getByPlaceholder("Send a message...").fill("teste");
|
||||||
await page.getByRole("button").nth(1).click();
|
await page.getByRole("button").nth(1).click();
|
||||||
|
const chat_output = page.getByTestId("chat-message-AI-teste");
|
||||||
|
const chat_input = page.getByTestId("chat-message-User-teste");
|
||||||
|
await expect(chat_output).toHaveText("teste");
|
||||||
|
await expect(chat_input).toHaveText("teste");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue