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:
+11
-2
@@ -23,12 +23,20 @@ export async function skipOnboarding(page: Page): Promise<void> {
|
||||
|
||||
export async function dismissCockpitIfOpen(page: Page): Promise<void> {
|
||||
const cockpit = page.locator('[data-testid="cockpit-modal"]')
|
||||
if (await cockpit.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
await page.locator('[data-testid="cockpit-modal"] .modal-close').click()
|
||||
try {
|
||||
await cockpit.waitFor({ state: 'visible', timeout: 15_000 })
|
||||
await cockpit.locator('.modal-close').click()
|
||||
await expect(cockpit).toBeHidden({ timeout: 5000 })
|
||||
} catch {
|
||||
/* cockpit did not open */
|
||||
}
|
||||
}
|
||||
|
||||
export async function openGlobalSettings(page: Page): Promise<void> {
|
||||
await page.getByTestId('topbar-settings').click()
|
||||
await expect(page.locator('#settings-page')).toBeVisible({ timeout: 10_000 })
|
||||
}
|
||||
|
||||
export async function createBookAndOpenEditor(page: Page, name: string): Promise<void> {
|
||||
await page.getByRole('button', { name: /新建书籍/ }).first().click()
|
||||
await page.locator('.dialog-content input').first().fill(name)
|
||||
@@ -38,6 +46,7 @@ export async function createBookAndOpenEditor(page: Page, name: string): Promise
|
||||
}
|
||||
|
||||
export async function ensureChapterEditor(page: Page): Promise<void> {
|
||||
await dismissCockpitIfOpen(page)
|
||||
const editor = page.locator('.ProseMirror')
|
||||
if (await editor.isVisible().catch(() => false)) return
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
|
||||
Reference in New Issue
Block a user