feat(w3): ship v1.4.0 export matrix, cockpit tasks, and focus ambient

Add ExportMatrixService for txt/md/docx/pdf, extend ExportModal, cockpit outline tasks, focus ambient sound, and E2E-PDF-01 with 134 passing unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-08 16:56:53 +08:00
parent c10be87d18
commit c5c0b7329b
23 changed files with 890 additions and 37 deletions
+58
View File
@@ -0,0 +1,58 @@
import { mkdtempSync, rmSync, existsSync, statSync } from 'fs'
import { join } from 'path'
import { tmpdir } from 'os'
import { test, expect } from '@playwright/test'
import {
launchApp,
skipOnboarding,
createBookAndOpenEditor,
ensureChapterEditor,
openExportModal,
dismissCockpitIfOpen
} from './helpers'
test.describe('Export matrix', () => {
let userDataDir: string
let pdfPath: string
test.beforeEach(() => {
userDataDir = mkdtempSync(join(tmpdir(), 'bilin-e2e-matrix-'))
pdfPath = join(userDataDir, 'chapter.pdf')
})
test.afterEach(() => {
if (userDataDir && existsSync(userDataDir)) {
try {
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 })
} catch {
/* ignore */
}
}
})
test('E2E-PDF-01: export chapter as PDF', async () => {
const app = await launchApp(userDataDir, { BILIN_E2E_PDF_SAVE: pdfPath })
const page = await app.firstWindow()
await skipOnboarding(page)
await createBookAndOpenEditor(page, 'PDF导出测试')
await dismissCockpitIfOpen(page)
await ensureChapterEditor(page)
const editor = page.locator('.ProseMirror')
await editor.click()
await editor.pressSequentially('PDF导出测试正文。')
await page.keyboard.press('Control+S')
await openExportModal(page)
await page.getByTestId('export-kind-select').selectOption('matrix')
await page.getByTestId('export-matrix-format').selectOption('pdf')
await page.getByTestId('export-matrix-scope').selectOption('chapter')
await page.getByTestId('export-matrix-btn').click()
await expect(page.getByText(/已保存|Saved to/)).toBeVisible({ timeout: 30_000 })
expect(existsSync(pdfPath)).toBe(true)
expect(statSync(pdfPath).size).toBeGreaterThan(500)
await app.close()
})
})