Commit Graph

2 Commits

Author SHA1 Message Date
fullex
aff9b934b4 refactor(main): migrate quick window into WindowManager
- Register QuickAssistant in windowRegistry (singleton, show:false,
  showInDock:false, macReapplyAlwaysOnTop quirk). QuickAssistantService
  now creates the BrowserWindow via wm.create() and sets up listeners
  directly after creation; no global onWindowCreated subscription needed
  since we own the window.
- Instantiate windowStateKeeper before wm.create() and inject persisted
  x/y/w/h via OpenWindowArgs.options. manage() only attaches outbound
  listeners and does not retroactively apply persisted bounds.
- Set the initial alwaysOnTop level once after creation; the
  macReapplyAlwaysOnTop quirk handles re-application across hide/show.
- closeQuickWindow now hides instead of destroying. Quick window is a
  high-frequency toggle; destroy+recreate would blank-flash on next show
  and waste preload work. Final teardown stays in WindowManager.onDestroy.
- Rename WindowType.Mini -> QuickAssistant, IpcChannel.MiniWindow_* ->
  QuickAssistant_*, IpcChannel.ShowMiniWindow -> QuickAssistant_Shown,
  preload window.api.miniWindow -> quickAssistant, log window source
  'MiniWindow' -> 'QuickAssistant'. Drop dead QuickAssistant_Hidden IPC
  (no listener exists anywhere in the tree).
- Cross-process contracts retained: miniWindow.html entry and
  miniWindow-state.json bounds file are kept verbatim to avoid a build
  layout change and to preserve every user's saved window bounds.
- Update renderer call sites (HomeWindow, QuickAssistantSettings,
  entryPoint) and an e2e fixture comment to the new namespace.
2026-04-18 05:50:12 -07:00
fullex
d0bd10190d feat(test): e2e framework (#11494)
* feat(test): e2e framework

Add Playwright-based e2e testing framework for Electron app with:
- Custom fixtures for electronApp and mainWindow
- Page Object Model (POM) pattern implementation
- 15 example test cases covering app launch, navigation, settings, and chat
- Comprehensive README for humans and AI assistants

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(tests): update imports and improve code readability

- Changed imports from 'import { Page, Locator }' to 'import type { Locator, Page }' for better type clarity across multiple page files.
- Reformatted waitFor calls in ChatPage and HomePage for improved readability.
- Updated index.ts to correct the export order of ChatPage and SidebarPage.
- Minor adjustments in electron.fixture.ts and electron-app.ts for consistency in import statements.

These changes enhance the maintainability and clarity of the test codebase.

* chore: update linting configuration to include tests directory

- Added 'tests/**' to the ignore patterns in .oxlintrc.json and eslint.config.mjs to ensure test files are not linted.
- Minor adjustment in electron.fixture.ts to improve the fixture definition.

These changes streamline the linting process and enhance code organization.

* fix(test): select main window by title to fix flaky e2e tests on Mac

On Mac, the app may create miniWindow for QuickAssistant alongside mainWindow.
Using firstWindow() could randomly select the wrong window, causing test failures.
Now we wait for the window with title "Cherry Studio" to ensure we get the main window.

Also removed unused electron-app.ts utility file.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-27 19:52:31 +08:00