Unverified 提交 de8ab4db authored 作者: dyad-assistant[bot]'s avatar dyad-assistant[bot] 提交者: GitHub

fix: deflake E2E tests (select_component.spec.ts) (#3107)

## Summary - Fixed flaky `select_component.spec.ts > select component next.js` test by increasing the chat completion timeout for Next.js builds - Added configurable `timeout` parameter to `sendPrompt()` and `waitForChatCompletion()` in the test page objects - The test was timing out because Next.js apps take longer to build on the first prompt, exceeding the default MEDIUM timeout (15s local / 30s CI) ## Flaky test analysis Scanned 6 recent PRs by wwwillchen/wwwillchen-bot for flaky tests. Found 30+ unique flaky test occurrences across these specs: - `setup_flow.spec.ts` (6 occurrences) - passed 10x runs, already stable - `select_component.spec.ts` (6 occurrences) - **confirmed flaky, fixed** - `setup.spec.ts` (5 occurrences) - passed 10x runs, already stable - `context_manage.spec.ts` (5 occurrences) - passed 10x runs, already stable - `undo.spec.ts` (3 occurrences) - passed 10x runs, already stable - `debugging_logs.spec.ts` (3 occurrences) - passed 10x runs, already stable ## Test plan - [x] Confirmed flakiness: `select_component.spec.ts` failed 1/10 runs before fix - [x] Verified fix: all 60 tests passed (6 tests × 10 runs) after the fix - [x] Verified other flaky specs are currently stable (all passed 10x repeat runs) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3107" 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>
上级 b7bcb988
......@@ -462,7 +462,7 @@ export class PageObject {
async sendPrompt(
prompt: string,
options?: { skipWaitForCompletion?: boolean },
options?: { skipWaitForCompletion?: boolean; timeout?: number },
) {
return this.chatActions.sendPrompt(prompt, options);
}
......
......@@ -65,9 +65,11 @@ export class ChatActions {
return this.page.getByRole("button", { name: "Undo" });
}
async waitForChatCompletion() {
async waitForChatCompletion({
timeout = Timeout.MEDIUM,
}: { timeout?: number } = {}) {
await expect(this.getRetryButton()).toBeVisible({
timeout: Timeout.MEDIUM,
timeout,
});
}
......@@ -81,13 +83,16 @@ export class ChatActions {
async sendPrompt(
prompt: string,
{ skipWaitForCompletion = false }: { skipWaitForCompletion?: boolean } = {},
{
skipWaitForCompletion = false,
timeout,
}: { skipWaitForCompletion?: boolean; timeout?: number } = {},
) {
await this.getChatInput().click();
await this.getChatInput().fill(prompt);
await this.page.getByRole("button", { name: "Send message" }).click();
if (!skipWaitForCompletion) {
await this.waitForChatCompletion();
await this.waitForChatCompletion({ timeout });
}
}
......
......@@ -151,7 +151,8 @@ testSkipIfWindows("select component next.js", async ({ po }) => {
await po.navigation.goToHubAndSelectTemplate("Next.js Template");
await po.chatActions.selectChatMode("build");
await po.sendPrompt("tc=basic");
// Next.js apps take longer to build on the first prompt, use LONG timeout
await po.sendPrompt("tc=basic", { timeout: Timeout.LONG });
await po.previewPanel.clickTogglePreviewPanel();
// Wait for the preview iframe to be visible before interacting
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论