fix(ui): make chapter bridge manual-only and add release gate
Remove auto chapter-bridge prompt on book/chapter open so users trigger it from the cockpit. Fix AiPanel duplicate import that broke dev builds, and add release smoke tests plus test:release/test:ci scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -136,7 +136,7 @@ test.describe('Cockpit & Knowledge P5', () => {
|
||||
await app.close()
|
||||
})
|
||||
|
||||
test('E2E-BRIDGE-01: new chapter triggers bridge modal', async () => {
|
||||
test('E2E-BRIDGE-01: bridge modal opens from cockpit manually', async () => {
|
||||
const app = await launchApp(userDataDir)
|
||||
const page = await app.firstWindow()
|
||||
await skipOnboarding(page)
|
||||
@@ -150,6 +150,9 @@ test.describe('Cockpit & Knowledge P5', () => {
|
||||
await dismissCockpitIfOpen(page)
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
await dismissCockpitIfOpen(page)
|
||||
await expect(page.locator('[data-testid="bridge-modal"]')).toBeHidden({ timeout: 3000 })
|
||||
await page.locator('[data-testid="topbar-cockpit"]').click()
|
||||
await page.locator('[data-testid="cockpit-bridge-check"]').click()
|
||||
await expect(page.locator('[data-testid="bridge-modal"]')).toBeVisible({ timeout: 10_000 })
|
||||
await expect(page.locator('[data-testid="bridge-previous-tail"]')).toBeVisible({ timeout: 60_000 })
|
||||
await expect(page.locator('[data-testid="bridge-previous-tail"]')).not.toHaveText('(无)')
|
||||
@@ -187,6 +190,9 @@ test.describe('Cockpit & Knowledge P5', () => {
|
||||
await dismissCockpitIfOpen(page)
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
await dismissCockpitIfOpen(page)
|
||||
await expect(page.locator('[data-testid="bridge-modal"]')).toBeHidden({ timeout: 3000 })
|
||||
await page.locator('[data-testid="topbar-cockpit"]').click()
|
||||
await page.locator('[data-testid="cockpit-bridge-check"]').click()
|
||||
await expect(page.locator('[data-testid="bridge-modal"]')).toBeVisible({ timeout: 15_000 })
|
||||
await expect(page.locator('[data-testid="bridge-ai-suggestion"]')).not.toBeEmpty({ timeout: 240_000 })
|
||||
await app.close()
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import path from 'path'
|
||||
import { mkdtempSync, rmSync, existsSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { launchApp, skipOnboarding } from './helpers'
|
||||
|
||||
const ROOT = path.join(import.meta.dirname, '..')
|
||||
|
||||
test.describe('Release smoke', () => {
|
||||
let userDataDir: string
|
||||
|
||||
test.beforeEach(() => {
|
||||
userDataDir = mkdtempSync(join(tmpdir(), 'bilin-e2e-release-'))
|
||||
})
|
||||
|
||||
test.afterEach(() => {
|
||||
if (userDataDir && existsSync(userDataDir)) {
|
||||
try {
|
||||
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 })
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('E2E-RELEASE-01: app launches and shows home after onboarding skip', async () => {
|
||||
const app = await launchApp(userDataDir)
|
||||
const page = await app.firstWindow()
|
||||
await skipOnboarding(page)
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 20_000 })
|
||||
await expect(page.getByRole('button', { name: /新建书籍/ }).first()).toBeVisible({
|
||||
timeout: 10_000
|
||||
})
|
||||
await app.close()
|
||||
})
|
||||
|
||||
test('E2E-RELEASE-02: create book opens editor without cockpit blocking', async () => {
|
||||
const app = await launchApp(userDataDir)
|
||||
const page = await app.firstWindow()
|
||||
await skipOnboarding(page)
|
||||
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 })
|
||||
const cockpit = page.locator('[data-testid="cockpit-modal"]')
|
||||
if (await cockpit.isVisible({ timeout: 5000 }).catch(() => false)) {
|
||||
await cockpit.locator('.modal-close').click()
|
||||
await expect(cockpit).toBeHidden({ timeout: 5000 })
|
||||
}
|
||||
await page.getByRole('button', { name: '+ 新章' }).click()
|
||||
await expect(page.locator('.ProseMirror')).toBeVisible({ timeout: 10_000 })
|
||||
await app.close()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user