Unverified 提交 6791964a authored 作者: wwwillchen-bot's avatar wwwillchen-bot 提交者: GitHub

fix(e2e): improve setup flow test reliability for Node.js detection (#2996)

## Summary - Use `dispatchEvent("click")` instead of `force: true` click to bypass telemetry consent overlay issues in the setup flow e2e test - Add `toPass` retry logic to handle accordion auto-collapse state transitions after Node.js is detected as installed - Dismiss telemetry consent "Later" button if visible before proceeding with test steps ## Test plan - Run the setup flow e2e test (`setup_flow.spec.ts`) and verify it passes reliably without flaking on the Node.js installation detection step - Verify the test correctly handles the accordion collapsing after Node.js is detected 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2996" 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 <noreply@anthropic.com>
上级 1a290028
......@@ -83,13 +83,32 @@ testSetup.describe("Setup Flow", () => {
// Simulate user having installed Node.js
await po.setNodeMock(true);
// Click the continue button (use force to avoid accordion overlap issues)
await continueButton.click({ force: true });
// Dismiss telemetry consent if it overlaps the continue button
const laterButton = po.page.getByRole("button", { name: "Later" });
if (await laterButton.isVisible({ timeout: 1000 }).catch(() => false)) {
await laterButton.click();
}
// Node.js should now show as installed
await expect(
po.page.getByText(/Node\.js \(v[\d.]+\) installed/),
).toBeVisible();
// Click the continue button using dispatchEvent to reliably trigger
// the React onClick handler regardless of overlapping elements or
// accordion positioning issues.
await continueButton.dispatchEvent("click");
// After clicking continue, the app calls reloadEnvPath + getNodejsStatus.
// When Node.js is detected as installed, the accordion auto-collapses.
// Use toPass to handle accordion state transitions and re-expand to verify.
await expect(async () => {
const nodeTrigger = po.page.getByRole("button", {
name: "1. Install Node.js (App Runtime)",
});
const isExpanded = await nodeTrigger.getAttribute("aria-expanded");
if (isExpanded === "false") {
await nodeTrigger.click();
}
await expect(
po.page.getByText(/Node\.js \(v[\d.]+\) installed/),
).toBeVisible();
}).toPass({ timeout: Timeout.MEDIUM });
// Reset mock
await po.setNodeMock(null);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论