test: complete P4.1 LM Studio coverage and fix auto/wizard handoff
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,42 @@ async function skipOnboarding(page: Page): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function ensureChapterEditor(page: Page): Promise<void> {
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
await expect(page.locator('.ProseMirror')).toBeVisible({ timeout: 10_000 })
|
||||
}
|
||||
|
||||
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 })
|
||||
await ensureChapterEditor(page)
|
||||
const editor = page.locator('.ProseMirror')
|
||||
await editor.click()
|
||||
await editor.pressSequentially('林远站在演武场中央,众人目光汇聚。')
|
||||
await page.keyboard.press('Control+s')
|
||||
await expect(page.getByText('已保存')).toBeVisible({ timeout: 15_000 })
|
||||
}
|
||||
|
||||
async function openWizardPanel(page: Page): Promise<void> {
|
||||
await page.getByTestId('panel-tab-ai').click()
|
||||
await page.getByTestId('ai-session-new').click()
|
||||
await expect(page.getByTestId('ai-mode-tab-wizard')).toBeEnabled({ timeout: 10_000 })
|
||||
await page.getByTestId('ai-mode-tab-wizard').click()
|
||||
await expect(page.getByTestId('wizard-panel')).toBeVisible({ timeout: 10_000 })
|
||||
}
|
||||
|
||||
async function confirmWizardContext(page: Page): Promise<void> {
|
||||
await page.getByTestId('wizard-context-edit').click()
|
||||
await expect(page.getByTestId('context-editor-modal')).toBeVisible({ timeout: 10_000 })
|
||||
await page.getByTestId('context-tab-chapter').click()
|
||||
await page.locator('[data-testid^="context-item-"]').first().check()
|
||||
await page.getByTestId('context-refresh').click()
|
||||
await page.getByTestId('context-save').click()
|
||||
await expect(page.getByTestId('wizard-preview')).toBeVisible({ timeout: 15_000 })
|
||||
}
|
||||
|
||||
test.describe('Wizard writing', () => {
|
||||
let userDataDir: string
|
||||
|
||||
@@ -49,4 +85,42 @@ test.describe('Wizard writing', () => {
|
||||
await expect(page.getByTestId('ai-mode-tab-wizard')).toBeDisabled({ timeout: 10_000 })
|
||||
await app.close()
|
||||
})
|
||||
|
||||
test('E2E-WIZ-01: wizard flow reaches interactive panel', async () => {
|
||||
test.setTimeout(600_000)
|
||||
const app = await launchApp(userDataDir)
|
||||
const page = await app.firstWindow()
|
||||
await skipOnboarding(page)
|
||||
await openBookWithContent(page)
|
||||
await openWizardPanel(page)
|
||||
|
||||
await page.getByTestId('wizard-goal-input').fill('林远通过入门考核,展现天赋震惊众人')
|
||||
await page.getByRole('button', { name: '下一步' }).click()
|
||||
|
||||
await page.getByTestId('wizard-rhythm-mixed').click()
|
||||
await page.getByRole('button', { name: '下一步' }).click()
|
||||
|
||||
await page.getByRole('button', { name: '下一步' }).click()
|
||||
|
||||
await confirmWizardContext(page)
|
||||
|
||||
await page.getByRole('button', { name: '刷新预览' }).click()
|
||||
await expect(page.getByTestId('wizard-preview')).not.toContainText('…', { timeout: 240_000 })
|
||||
|
||||
await page.getByTestId('wizard-start-generate').click()
|
||||
await expect(page.getByTestId('ai-mode-tab-interactive')).toHaveClass(/active/, { timeout: 360_000 })
|
||||
|
||||
const acceptBtn = page.getByTestId('interactive-accept-scene')
|
||||
const plotA = page.getByTestId('plot-option-A')
|
||||
const naming0 = page.getByTestId('naming-option-0')
|
||||
await expect(acceptBtn.or(plotA).or(naming0)).toBeVisible({ timeout: 120_000 })
|
||||
|
||||
if (await naming0.isVisible()) {
|
||||
await naming0.click()
|
||||
}
|
||||
|
||||
await expect(page.getByTestId('interactive-panel')).toBeVisible({ timeout: 30_000 })
|
||||
await expect(acceptBtn.or(plotA)).toBeVisible({ timeout: 120_000 })
|
||||
await app.close()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user