Unverified 提交 5b2bd896 authored 作者: wwwillchen-bot's avatar wwwillchen-bot 提交者: GitHub

Improve chat_history E2E test stability with toPass() retry (#2699)

## Summary - Replaces static timeout-based wait with toPass() retry logic for ArrowUp navigation wrap test - Makes the test more resilient to timing variations with the BeautifulMentionsPlugin - Uses aria-selected attribute for more reliable selection detection ## Test plan - Run `npm run e2e -- chat_history.spec.ts` to verify the test passes - The test should be more stable and less prone to flakiness 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2699" 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 avatarWill Chen <willchen90@gmail.com> Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
上级 9b4d81a3
...@@ -41,10 +41,14 @@ test("should open, navigate, and select from history menu", async ({ po }) => { ...@@ -41,10 +41,14 @@ test("should open, navigate, and select from history menu", async ({ po }) => {
await expect(firstItem).toContainText("First test message"); await expect(firstItem).toContainText("First test message");
// Navigate up again to wrap to last item (newest message) // Navigate up again to wrap to last item (newest message)
// Wait briefly to ensure the previous navigation state has settled // Use toPass() to retry ArrowUp until selection wraps to last item, since
await po.page.waitForTimeout(100); // the menu navigation can be timing-sensitive with the BeautifulMentionsPlugin
await po.page.keyboard.press("ArrowUp"); await expect(async () => {
await expect(lastItem).toHaveClass(/bg-accent/, { timeout: Timeout.MEDIUM }); await po.page.keyboard.press("ArrowUp");
await expect(lastItem).toHaveAttribute("aria-selected", "true", {
timeout: 500,
});
}).toPass({ timeout: Timeout.MEDIUM });
// Select with Enter (selects newest message) // Select with Enter (selects newest message)
await po.page.keyboard.press("Enter"); await po.page.keyboard.press("Enter");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论