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

feat: make Playwright retries configurable via env var (#2558)

## Summary - Add PLAYWRIGHT_RETRIES env var support to allow different retry counts for different CI environments - Self-hosted macOS runners now use 1 retry (more reliable hardware) while GitHub-hosted runners use 2 retries - Refactors playwright.config.ts to read retries from environment variable with sensible defaults ## Test plan - Verify CI workflow sets PLAYWRIGHT_RETRIES appropriately for self-hosted vs GitHub-hosted runners - Run `npm test` to ensure all unit tests pass - E2E tests should respect the new retry configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2558" 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 --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Make Playwright retries configurable via the PLAYWRIGHT_RETRIES env var to tune test stability across environments. Self-hosted macOS runners use 1 retry; GitHub-hosted runners use 2 (local stays 0 unless set). - **New Features** - Added PLAYWRIGHT_RETRIES with sensible defaults (CI 2, local 0). - CI sets retries per runner type: 1 for self-hosted macOS, 2 for GitHub-hosted. <sup>Written for commit 896a3dbcbb8278d5cedfbd27088466d780d05fd2. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> Co-authored-by: 's avatarWill Chen <willchen90@gmail.com> Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
上级 fee46806
...@@ -295,6 +295,8 @@ jobs: ...@@ -295,6 +295,8 @@ jobs:
FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }} FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }}
# Self-hosted macOS runners can handle more parallelism # Self-hosted macOS runners can handle more parallelism
PLAYWRIGHT_PARALLELISM: ${{ contains(matrix.os.image, 'self-hosted') && '3' || '1' }} PLAYWRIGHT_PARALLELISM: ${{ contains(matrix.os.image, 'self-hosted') && '3' || '1' }}
# Self-hosted macOS runners use fewer retries (1) vs GitHub-hosted CI (2)
PLAYWRIGHT_RETRIES: ${{ contains(matrix.os.image, 'self-hosted') && '1' || '2' }}
# You can add debug logging to make it easier to see what's failing # You can add debug logging to make it easier to see what's failing
# by adding "DEBUG=pw:browser" in front. # by adding "DEBUG=pw:browser" in front.
# Use blob reporter for sharding and merge capabilities # Use blob reporter for sharding and merge capabilities
......
...@@ -8,7 +8,10 @@ const config: PlaywrightTestConfig = { ...@@ -8,7 +8,10 @@ const config: PlaywrightTestConfig = {
// Enable parallel test execution - E2E test builds skip the singleton lock // Enable parallel test execution - E2E test builds skip the singleton lock
// Read parallelism from env var, default to 1 if not set // Read parallelism from env var, default to 1 if not set
workers: parseInt(process.env.PLAYWRIGHT_PARALLELISM || "1", 10), workers: parseInt(process.env.PLAYWRIGHT_PARALLELISM || "1", 10),
retries: process.env.CI ? 2 : 0, retries: parseInt(
process.env.PLAYWRIGHT_RETRIES ?? (process.env.CI ? "2" : "0"),
10,
),
timeout: process.env.CI ? 180_000 : 75_000, timeout: process.env.CI ? 180_000 : 75_000,
// Use a custom snapshot path template because Playwright's default // Use a custom snapshot path template because Playwright's default
// is platform-specific which isn't necessary for Dyad e2e tests // is platform-specific which isn't necessary for Dyad e2e tests
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论