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:
2026-07-09 14:03:19 +08:00
parent fe421ffc55
commit 8e5045b882
24 changed files with 425 additions and 70 deletions
+11 -6
View File
@@ -27,9 +27,12 @@ async function skipOnboarding(page: Page): Promise<void> {
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 */
}
}
@@ -64,9 +67,10 @@ test.describe('Writing logs P5.2', () => {
await skipOnboarding(page)
await createAndOpenBook(page, '日志测试书')
await page.getByRole('button', { name: '设置' }).click()
await page.getByTestId('topbar-settings').click()
await expect(page.locator('#settings-page')).toBeVisible({ timeout: 10_000 })
await page.locator('[data-testid="settings-daily-word-goal"]').fill('100')
await page.getByRole('button', { name: '书' }).click()
await page.getByRole('button', { name: '日志测试书' }).click()
const items = page.locator('.chapter-item')
if ((await items.count()) === 0) {
@@ -92,9 +96,10 @@ test.describe('Writing logs P5.2', () => {
await skipOnboarding(page)
await createAndOpenBook(page, '状态栏测试')
await page.getByRole('button', { name: '设置' }).click()
await page.getByTestId('topbar-settings').click()
await expect(page.locator('#settings-page')).toBeVisible({ timeout: 10_000 })
await page.locator('[data-testid="settings-daily-word-goal"]').fill('500')
await page.getByRole('button', { name: '书籍' }).click()
await page.getByRole('button', { name: '状态栏测试' }).click()
const items = page.locator('.chapter-item')
if ((await items.count()) === 0) {