New chat e2e (#314)

This commit is contained in:
Will Chen
2025-06-02 22:35:55 -07:00
committed by GitHub
parent 1dde72e776
commit a44a9783c1
10 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
chat1
<dyad-chat-summary>Chat 1</dyad-chat-summary>

View File

@@ -0,0 +1,3 @@
chat2
<dyad-chat-summary>Chat 2</dyad-chat-summary>

View File

@@ -163,6 +163,14 @@ class PageObject {
return this.page.getByRole("textbox", { name: "Ask Dyad to build..." }); return this.page.getByRole("textbox", { name: "Ask Dyad to build..." });
} }
clickNewChat({ index = 0 }: { index?: number } = {}) {
// There is two new chat buttons...
return this.page
.getByRole("button", { name: "New Chat" })
.nth(index)
.click();
}
async sendPrompt(prompt: string) { async sendPrompt(prompt: string) {
await this.getChatInput().click(); await this.getChatInput().click();
await this.getChatInput().fill(prompt); await this.getChatInput().fill(prompt);

View File

@@ -0,0 +1,21 @@
import { test } from "./helpers/test_helper";
const newChatTestCases = [
{ name: "first button", clickOptions: undefined },
{ name: "second button", clickOptions: { index: 1 } },
];
newChatTestCases.forEach(({ name, clickOptions }) => {
test(`new chat (${name})`, async ({ po }) => {
await po.setUp();
await po.sendPrompt("tc=chat1");
await po.snapshotMessages();
await po.clickNewChat(clickOptions);
// Make sure it's empty
await po.snapshotMessages();
await po.sendPrompt("tc=chat2");
await po.snapshotMessages();
});
});

View File

@@ -0,0 +1,4 @@
- paragraph: tc=chat1
- paragraph: chat1
- button "Retry":
- img

View File

@@ -0,0 +1 @@
- text: No messages yet

View File

@@ -0,0 +1,4 @@
- paragraph: tc=chat2
- paragraph: chat2
- button "Retry":
- img

View File

@@ -0,0 +1,4 @@
- paragraph: tc=chat1
- paragraph: chat1
- button "Retry":
- img

View File

@@ -0,0 +1 @@
- text: No messages yet

View File

@@ -0,0 +1,4 @@
- paragraph: tc=chat2
- paragraph: chat2
- button "Retry":
- img