• wwwillchen-bot's avatar
    feat: enable parallel Playwright e2e test execution (#2547) · 70c010af
    wwwillchen-bot 提交于
    ## Summary
    - Skip the Electron singleton lock for E2E test builds to allow multiple
    app instances to run concurrently
    - Update Playwright config to use 2 workers for parallel test execution
    
    ## Performance Impact
    With parallelism of 2, tests should complete approximately **~1.6-1.8x
    faster** (not a perfect 2x due to overhead and some sequential test
    dependencies). The speedup comes from:
    - Two Electron app instances can now run simultaneously during E2E tests
    - Previously, the singleton lock (`app.requestSingleInstanceLock()`)
    would cause second instances to quit immediately
    
    ## Implementation Details
    - Modified `src/main.ts` to check `IS_TEST_BUILD` and skip the singleton
    lock for e2e test builds
    - Changed `playwright.config.ts` from `workers: 1` to `workers: 2`
    
    ## Test plan
    - [ ] Run `npm run build` to ensure the e2e build compiles correctly
    - [ ] Run `npx playwright test` to verify tests pass with parallel
    execution
    - [ ] Verify no race conditions occur when multiple app instances run
    simultaneously
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2547"
    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
    Enable parallel Playwright E2E tests by skipping Electron’s
    single-instance lock in test builds and reading worker count from
    PLAYWRIGHT_PARALLELISM. CI sets 3 workers on self-hosted macOS (1
    elsewhere), keeping single-instance behavior in production.
    
    - **Bug Fixes**
    - Prevent crash in second-instance handler when no deep link URL;
    clarify deep link handling for test builds.
    
    <sup>Written for commit 0f542e189f5b17cc857acc9ad07955c47a0049f1.
    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>
    70c010af
main.ts 17.6 KB