fix(test): stabilize E2E cockpit flow and add LM Studio novel integration test
Harden cockpit dismiss timing and global settings navigation in E2E helpers, tune short-chapter AI prompts for local models, fix electron-updater CJS loading, and add a 10-chapter auto-writing integration test against LM Studio. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
import { createRequire } from 'node:module'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import electronUpdater from 'electron-updater'
|
||||
import type { AppUpdater } from 'electron-updater'
|
||||
import { IPC } from '../../shared/ipc-channels'
|
||||
|
||||
const { autoUpdater } = electronUpdater
|
||||
const require = createRequire(import.meta.url)
|
||||
let autoUpdaterRef: AppUpdater | null = null
|
||||
|
||||
function getAutoUpdater(): AppUpdater {
|
||||
if (!autoUpdaterRef) {
|
||||
const electronUpdater = require('electron-updater') as { autoUpdater: AppUpdater }
|
||||
autoUpdaterRef = electronUpdater.autoUpdater
|
||||
}
|
||||
return autoUpdaterRef
|
||||
}
|
||||
|
||||
export interface UpdateInfoPayload {
|
||||
version: string
|
||||
@@ -31,6 +41,7 @@ export class UpdateService {
|
||||
!app.isPackaged ||
|
||||
process.env.NODE_ENV === 'development'
|
||||
|
||||
const autoUpdater = getAutoUpdater()
|
||||
autoUpdater.autoDownload = false
|
||||
autoUpdater.autoInstallOnAppQuit = true
|
||||
|
||||
@@ -62,7 +73,7 @@ export class UpdateService {
|
||||
this.broadcast(IPC.UPDATE_AVAILABLE, payload)
|
||||
return payload
|
||||
}
|
||||
const result = await autoUpdater.checkForUpdates()
|
||||
const result = await getAutoUpdater().checkForUpdates()
|
||||
const info = result?.updateInfo
|
||||
if (!info) return null
|
||||
return {
|
||||
@@ -78,12 +89,12 @@ export class UpdateService {
|
||||
this.broadcast(IPC.UPDATE_DOWNLOADED, { version: this.mockVersion })
|
||||
return
|
||||
}
|
||||
await autoUpdater.downloadUpdate()
|
||||
await getAutoUpdater().downloadUpdate()
|
||||
}
|
||||
|
||||
install(): void {
|
||||
if (this.disabled || this.mockVersion) return
|
||||
autoUpdater.quitAndInstall()
|
||||
getAutoUpdater().quitAndInstall()
|
||||
}
|
||||
|
||||
private broadcast(channel: string, payload: unknown): void {
|
||||
|
||||
Reference in New Issue
Block a user