adf877861d
Implement chapter templates, txt/md/docx import, submission export presets, and global inspiration shortcut. Split import handlers into a separate main bundle and fix EditorLayout setTarget loop that broke E2E. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { mkdtempSync, rmSync, existsSync } from 'fs'
|
|
import { join } from 'path'
|
|
import { tmpdir } from 'os'
|
|
import { test, expect } from '@playwright/test'
|
|
import {
|
|
launchApp,
|
|
skipOnboarding,
|
|
createBookAndOpenEditor,
|
|
openInspirationModal
|
|
} from './helpers'
|
|
|
|
test.describe('Inspiration capture', () => {
|
|
let userDataDir: string
|
|
|
|
test.beforeEach(() => {
|
|
userDataDir = mkdtempSync(join(tmpdir(), 'bilin-e2e-insp-'))
|
|
})
|
|
|
|
test.afterEach(() => {
|
|
if (userDataDir && existsSync(userDataDir)) {
|
|
try {
|
|
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 })
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
})
|
|
|
|
test('E2E-INSP-01: home Ctrl+Shift+I saves idea with toast, stays on home', async () => {
|
|
const app = await launchApp(userDataDir)
|
|
const page = await app.firstWindow()
|
|
await skipOnboarding(page)
|
|
await createBookAndOpenEditor(page, '灵感测试书')
|
|
await page.locator('.tab.active').locator('span').last().click()
|
|
await expect(page.locator('#home-page')).toBeVisible({ timeout: 10_000 })
|
|
|
|
await openInspirationModal(page)
|
|
await page.getByTestId('inspiration-content-input').fill('主页捕获的灵感内容')
|
|
await page.getByTestId('inspiration-save-btn').click()
|
|
await expect(page.getByText('灵感已保存')).toBeVisible({ timeout: 10_000 })
|
|
await expect(page.locator('#home-page')).toBeVisible()
|
|
|
|
await app.close()
|
|
})
|
|
})
|