Skip to content

feat: framework modernization (phases A-F)#51

Open
danbao wants to merge 4 commits intomainfrom
feat/framework-modernization
Open

feat: framework modernization (phases A-F)#51
danbao wants to merge 4 commits intomainfrom
feat/framework-modernization

Conversation

@danbao
Copy link
Copy Markdown
Owner

@danbao danbao commented Mar 1, 2026

Phase A - Foundational fixes:

  • Remove dead ts-node dependency from e2e-test-app
  • Replace bytes package with inline formatBytes utility
  • Fix chai phantom dependencies in web-application and core/types
  • Add exports field to timeout-config package.json
  • Fix init command template (vitest -> ringai API)
  • Convert eslint.config.js to ESM (eslint.config.mjs)

Phase B - Playwright migration:

  • Migrate all deprecated APIs: page.$()/$$() -> locator(), waitForSelector() -> locator().waitFor()
  • Upgrade Playwright ^1.48 -> ^1.58 across 3 packages
  • Remove deprecated devtools option from example config

Phase C - Core library upgrades:

  • TypeScript 5.6.3 -> 5.9.3, typescript-eslint 8.56 -> 8.33
  • nanoid 3 -> 5, p-limit 3 -> 7, citty ^0.1.6 -> ^0.2.1
  • chai 4 -> 5 (remove @types/chai, chai 5 ships own types)
  • Fix hookable private _hooks access with internal Set tracking

Phase D - Reporter system integration:

  • Create TestResultCollector adapter bridging TestRunController hooks to ReporterManager events
  • Wire ReporterManager into runCommand.ts
  • Implement AI JSON reporter (ai-json) with error categorization, flaky detection, environment metadata

Phase E - Playwright new features (RPC-compatible):

  • Add storageState with IndexedDB support
  • Add emulateMedia with contrast option
  • Add CDP connectOverCDP with cdpEndpoint/cdpIsLocal config

Phase F - Code quality:

  • Translate all Chinese comments to English across 10 files
  • Clean up any casts: type BrowserClientItem properly, remove unnecessary (browser as any).isConnected

Made-with: Cursor

danbao added 2 commits March 1, 2026 10:06
Phase A - Foundational fixes:
- Remove dead ts-node dependency from e2e-test-app
- Replace bytes package with inline formatBytes utility
- Fix chai phantom dependencies in web-application and core/types
- Add exports field to timeout-config package.json
- Fix init command template (vitest -> ringai API)
- Convert eslint.config.js to ESM (eslint.config.mjs)

Phase B - Playwright migration:
- Migrate all deprecated APIs: page.$()/$$() -> locator(),
  waitForSelector() -> locator().waitFor()
- Upgrade Playwright ^1.48 -> ^1.58 across 3 packages
- Remove deprecated devtools option from example config

Phase C - Core library upgrades:
- TypeScript 5.6.3 -> 5.9.3, typescript-eslint 8.56 -> 8.33
- nanoid 3 -> 5, p-limit 3 -> 7, citty ^0.1.6 -> ^0.2.1
- chai 4 -> 5 (remove @types/chai, chai 5 ships own types)
- Fix hookable private _hooks access with internal Set tracking

Phase D - Reporter system integration:
- Create TestResultCollector adapter bridging TestRunController
  hooks to ReporterManager events
- Wire ReporterManager into runCommand.ts
- Implement AI JSON reporter (ai-json) with error categorization,
  flaky detection, environment metadata

Phase E - Playwright new features (RPC-compatible):
- Add storageState with IndexedDB support
- Add emulateMedia with contrast option
- Add CDP connectOverCDP with cdpEndpoint/cdpIsLocal config

Phase F - Code quality:
- Translate all Chinese comments to English across 10 files
- Clean up any casts: type BrowserClientItem properly,
  remove unnecessary (browser as any).isConnected

Made-with: Cursor
Update typescript-eslint 8.33.0 -> 8.56.1 to resolve unmet peer
dependency with TypeScript 5.9.3 (8.33.0 required <5.9.0).

Made-with: Cursor
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 1, 2026

Greptile Summary

This PR modernizes the ringai testing framework across six coordinated phases. Phase A removes dead dependencies (ts-node, bytes package) and fixes configuration issues (init command template, ESM eslint config, exports field). Phase B migrates all Playwright APIs from deprecated page.$(), page.$$(), and waitForSelector() to modern locator() API and upgrades Playwright ^1.48 → ^1.58. Phase C upgrades core dependencies (TypeScript 5.6.3 → 5.9.3, chai 4 → 5, nanoid 3 → 5, citty 0.1.6 → 0.2.1) and fixes hookable library's private API access using internal Set tracking. Phase D introduces a new reporter system with TestResultCollector bridging TestRunController hooks to ReporterManager, plus an AI JSON reporter featuring error categorization and flaky test detection. Phase E adds RPC-compatible Playwright features: CDP connectOverCDP support, storageState with IndexedDB, and emulateMedia with contrast option. Phase F translates all Chinese comments to English and removes unnecessary type casts.

Key improvements:

  • Eliminated phantom dependencies and reduced bundle size
  • Migrated to stable Playwright 1.58 APIs (deprecated APIs removed)
  • New AI-optimized reporter for automated test analysis
  • Enhanced browser automation with CDP and modern Playwright features

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk after verifying two minor version concerns
  • Score reflects comprehensive modernization with good architectural decisions (hookable fix, reporter bridge pattern, locator migration). Two non-critical items need verification: typescript-eslint version appears downgraded (8.56→8.33) and connectOverCDP may have redundant wsEndpoint parameter. The changes are well-structured across logical phases, dependency upgrades are appropriate, and new features (reporter system, CDP support) are properly integrated
  • package.json (verify typescript-eslint version), packages/plugin-playwright-driver/src/plugin/index.ts (verify CDP connection pattern)

Important Files Changed

Filename Overview
package.json Upgraded TypeScript (5.6.3 → 5.9.3), chai (4 → 5), citty (0.1.6 → 0.2.1); typescript-eslint downgraded (8.56 → 8.33) - verify this is intentional
core/cli/src/commands/initCommand.ts Fixed init command template to use ringai API instead of vitest syntax
core/pluggable-module/src/pluggable-module.ts Fixed hookable private _hooks access by using internal Set tracking for registered hook names
core/reporter/src/test-result-collector.ts Added TestResultCollector adapter to bridge TestRunController hooks to ReporterManager events
core/reporter/src/reporters/ai-json-reporter.ts Implemented AI JSON reporter with error categorization, flaky detection, and environment metadata
core/cli/src/commands/runCommand.ts Integrated ReporterManager and TestResultCollector into test run command
packages/plugin-playwright-driver/src/plugin/index.ts Migrated to Playwright 1.58 locator() API, added CDP connectOverCDP support, storageState/emulateMedia features; wsEndpoint redundancy in connectOverCDP call
packages/web-application/src/web-application.ts Added storageState and emulateMedia methods with proper step logging

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[RunCommand.run] --> B[Create TestRunController]
    A --> C[Create ReporterManager]
    C --> D[Initialize Reporters<br/>ai-json, spec, etc.]
    A --> E[Create TestResultCollector]
    E --> F[Register Hooks with<br/>TestRunController]
    
    B --> G[Test Execution Starts]
    G --> H[beforeRun Hook]
    H --> I[ReporterManager.start]
    
    G --> J[Test Loop]
    J --> K[beforeTest Hook]
    K --> L[Record Start Time]
    
    J --> M[Test Execution]
    M --> N[afterTest Hook]
    N --> O{Test Result}
    O -->|Pass| P[Build TestResult<br/>status: passed]
    O -->|Fail| Q[Build TestResult<br/>status: failed<br/>+ error details]
    
    P --> R[ReporterManager.testPass]
    Q --> S[ReporterManager.testFail]
    
    R --> T[AI Reporter:<br/>Categorize & Store]
    S --> T
    
    J --> U[afterRun Hook]
    U --> V[ReporterManager.end]
    V --> W[AI Reporter:<br/>Generate JSON Report<br/>with metadata]
    
    W --> X[Output Report<br/>with error categories,<br/>flaky detection,<br/>environment data]
    
    style C fill:#e1f5ff
    style E fill:#e1f5ff
    style T fill:#fff4e1
    style W fill:#fff4e1
    style X fill:#d4edda
Loading

Last reviewed commit: fbdabfc

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

35 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +122 to +127
if (this.config.cdpEndpoint) {
const cdpOptions: any = { wsEndpoint: this.config.cdpEndpoint };
if (this.config.cdpIsLocal !== undefined) {
cdpOptions.isLocal = this.config.cdpIsLocal;
}
this.browser = await chromium.connectOverCDP(this.config.cdpEndpoint, cdpOptions);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wsEndpoint in options may be redundant since endpoint is already passed as first parameter. Consider simplifying:

Suggested change
if (this.config.cdpEndpoint) {
const cdpOptions: any = { wsEndpoint: this.config.cdpEndpoint };
if (this.config.cdpIsLocal !== undefined) {
cdpOptions.isLocal = this.config.cdpIsLocal;
}
this.browser = await chromium.connectOverCDP(this.config.cdpEndpoint, cdpOptions);
if (this.config.cdpEndpoint) {
const cdpOptions: any = this.config.cdpIsLocal !== undefined
? { isLocal: this.config.cdpIsLocal }
: {};
this.browser = await chromium.connectOverCDP(this.config.cdpEndpoint, cdpOptions);

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

danbao added 2 commits March 1, 2026 19:48
Update typescript-eslint 8.33.0 -> 8.56.1 to resolve unmet peer
dependency with TypeScript 5.9.3 (8.33.0 required <5.9.0).

Made-with: Cursor
Update typescript-eslint 8.33.0 -> 8.56.1 to resolve unmet peer
dependency with TypeScript 5.9.3 (8.33.0 required <5.9.0).

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant