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:
@@ -20,15 +20,23 @@ async function skipOnboarding(page: Page): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function dismissCockpitIfOpen(page: Page): Promise<void> {
|
||||
const cockpit = page.locator('[data-testid="cockpit-modal"]')
|
||||
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 */
|
||||
}
|
||||
}
|
||||
|
||||
async function openBookWithContent(page: Page): Promise<void> {
|
||||
await page.getByRole('button', { name: /新建书籍/ }).first().click()
|
||||
await page.locator('.dialog-content input').first().fill('注入历史书')
|
||||
await page.getByRole('button', { name: '创建' }).click()
|
||||
await expect(page.locator('#editor-layout')).toBeVisible({ timeout: 15_000 })
|
||||
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()
|
||||
}
|
||||
await dismissCockpitIfOpen(page)
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
const editor = page.locator('.ProseMirror')
|
||||
await expect(editor).toBeVisible({ timeout: 10_000 })
|
||||
@@ -96,7 +104,8 @@ test.describe('Knowledge injection history P6.1', () => {
|
||||
await page.getByTestId('context-tab-knowledge').click()
|
||||
await page.locator(`[data-testid="context-knowledge-item-${entryId}"] input`).check()
|
||||
await page.getByTestId('context-save').click()
|
||||
await page.getByRole('button', { name: '下一步' }).click()
|
||||
await expect(page.getByTestId('context-editor-modal')).toBeHidden({ timeout: 10_000 })
|
||||
await page.locator('[data-testid="wizard-panel"] button.btn.primary').click()
|
||||
|
||||
await page.locator('[data-testid="panel-tab-knowledge"]').click()
|
||||
await page.locator('[data-testid="knowledge-tab-all"]').click()
|
||||
|
||||
Reference in New Issue
Block a user