Unverified 提交 41eb8e34 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

fix(e2e): deflake context_limit_banner, attach_image, and prompt_libr… (#2725)

…ary tests - context_limit_banner: increase banner visibility timeout from MEDIUM to LONG since token counting IPC fires asynchronously after streaming ends - attach_image: wait for file card button to render before taking aria snapshot in the upload-to-codebase test - prompt_library: replace flaky toMatchAriaSnapshot with explicit assertions (toBeVisible, toContainText, getByRole) since Chrome's accessibility tree non-deterministically merges heading and paragraph text <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2725" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> Co-authored-by: 's avatarclaude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
上级 11b33efe
...@@ -104,6 +104,11 @@ test("attach image - chat - upload to codebase", async ({ po }) => { ...@@ -104,6 +104,11 @@ test("attach image - chat - upload to codebase", async ({ po }) => {
await po.sendPrompt("[[UPLOAD_IMAGE_TO_CODEBASE]]"); await po.sendPrompt("[[UPLOAD_IMAGE_TO_CODEBASE]]");
// Wait for the uploaded file card to render before snapshotting
await expect(
po.page.getByRole("button", { name: /file\.png/ }),
).toBeVisible();
await po.snapshotServerDump("last-message", { name: "upload-to-codebase" }); await po.snapshotServerDump("last-message", { name: "upload-to-codebase" });
await po.snapshotMessages({ replaceDumpPath: true }); await po.snapshotMessages({ replaceDumpPath: true });
......
...@@ -15,7 +15,7 @@ test("context limit banner shows 'running out' when near context limit", async ( ...@@ -15,7 +15,7 @@ test("context limit banner shows 'running out' when near context limit", async (
const contextLimitBanner = po.chatActions const contextLimitBanner = po.chatActions
.getChatInputContainer() .getChatInputContainer()
.getByTestId("context-limit-banner"); .getByTestId("context-limit-banner");
await expect(contextLimitBanner).toBeVisible({ timeout: Timeout.MEDIUM }); await expect(contextLimitBanner).toBeVisible({ timeout: Timeout.LONG });
// Verify banner text for near-limit case // Verify banner text for near-limit case
await expect(contextLimitBanner).toContainText( await expect(contextLimitBanner).toContainText(
...@@ -57,7 +57,7 @@ test("context limit banner shows 'costs extra' for long context", async ({ ...@@ -57,7 +57,7 @@ test("context limit banner shows 'costs extra' for long context", async ({
const contextLimitBanner = po.chatActions const contextLimitBanner = po.chatActions
.getChatInputContainer() .getChatInputContainer()
.getByTestId("context-limit-banner"); .getByTestId("context-limit-banner");
await expect(contextLimitBanner).toBeVisible({ timeout: Timeout.MEDIUM }); await expect(contextLimitBanner).toBeVisible({ timeout: Timeout.LONG });
// Verify banner text for long context case // Verify banner text for long context case
await expect(contextLimitBanner).toContainText( await expect(contextLimitBanner).toContainText(
......
...@@ -11,7 +11,14 @@ test("create and edit prompt", async ({ po }) => { ...@@ -11,7 +11,14 @@ test("create and edit prompt", async ({ po }) => {
content: "prompt1content", content: "prompt1content",
}); });
await expect(po.page.getByTestId("prompt-card")).toMatchAriaSnapshot(); // Wait for prompt card to be fully rendered
const promptCard = po.page.getByTestId("prompt-card");
await expect(promptCard).toBeVisible();
await expect(
promptCard.getByRole("heading", { name: "title1" }),
).toBeVisible();
await expect(promptCard).toContainText("desc");
await expect(promptCard).toContainText("prompt1content");
await po.page.getByTestId("edit-prompt-button").click(); await po.page.getByTestId("edit-prompt-button").click();
await po.page await po.page
...@@ -19,7 +26,13 @@ test("create and edit prompt", async ({ po }) => { ...@@ -19,7 +26,13 @@ test("create and edit prompt", async ({ po }) => {
.fill("prompt1content-edited"); .fill("prompt1content-edited");
await po.page.getByRole("button", { name: "Save" }).click(); await po.page.getByRole("button", { name: "Save" }).click();
await expect(po.page.getByTestId("prompt-card")).toMatchAriaSnapshot(); // Verify edited content is displayed
await expect(promptCard).toBeVisible();
await expect(
promptCard.getByRole("heading", { name: "title1" }),
).toBeVisible();
await expect(promptCard).toContainText("desc");
await expect(promptCard).toContainText("prompt1content-edited");
}); });
test("delete prompt", async ({ po }) => { test("delete prompt", async ({ po }) => {
......
- heading "title1" [level=3]
- paragraph: desc
- button:
- img
- button:
- img
- text: prompt1content
\ No newline at end of file
- heading "title1" [level=3]
- paragraph: desc
- button:
- img
- button:
- img
- text: prompt1content-edited
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论