feat(short-drama-agent-front): 优化分镜界面并新增弹窗手势

This commit is contained in:
GJ committed 2026-11-18 18:50:15 +08:00
1 parent b15a6011ce
commit d68f03471c
59 files changed
+2694 -857

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>移动弹窗手势隔离验收</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./mobile-panels.ts"></script>
</body>
</html>
+109
View File
@@ -0,0 +1,109 @@
import { createApp, defineComponent, h, ref } from 'vue'
import { NButton, NCheckbox, NConfigProvider, NInput, darkTheme } from 'naive-ui'
import AppDialog from '../../src/components/ui/AppDialog.vue'
import AppDrawer from '../../src/components/ui/AppDrawer.vue'
import '../../src/styles/styles.css'
import '../../src/styles/admin.css'
/** 本页所有请求都拒绝,不连接项目或模型。 */
window.fetch = async () => new Response(JSON.stringify({ message: '隔离验收禁止联网请求' }), { status: 403 })
/** 覆盖手机和桌面超长标题,完整原文仍通过标题提示保留。 */
const longTitle = '标题只占一行,超出宽度显示省略号,并保留完整名称。'.repeat(8)
/** 仅在内存中观察关闭、输入、提交锁和长内容,不保存正式数据。 */
const Preview = defineComponent({
setup() {
/** 普通弹窗开关。 */ const dialog = ref(false)
/** 全屏抽屉开关。 */ const drawer = ref(false)
/** 模拟真实提交锁,不发起任务。 */ const busy = ref(false)
/** 切换普通弹窗长内容。 */ const long = ref(false)
/** 关闭后重新打开仍保留父组件输入。 */ const draft = ref('这段隔离输入关闭后仍保留')
/** 展示真实完成关闭次数。 */ const closed = ref(0)
/**
* 两种公共弹层共用的验证正文。
* @param full 是否默认长内容
* @returns 原生表单及长文
*/
function body(full: boolean) {
return h('div', { class: 'workspace-section-stack' }, [
h('p', '按住顶部横条向下拖动关闭;轻触和短拖保持展开。'),
h(
NCheckbox,
{ checked: busy.value, 'onUpdate:checked': (value: boolean) => (busy.value = value) },
() => '模拟提交中'
),
h(NInput, {
value: draft.value,
'onUpdate:value': (value: string) => (draft.value = value),
'aria-label': '隔离输入'
}),
!full &&
h(
NCheckbox,
{ checked: long.value, 'onUpdate:checked': (value: boolean) => (long.value = value) },
() => '显示长内容'
),
...(full || long.value
? Array.from({ length: 35 }, (_, index) =>
h(
'p',
`段落 ${index + 1}:这是只读测试内容,用于核对正文滚动不会拖动面板,底部关闭按钮保持可见。`
)
)
: [])
])
}
return () =>
h(
NConfigProvider,
{ theme: darkTheme },
{
default: () =>
h('main', { style: 'padding:24px' }, [
h('h1', '手机面板隔离验收'),
h(
'p',
{ style: 'margin:16px 0' },
`真实请求0次 · 关闭完成${closed.value}次 · 普通弹窗${dialog.value ? '已打开' : '已关闭'} · 全屏抽屉${drawer.value ? '已打开' : '已关闭'}`
),
h('div', { class: 'flex flex-wrap gap-3' }, [
h(NButton, { onClick: () => (dialog.value = true) }, () => '打开普通弹窗'),
h(NButton, { onClick: () => (drawer.value = true) }, () => '打开全屏抽屉')
]),
h(
AppDialog,
{
open: dialog.value,
'onUpdate:open': (value: boolean) => (dialog.value = value),
title: `普通弹窗 · ${longTitle}`,
busy: busy.value,
onClosed: () => closed.value++
},
{ default: () => body(false) }
),
h(
AppDrawer,
{
open: drawer.value,
'onUpdate:open': (value: boolean) => (drawer.value = value),
title: `全屏抽屉 · ${longTitle}`,
busy: busy.value,
onClosed: () => closed.value++
},
{
default: () => body(true),
footer: () => [
h(
NButton,
{ disabled: busy.value, onClick: () => (drawer.value = false) },
() => '关闭'
),
h(NButton, { disabled: true, type: 'primary' }, () => '模拟保存')
]
}
)
])
}
)
}
})
createApp(Preview).mount('#app')
+8 -3
View File
@@ -22,14 +22,19 @@ const review = {
)
}
/**
* 只允许免费诊断和只读回读,批准、签收、执行及恢复全部拒绝。
* 只允许免费诊断、布局输入预览和只读回读,批准、签收、执行及恢复全部拒绝。
* @param input 请求地址
* @param init 请求选项
* @returns 隔离响应
*/
window.fetch = async (input, init) => {
const path = String(input)
if (init?.method && init.method !== 'GET' && !path.endsWith('/continuity/diagnosis'))
const path = new URL(String(input), window.location.origin).pathname
if (
init?.method &&
init.method !== 'GET' &&
!path.endsWith('/continuity/diagnosis') &&
!path.endsWith('/keyframe/preview')
)
return new Response(JSON.stringify({ message: '隔离页禁止写入与付费' }), { status: 403 })
let data: unknown
if (path.includes('/vision/preview'))
+5 -1
View File
@@ -58,7 +58,11 @@ describe('管理后台组件边界', () => {
const assetPicker = /\.style-asset-picker\s*\{[^}]*\}/
expect(css.match(assetPicker)?.[0]).toContain('max-height: 280px;')
expect(css.match(assetPicker)?.[0]).toContain('overflow-y: auto;')
expect(css.replace(mobileReading, '').replace(assetPicker, '')).not.toMatch(
/** 图片详情浮层有独立高度上限,不让长错误改变卡片与页面高度。 */
const candidateDetails = /\.keyframe-card-details\s*\{[^}]*\}/
expect(css.match(candidateDetails)?.[0]).toContain('max-height: min(480px, 65dvh);')
expect(css.match(candidateDetails)?.[0]).toContain('overflow-y: auto;')
expect(css.replace(mobileReading, '').replace(assetPicker, '').replace(candidateDetails, '')).not.toMatch(
/overflow(?:-[xy])?\s*:\s*(?:auto|scroll)\b/
)
})
+216
View File
@@ -0,0 +1,216 @@
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { NDrawer } from 'naive-ui'
import MobilePanelHandle from '@/components/ui/MobilePanelHandle.vue'
import AppDialog from '@/components/ui/AppDialog.vue'
import AppDrawer from '@/components/ui/AppDrawer.vue'
/** 当前测试挂载实例,结束后释放监听和计时。 */
let wrapper: VueWrapper | undefined
afterEach(() => {
wrapper?.unmount()
wrapper = undefined
document.body.innerHTML = ''
vi.useRealTimers()
vi.restoreAllMocks()
})
/**
* 明确模拟手机断点及旋转,动画偏好默认正常。
* @param initial 初始是否手机
* @returns 改变断点的方法
*/
function viewport(initial = true) {
let mobile = initial
const listeners = new Set<(event: MediaQueryListEvent) => void>()
vi.spyOn(window, 'matchMedia').mockImplementation(
query =>
({
media: query,
get matches() {
return query === '(max-width: 639px)' && mobile
},
onchange: null,
addEventListener: (_type: string, listener: EventListenerOrEventListenerObject) => {
if (query === '(max-width: 639px)') listeners.add(listener as (event: MediaQueryListEvent) => void)
},
removeEventListener: (_type: string, listener: EventListenerOrEventListenerObject) =>
listeners.delete(listener as (event: MediaQueryListEvent) => void),
addListener: vi.fn<() => void>(),
removeListener: vi.fn<() => void>(),
dispatchEvent: () => true
}) as MediaQueryList
)
return (next: boolean) => {
mobile = next
listeners.forEach(listener => listener({ matches: next } as MediaQueryListEvent))
}
}
/**
* 发送真实指针事件,显式指定时间以验证拖动距离和甩动速度。
* @param node 手柄或正文节点
* @param type 指针阶段
* @param y 当前纵坐标
* @param time 当前毫秒
* @param x 当前横坐标
* @param id 指针身份
*/
function pointer(node: Element, type: string, y: number, time: number, x = 10, id = 1) {
const event = new PointerEvent(type, {
bubbles: true,
cancelable: true,
pointerId: id,
isPrimary: id === 1,
button: 0,
clientX: x,
clientY: y
})
Object.defineProperty(event, 'timeStamp', { value: time })
node.dispatchEvent(event)
}
/** 创建一个真实面板容器,所有手势只作用于最近这一层。 */
function handle() {
viewport()
vi.useFakeTimers()
const panel = document.createElement('div')
panel.className = 'app-mobile-panel'
document.body.append(panel)
vi.spyOn(panel, 'getBoundingClientRect').mockReturnValue({ height: 600 } as DOMRect)
wrapper = mount(MobilePanelHandle, { attachTo: panel, props: { active: true } })
return { panel, grip: wrapper.get('button').element }
}
describe('手机面板手柄关闭', () => {
it('轻触、短拖和横向移动均回位,正文没有拖动关闭监听', async () => {
const { panel, grip } = handle()
pointer(grip, 'pointerdown', 0, 0)
pointer(grip, 'pointerup', 0, 100)
await vi.advanceTimersByTimeAsync(180)
pointer(grip, 'pointerdown', 0, 200)
pointer(grip, 'pointermove', 30, 500)
expect(panel.style.transform).toContain('30px')
pointer(grip, 'pointerup', 30, 800)
grip.dispatchEvent(new MouseEvent('click', { detail: 0, bubbles: true }))
await vi.advanceTimersByTimeAsync(180)
expect(panel.style.transform).toBe('')
pointer(grip, 'pointerdown', 0, 900)
pointer(grip, 'pointerup', 120, 950, 200)
await vi.advanceTimersByTimeAsync(180)
pointer(panel, 'pointerdown', 0, 1000)
pointer(panel, 'pointermove', 300, 1300)
pointer(panel, 'pointerup', 300, 1400)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
})
it.each([
[160, 1000],
[64, 40]
])('明确下拉或快速甩动关闭一次:%s像素/%s毫秒', async (distance, time) => {
const { panel, grip } = handle()
pointer(grip, 'pointerdown', 0, 0)
pointer(grip, 'pointermove', distance, time)
pointer(grip, 'pointerup', distance, time)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toEqual([[]])
expect(panel.hasAttribute('data-drag-dismissed')).toBe(true)
pointer(grip, 'pointerup', distance, time + 1)
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toHaveLength(1)
await wrapper!.setProps({ active: false })
await wrapper!.setProps({ active: true })
expect(panel.style.transform).toBe('')
expect(panel.hasAttribute('data-drag-dismissed')).toBe(false)
})
it.each(['pointercancel', 'lostpointercapture'])('系统取消%s时不关闭', async type => {
const { grip } = handle()
pointer(grip, 'pointerdown', 0, 0)
pointer(grip, 'pointermove', 200, 100)
pointer(grip, type, 200, 110)
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
})
it('拖动中进入提交状态撤销手势,离场动画中加锁也不关闭', async () => {
const { grip } = handle()
pointer(grip, 'pointerdown', 0, 0)
pointer(grip, 'pointermove', 200, 100)
await wrapper!.setProps({ disabled: true })
pointer(grip, 'pointerup', 200, 120)
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
await wrapper!.setProps({ disabled: false })
pointer(grip, 'pointerdown', 0, 500)
pointer(grip, 'pointerup', 200, 600)
await wrapper!.setProps({ disabled: true })
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
})
it('额外触点不能接管主指针,向上拖动不关闭', async () => {
const { panel, grip } = handle()
pointer(grip, 'pointerdown', 100, 0)
pointer(grip, 'pointerdown', 0, 1, 10, 2)
pointer(grip, 'pointermove', 400, 30, 10, 2)
expect(panel.style.transform).toBe('')
pointer(grip, 'pointermove', 40, 100)
pointer(grip, 'pointerup', 40, 200)
await vi.advanceTimersByTimeAsync(180)
expect(wrapper!.emitted('dismiss')).toBeUndefined()
})
it.each([AppDialog, AppDrawer])('公共弹层复用手柄,提交锁与键盘关闭同时生效', async component => {
viewport()
wrapper = mount(component, {
attachTo: document.body,
props: { open: true, title: '隔离弹窗', busy: true },
slots: { default: '<p>原正文保持</p>' }
})
await flushPromises()
const grip = document.querySelector<HTMLButtonElement>('.mobile-panel-handle')!
expect(grip.disabled).toBe(true)
expect(document.querySelector('.app-mobile-panel')?.textContent).toContain('原正文保持')
await wrapper.setProps({ busy: false })
grip.dispatchEvent(new MouseEvent('click', { detail: 0, bubbles: true }))
expect(wrapper.emitted('update:open')?.at(-1)).toEqual([false])
})
it('切回桌面时清除正在拖动的位移,继续沿用原抽屉布局', async () => {
const changeViewport = viewport()
wrapper = mount(AppDrawer, { attachTo: document.body, props: { open: true, title: '隔离抽屉' } })
await flushPromises()
expect(wrapper.getComponent(NDrawer).props('placement')).toBe('bottom')
const grip = document.querySelector('.mobile-panel-handle')!,
panel = document.querySelector<HTMLElement>('.app-mobile-panel')!
pointer(grip, 'pointerdown', 0, 0)
pointer(grip, 'pointermove', 90, 100)
expect(panel.style.transform).toContain('90px')
changeViewport(false)
await flushPromises()
expect(wrapper.getComponent(NDrawer).props('placement')).toBe('right')
expect(document.querySelector('.mobile-panel-handle')).toBeNull()
expect(panel.style.transform).toBe('')
expect(wrapper.emitted('update:open')).toBeUndefined()
})
it.each([AppDialog, AppDrawer])('正文滚动才显示标题阴影,回到顶部和重新打开均清除', async component => {
viewport()
wrapper = mount(component, {
attachTo: document.body,
props: { open: true, title: '滚动阴影' },
slots: { default: '<p>长正文</p>' }
})
await flushPromises()
const frame = document.querySelector<HTMLElement>('.app-mobile-panel')!
const scroll = frame.querySelector<HTMLElement>('.n-scrollbar-container')!
expect(frame.classList.contains('has-body-scroll')).toBe(false)
Object.defineProperty(scroll, 'scrollTop', { value: 80, writable: true })
scroll.dispatchEvent(new Event('scroll'))
await flushPromises()
expect(frame.classList.contains('has-body-scroll')).toBe(true)
scroll.scrollTop = 0
scroll.dispatchEvent(new Event('scroll'))
await flushPromises()
expect(frame.classList.contains('has-body-scroll')).toBe(false)
scroll.scrollTop = 60
scroll.dispatchEvent(new Event('scroll'))
await flushPromises()
await wrapper.setProps({ open: false })
await wrapper.setProps({ open: true })
await flushPromises()
expect(document.querySelector('.app-mobile-panel')?.classList.contains('has-body-scroll')).toBe(false)
})
})
@@ -0,0 +1,96 @@
import { type Component } from 'vue'
import { flushPromises, mount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'
import AppDialog from '@/components/ui/AppDialog.vue'
import AppDrawer from '@/components/ui/AppDrawer.vue'
import WorkspaceSectionHeading from '@/components/ui/WorkspaceSectionHeading.vue'
import FieldLabel from '@/components/ui/FieldLabel.vue'
import ImageGenerationPreview from '@/features/subject-images/components/ImageGenerationPreview.vue'
import { imagePreviewFixture } from '../../fixtures/image-preview'
/** 各种公共标题保持相同的说明入口,动态状态不被隐藏。 */
const cases: Array<{
/** 当前公共布局。 */ component: Component
/** 可访问说明名称。 */ label: string
/** 原布局需要的显隐参数。 */ extra: Record<string, unknown>
}> = [
{ component: AppDialog, label: '操作说明', extra: { open: true } },
{ component: AppDrawer, label: '操作说明', extra: { open: true } },
{ component: WorkspaceSectionHeading, label: '审核范围说明', extra: {} }
]
describe('分镜界面按需显示说明', () => {
it.each(cases)('$label 首屏保留标题,完整说明由用户主动展开', async ({ component, label, extra }) => {
const wrapper = mount(component, {
props: {
...extra,
title: '审核范围',
description: '完整操作说明应能保留并随时核对',
descriptionAsInfo: true
},
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.text()).toContain('审核范围')
expect(wrapper.text()).not.toContain('完整操作说明应能保留')
await wrapper.get(`button[aria-label="${label}"]`).trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('完整操作说明应能保留并随时核对')
} finally {
wrapper.unmount()
}
})
it('动态状态插槽直接显示,不能被静态说明收起选项隐藏', async () => {
const wrapper = mount(AppDialog, {
props: { open: true, title: '原任务', description: '流程说明', descriptionAsInfo: true },
slots: { description: '<p>当前费用未知,请核查原请求</p>' },
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.text()).toContain('当前费用未知,请核查原请求')
expect(wrapper.find('button[aria-label="操作说明"]').exists()).toBe(false)
} finally {
wrapper.unmount()
}
})
it('视觉重点等创作内容原样展示,不被系统术语转换改写', async () => {
const original = 'Prompt 是角色在画面中写下的原始台词'
const wrapper = mount(FieldLabel, {
props: { label: '视觉重点', description: original, iconOnly: true, icon: 'info', verbatim: true },
global: { stubs: { teleport: true } }
})
try {
expect(wrapper.text()).not.toContain(original)
await wrapper.get('button').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain(original)
} finally {
wrapper.unmount()
}
})
it('图片预览先显示参考与主要操作,完整提示词仍可主动核对', async () => {
const original = '必须完整保留的画面描述,'.repeat(30)
const wrapper = mount(ImageGenerationPreview, {
props: {
preview: { ...imagePreviewFixture(), providerPrompt: original },
loading: false,
error: '',
staleNotice: ''
}
})
try {
expect(wrapper.text()).toContain('预览实际生成输入')
expect(wrapper.text()).not.toContain(original)
await wrapper
.findAll('.n-collapse-item__header-main')
.find(row => row.text() === '本次实际使用的画面描述')!
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain(original)
} finally {
wrapper.unmount()
}
})
})
@@ -56,8 +56,8 @@ describe('联合审核单次批准和业务状态', () => {
const w = await open(status)
expect(w.text()).toContain('未知')
expect(w.text()).toContain('空间参考')
expect(w.text()).toContain('s1')
expect(w.text()).toContain('s2')
expect(w.text()).toContain('审核范围第 1 镜')
expect(w.text()).toContain('审核范围第 2 镜')
expect(auth).not.toHaveBeenCalled()
expect(execute).not.toHaveBeenCalled()
expect((w.vm as unknown as { canExecute: boolean }).canExecute).toBeFalsy()
@@ -32,6 +32,7 @@ describe('连续性审核真实组件流程', () => {
props: { open: true, projectId: 'mock-project', shots: continuityShots, disabled: false },
global: {
stubs: {
teleport: true,
AppDrawer: { template: '<div><slot/><slot name="footer"/></div>' },
AssetImage: true,
LayoutSupplementPanel: true
@@ -42,6 +43,9 @@ describe('连续性审核真实组件流程', () => {
expect(mock.calls.every(item => item.method === 'GET')).toBe(true)
await click('免费读取当前证据')
expect(wrapper.text()).toContain('证据不足')
expect(wrapper.text()).not.toContain('开门、关门属于即时状态')
await wrapper.get('button[aria-label="人工观察说明"]').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('开门、关门属于即时状态')
const inputs = wrapper.findAllComponents(NInput)
inputs.find(item => item.props('placeholder') === '固定地标一')!.vm.$emit('update:value', '窗')
@@ -122,6 +126,14 @@ describe('连续性审核真实组件流程', () => {
await flushPromises()
await click('免费预览结构约束')
expect(wrapper.text()).toContain('需要确认布局并重新确认母版')
await wrapper
.findAll('.n-collapse-item__header-main')
.find(item => item.text() === '本次完整布局约束')!
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('固定连接位置')
expect(wrapper.text()).not.toContain(fingerprint)
expect(wrapper.text()).not.toContain('"layoutConfirmation"')
inputs
.find(item => item.props('placeholder') === '待审结构约束,例如固定连接位置与活动方向')!
.vm.$emit('update:value', '修改后的门轴')
@@ -0,0 +1,57 @@
import { flushPromises, mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import KeyframeDialog from '@/features/production/components/KeyframeDialog.vue'
import { billingCatalog, billingProfile, imageAuthorizationsFixture } from '../../fixtures/billing'
describe('首帧生成首屏只展示当前需要的信息', () => {
it('普通有效授权不常驻未知费用提示;出现真实阻断后重新打开才展示人工许可', async () => {
const list = imageAuthorizationsFixture(),
generate = vi.fn<() => Promise<{ accepted: boolean }>>(async () => ({ accepted: true }))
const fetcher = vi.fn<typeof fetch>(async url => {
const path = String(url)
if (path.endsWith('/generation-models')) return Response.json({ data: billingCatalog })
if (path.endsWith('/creative-profile')) return Response.json({ data: billingProfile })
if (path.endsWith('/resolve'))
return Response.json({
data: {
provider: 'openai-image',
model: 'gpt-image-2.5-flare',
options: { size: '1024x1024', quality: 'auto', count: 1 }
}
})
if (path.endsWith('/image-authorizations')) return Response.json({ data: list })
throw new Error('未模拟:' + path)
})
vi.stubGlobal('fetch', fetcher)
const wrapper = mount(KeyframeDialog, {
props: {
projectId: 'clean-density-project',
shotId: 'density-shot',
shotTitle: '当前镜头',
disabled: false,
open: true,
submitGeneration: generate
},
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(false)
expect(wrapper.text()).not.toContain('原请求在途或费用待核对')
expect(wrapper.text()).toContain('预览实际生成输入')
list.billingBlocked = true
await wrapper.setProps({ open: false })
await flushPromises()
await wrapper.setProps({ open: true })
await flushPromises()
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(true)
expect(wrapper.text()).toContain('有限许可不会核清旧费用')
expect(generate).not.toHaveBeenCalled()
expect(
fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/primary|\/vision/.test(String(url)))
).toBe(false)
} finally {
wrapper.unmount()
}
})
})
@@ -2,6 +2,7 @@ import { flushPromises, mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import KeyframeInputDetails from '@/features/production/components/KeyframeInputDetails.vue'
import { historicalReferenceUrl, type HistoricalKeyframeReference } from '@/features/production/keyframe-input'
import { expandSection } from '@/testing/naive'
/** 两种职责对应同一张实际参考图。 */
const reference: HistoricalKeyframeReference = {
@@ -66,6 +67,8 @@ describe('历史首帧输入', () => {
expect(fetcher).not.toHaveBeenCalled()
await wrapper.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
expect(wrapper.text()).not.toContain('当次描述 one')
await expandSection('本次实际使用的画面描述', wrapper.element)
expect(wrapper.text()).toContain('当次描述 one')
expect(wrapper.text()).toContain('原图已变化')
expect(wrapper.text()).toContain('@CH01')
@@ -73,6 +76,8 @@ describe('历史首帧输入', () => {
expect(wrapper.find('img').exists()).toBe(false)
await wrapper.setProps({ keyframeId: 'two' })
await flushPromises()
expect(wrapper.text()).not.toContain('当次描述 two')
await expandSection('本次实际使用的画面描述', wrapper.element)
expect(wrapper.text()).toContain('当次描述 two')
expect(wrapper.text()).not.toContain('当次描述 one')
expect(wrapper.text()).toContain('原图不可用')
+5 -1
View File
@@ -14,6 +14,7 @@ import {
validOptionalSize
} from '@/features/production/model'
import { keyframeFixture, videoFixture } from '@/features/production/testing/fixtures'
import { expandSection } from '@/testing/naive'
let wrapper: VueWrapper | undefined
afterEach(() => {
@@ -59,7 +60,8 @@ describe('镜头生产数据契约', () => {
expect(source).toMatch(
/\.video-input-grid\s*\{[^}]*max-width:\s*calc\(var\(--video-input-count\) \* 220px \+ \(var\(--video-input-count\) - 1\) \* 12px\)/
)
expect(source).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
const keyframeCard = readFileSync('src/features/production/components/KeyframeCard.vue', 'utf8')
expect(keyframeCard).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
const videoCard = readFileSync('src/features/production/components/VideoCard.vue', 'utf8')
expect(videoCard).toContain('class="block aspect-square w-full bg-[#080808] object-contain"')
expect(source).toMatch(/\.video-input-card\s*\{[^}]*bg-\(--app-control\)/)
@@ -359,6 +361,8 @@ describe('镜头生产数据契约', () => {
})
expect(document.body.textContent).toContain('1 张参考图')
expect(document.body.textContent).toContain('未进入模型的参考图')
expect(document.body.textContent).not.toContain('最终首帧 Prompt')
await expandSection('本次实际使用的画面描述')
expect(document.body.textContent).toContain('最终首帧 Prompt')
expect(wrapper.emitted('generate')).toBeUndefined()
})
@@ -272,6 +272,14 @@ it('抽屉使用真实表单,打开只读历史,免费预检逐项展示全
expect(wrapper.text()).toContain('@SC1')
expect(wrapper.text()).toContain('@SC2')
expect(wrapper.text()).not.toContain('登记本次费用批准')
await wrapper
.findAll('.n-collapse-item__header-main')
.find(item => item.text() === '原图片生成记录')!
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('历史描述')
expect(wrapper.text()).not.toContain(hash)
expect(wrapper.find('pre').exists()).toBe(false)
} finally {
wrapper.unmount()
}
@@ -7,9 +7,27 @@ import KeyframeValidationHistory from '@/features/production/components/Keyframe
import { additionalImageFixture } from '../../fixtures/image-additional'
import { AssetImage } from '@/components/ui'
import { keyframeFixture } from '@/features/production/testing/fixtures'
import { keyframeDisplayNames } from '@/features/production/model'
import { imagePreviewFixture } from '../../fixtures/image-preview'
describe('V8-10免费输入与独立门禁', () => {
it('图片名称按原创建时间编号,倒序与主图切换仍使用相同名称', () => {
const old = keyframeFixture({ id: 'old', createdAt: '2026-11-01T00:00:00Z', isPrimary: false }),
recent = keyframeFixture({ id: 'recent', createdAt: '2026-11-02T00:00:00Z', isPrimary: true })
const names = keyframeDisplayNames([recent, old], '午后收整工具', 1)
expect(names.get('old')).toBe('午后收整工具 · 图片 01')
expect(names.get('recent')).toBe('午后收整工具 · 图片 02')
expect(
keyframeDisplayNames(
[
{ ...old, isPrimary: true },
{ ...recent, isPrimary: false }
],
'午后收整工具',
1
)
).toEqual(names)
})
it('旧图片按需查看原费用与来源,切换项目/候选后不混入其它记录或未执行计划', async () => {
const fetcher = vi.fn<typeof fetch>(async url => {
const path = String(url)
@@ -17,11 +35,12 @@ describe('V8-10免费输入与独立门禁', () => {
const projectId = path.includes('/second-project/') ? 'second-project' : 'original-project',
list = additionalImageFixture(projectId)
list.requests[0]!.input.targetId = 'history-shot'
list.requests[0]!.input.model = '原图片实际型号'
list.requests[0]!.input.candidateId = projectId === 'second-project' ? 'second-image' : 'old-image'
list.requests.push({
...structuredClone(list.requests[0]!),
id: 'another-candidate-request',
input: { ...list.requests[0]!.input, candidateId: 'unrelated-image' }
input: { ...list.requests[0]!.input, candidateId: 'unrelated-image', model: '其它图片的型号' }
})
return Response.json({ data: list })
}
@@ -59,6 +78,9 @@ describe('V8-10免费输入与独立门禁', () => {
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('原预留 USD 0.5')
expect(wrapper.text()).toContain('原图片实际型号')
expect(wrapper.text()).not.toContain('其它图片的型号')
expect(wrapper.findAll('[aria-label="原图片生成记录"]')).toHaveLength(1)
expect(wrapper.text()).toContain('实际账单 未知')
expect(wrapper.text()).toContain('历史审核未通过,当前来源已变化')
expect(wrapper.text()).not.toContain('another-candidate-request')
@@ -104,7 +126,9 @@ describe('V8-10免费输入与独立门禁', () => {
id: 'old-image',
shotId: 'quality-shot',
isPrimary: true,
imageUrl: '/mock.png'
imageUrl: '/mock.png',
model: '仅供详情核对的原型号',
error: '这份很长的历史错误只应在详情中展示'
}),
projectId: 'quality-project',
shotId: 'quality-shot',
@@ -113,11 +137,21 @@ describe('V8-10免费输入与独立门禁', () => {
blocked: true,
validationPassed: true,
confirming: false,
readonly: true
}
readonly: true,
displayName: '午后收整工具 · 图片 01'
},
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.get('.keyframe-card-name').text()).toBe('午后收整工具 · 图片 01')
expect(wrapper.text()).not.toContain('这份很长的历史错误')
expect(wrapper.text()).not.toContain('仅供详情核对的原型号')
expect(wrapper.text()).toContain('审核来源过期')
await wrapper.get('button[aria-label="查看首帧详情"]').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('这份很长的历史错误只应在详情中展示')
expect(wrapper.text()).toContain('仅供详情核对的原型号')
expect(wrapper.text()).toContain(
machine === 'failed' ? '历史审核未通过,当前来源已变化' : '历史审核通过,当前来源已变化'
)
@@ -55,10 +55,11 @@ describe('按任务读取执行历史的页面流程', () => {
expect(wrapper.text()).toContain('执行完成,质量请查看当前结论')
expect(wrapper.text()).toContain('本次新提交步骤:物理关系;复用已有步骤:通用画面')
await expand('通用画面')
expect(wrapper.text()).toContain('原调用计量,不重复计入本次')
await expand('高级详情')
expect(wrapper.text()).toContain('输入词元:100')
expect(wrapper.text()).toContain('复用来源执行:old-run')
expect(wrapper.text()).toContain('本步骤复用原调用,不重复计入本次费用')
await expand('步骤记录')
expect(wrapper.text()).toContain('原调用复用')
expect(wrapper.text()).not.toContain('输入词元')
expect(wrapper.text()).not.toContain('old-run')
expect(wrapper.text()).not.toContain('合计词元:0')
await wrapper
.findAll('button')
@@ -168,9 +168,19 @@ describe('已有失败图片的摄影修订', () => {
it('保存不采用;明确采用后旧failed转当前stale,原Primary/图片/审核和费用仍保留', async () => {
const { wrapper, fetcher, rows } = await camera()
try {
expect(
wrapper
.findAll('.workspace-numbered-sections > .workspace-numbered-section')
.map(block => block.get('.workspace-section-marker').text())
).toEqual(['I', 'II', 'III', 'IV', 'V'])
const input = wrapper.findAllComponents(NInput).find(row => row.attributes('aria-label') === '摄影构图')!
input.vm.$emit('update:value', '本次新构图,保持正式主体与原动作')
await flushPromises()
expect(
wrapper
.findAll('.workspace-numbered-sections > .workspace-numbered-section')
.map(block => block.get('.workspace-section-marker').text())
).toEqual(['I', 'II', 'III', 'IV', 'V', 'VI'])
await click(wrapper, '保存草案')
expect(
fetcher.mock.calls.some(([url]) => String(url).endsWith('/storyboard-derived-reviews/confirm'))
@@ -205,6 +215,8 @@ describe('已有失败图片的摄影修订', () => {
depthOfField: 'shallow',
visualIntent: '观察来信'
})
await wrapper.findAll('.keyframe-card')[0]!.get('button[aria-label="查看首帧详情"]').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('历史审核未通过,当前来源已变化')
expect(wrapper.text()).toContain('草案来源已变化')
expect(wrapper.text()).toContain('主首帧')
@@ -194,6 +194,17 @@ describe('原摄影抽屉内的联合流程', () => {
it.each([false, true])('保存、画面预览、联合免费预检和采用分开,幂等回执=%s', async reused => {
const { wrapper, fetcher, fixture } = await editor(false, reused)
expect(wrapper.text()).toContain('完整字段差异(4 项)')
expect(wrapper.findAll('.workspace-section-marker').map(item => item.text())).toEqual([
'I',
'II',
'III',
'IV',
'V',
'VI'
])
expect(wrapper.findAll('.workspace-panel > .workspace-section-heading .workspace-section-marker')).toHaveLength(
0
)
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
wrapper
.findAllComponents(NInput)
@@ -280,6 +291,15 @@ describe('原摄影抽屉内的联合流程', () => {
it('环境差异须逐字本集证据,冻结原字节全文SHA;保存和预检不自动采用', async () => {
const { wrapper, fetcher, episode } = await editor(false, false, true)
expect(wrapper.text()).toContain('本集原文依据')
expect(wrapper.findAll('.workspace-section-marker').map(item => item.text())).toEqual([
'I',
'II',
'III',
'IV',
'V',
'VI',
'VII'
])
await wrapper.vm.save()
await flushPromises()
await click(wrapper, '免费核对草案画面输入')
+3 -1
View File
@@ -10,7 +10,7 @@ import GenerateImageDialog from '@/features/subject-images/components/GenerateIm
import ImageGalleryDialog from '@/features/subject-images/components/ImageGalleryDialog.vue'
import { coverImage, hasRunningImages, primaryImage, validImageSize } from '@/features/subject-images/model'
import { formFixture, imageFixture } from '@/features/subject-images/testing/fixtures'
import { expandSections } from '@/testing/naive'
import { expandSections, expandSection } from '@/testing/naive'
/** 当前测试使用真实目录契约构造项目模型配置。 */
const creativeProfile = generationProfile('gallery-test')
@@ -153,6 +153,8 @@ describe('形态图片选择与操作', () => {
await flushPromises()
expect(fetcher.mock.calls[0]?.[0]).toBe('/api/subject-forms/form-db-1/images/preview')
expect(document.body.textContent).toContain('seedream / image-model')
expect(document.body.textContent).not.toContain('最终形态 Prompt')
await expandSection('本次实际使用的画面描述')
expect(document.body.textContent).toContain('最终形态 Prompt')
expect(wrapper.emitted('generate')).toBeUndefined()
})
+24 -6
View File
@@ -39,9 +39,8 @@ import { subjectImagesApi } from '@/features/subject-images/api'
import { styleFixture, styleImageFixture } from '@/features/visual-style/testing/fixtures'
import { identityFixture, identityImageFixture } from '@/features/subject-identity/testing/fixtures'
import { getIdentitySession } from '@/features/subject-identity/model'
import { drawerPanel, expandSections, selectControl } from '@/testing/naive'
import { drawerPanel, expandSections, expandSection, selectControl } from '@/testing/naive'
import ProductionPage from '@/features/production/ProductionPage.vue'
import RawDataDetails from '@/components/ui/RawDataDetails.vue'
import { getProductionSession } from '@/features/production/model'
import { generationConfigApi } from '@/features/generation-config/api'
import { AppDialog } from '@/components/ui'
@@ -1791,7 +1790,24 @@ describe('工作台页面交互', () => {
description: '真实镜头',
visualFocus: '信封',
durationSeconds: 5,
subjects: [{ subjectId: 'subject-db', subjectFormId: 'form-db' }],
subjects: [
{
subjectId: 'subject-db',
subjectFormId: 'form-db',
subjectRef: '@CH0001',
subjectName: '林知夏',
subjectFormName: '日常',
module: 'character',
identityDescription: '正式人物',
appearancePrompt: '原形态描述',
generationPrompt: '原生成描述',
expression: '平静',
pose: '站立',
gaze: '信封',
position: '画面右侧',
transientState: '手持信封'
}
],
direction: shot.direction,
environment: {
timeOfDay: '夜晚',
@@ -1817,9 +1833,11 @@ describe('工作台页面交互', () => {
button('整理生成方案').click()
await flushPromises()
expect(wrapper.find('pre').exists()).toBe(false)
await wrapper.getComponent(RawDataDetails).get('.n-collapse-item__header-main').trigger('click')
expect(wrapper.get('pre').text()).toContain('form-db')
expect(wrapper.get('pre').text()).toContain('地面积水')
await expandSection('本镜头生成内容', wrapper.element)
expect(wrapper.text()).toContain('日常')
expect(wrapper.text()).toContain('地面积水')
expect(wrapper.find('pre').exists()).toBe(false)
expect(wrapper.text()).not.toContain('form-db')
expect(fetcher.mock.calls[2]?.[0]).toBe('/api/storyboard-shots/shot-db-1-1/generation-spec')
expect(fetcher.mock.calls.every(([, init]) => init?.method !== 'POST')).toBe(true)
})