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:
@@ -28,9 +28,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 */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +46,7 @@ async function createAndOpenBook(page: Page, name: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function ensureChapterEditor(page: Page): Promise<void> {
|
||||
await dismissCockpitIfOpen(page)
|
||||
const items = page.locator('.chapter-item')
|
||||
if ((await items.count()) === 0) {
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
@@ -104,9 +108,11 @@ test.describe('Writing analytics P9', () => {
|
||||
await page.getByTestId('setting-name-input').fill('主角视角')
|
||||
await page.locator('.dialog-content select').selectOption('character')
|
||||
await page.getByRole('button', { name: '创建' }).click()
|
||||
await expect(page.getByText('主角视角')).toBeVisible({ timeout: 10_000 })
|
||||
await expect(page.getByTestId(/setting-item-/).filter({ hasText: '主角视角' })).toBeVisible({
|
||||
timeout: 10_000
|
||||
})
|
||||
|
||||
await page.getByTestId('sidebar-tab-chapter').click()
|
||||
await page.getByTestId('sidebar-tab-chapters').click()
|
||||
await ensureChapterEditor(page)
|
||||
await page.getByTestId('chapter-pov-select').selectOption({ label: '主角视角' })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user