• wwwillchen-bot's avatar
    refactor: modularize e2e test helpers into separate modules (#2556) · b2bf3bed
    wwwillchen-bot 提交于
    ## Summary
    - Split the monolithic `test_helper.ts` (~1700 lines) into focused
    modules for better maintainability
    - Created `constants.ts` for timeout constants
    - Created `fixtures.ts` for Playwright fixtures and test setup
    - Created `utils/` directory for utility functions (normalization,
    dump-prettifier)
    - Created `page-objects/` directory with component and dialog page
    objects
    
    ## Test plan
    - [x] All existing unit tests pass (784 tests)
    - [x] Lint and type checks pass
    - [ ] E2E tests should work with the refactored helpers (imports are
    re-exported from test_helper.ts for backward compatibility)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2556"
    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
    Refactored e2e test helpers into modular page objects, fixtures, and
    utilities for easier maintenance and more deterministic snapshots. Added
    loop guards to prevent hangs in toast dismissal and the Context Files
    Picker; existing tests keep working via re-exports.
    
    - **Refactors**
    - Split test_helper.ts into constants.ts, fixtures.ts, utils/, and
    page-objects/ (components + dialogs); added a main PageObject that
    composes component page objects.
    - Introduced normalization and dump-prettifier utilities for stable
    snapshots.
    - Centralized CI-aware timeouts in constants.ts; added optional debug
    logging flag.
      - Kept test_helper.ts as a thin re-export for backward compatibility.
    - Updated TypeScript strict-mode docs with ES2020 target limitations on
    replaceAll.
    
    - **Bug Fixes**
      - Fixed importApp path resolution to use __dirname three levels up.
    - Switched git config calls to execFileSync to avoid command injection.
    - Corrected toast dismissal loop to click the first toast repeatedly
    until none remain; added maxAttempts=20 guard (and in Context Files
    Picker) to prevent hangs.
    - Derived the app executable name from appInfo instead of hardcoding
    dyad.exe.
    
    <sup>Written for commit 26329e6b1866fd31e1cba91e0b641fc04df30e8a.
    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>
    Co-authored-by: 's avatarclaude[bot] <41898282+claude[bot]@users.noreply.github.com>
    b2bf3bed