feat(w5): ship v2.0.0 platform sync, undo persistence, and updates
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { mkdtempSync, rmSync, existsSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { test, expect } from '@playwright/test'
|
||||
import {
|
||||
launchApp,
|
||||
skipOnboarding,
|
||||
createBookAndOpenEditor,
|
||||
ensureChapterEditor,
|
||||
dismissCockpitIfOpen
|
||||
} from './helpers'
|
||||
|
||||
test.describe('Persistent undo', () => {
|
||||
let userDataDir: string
|
||||
|
||||
test.beforeEach(() => {
|
||||
userDataDir = mkdtempSync(join(tmpdir(), 'bilin-e2e-undo-'))
|
||||
})
|
||||
|
||||
test.afterEach(() => {
|
||||
if (userDataDir && existsSync(userDataDir)) {
|
||||
try {
|
||||
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('E2E-UNDO-01: ctrl+z after reopen restores previous content', async () => {
|
||||
const app = await launchApp(userDataDir)
|
||||
const page = await app.firstWindow()
|
||||
await skipOnboarding(page)
|
||||
await createBookAndOpenEditor(page, '撤销测试书')
|
||||
await dismissCockpitIfOpen(page)
|
||||
await ensureChapterEditor(page)
|
||||
|
||||
const editor = page.locator('.ProseMirror')
|
||||
await editor.click()
|
||||
await editor.pressSequentially('持久化撤销测试')
|
||||
await page.keyboard.press('Control+S')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
await page.getByRole('button', { name: /笔临/ }).click()
|
||||
await expect(page.locator('#home-page')).toBeVisible({ timeout: 15_000 })
|
||||
|
||||
await page.locator('.book-name', { hasText: '撤销测试书' }).click()
|
||||
await expect(page.locator('#editor-layout')).toBeVisible({ timeout: 15_000 })
|
||||
await dismissCockpitIfOpen(page)
|
||||
await ensureChapterEditor(page)
|
||||
await expect(editor).toContainText('持久化撤销测试')
|
||||
|
||||
await editor.click()
|
||||
await page.keyboard.press('Control+Z')
|
||||
await expect(editor).not.toContainText('持久化撤销测试', { timeout: 10_000 })
|
||||
|
||||
await app.close()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user