fix(short-drama-agent-front): 修正分镜诊断状态与响应式布局
This commit is contained in:
1 parent
1da56e0d46
commit
b34dc02e39
23 files changed
+796
-273
No files matched your search
@@ -369,7 +369,7 @@ function diagnosisResultsResponse() {
|
||||
|
||||
/**
|
||||
* 提供完整结构化校验响应,通过证据数量区分当前与迟到结果。
|
||||
* @param evidenceShotCount 具有有效动作证据的镜头数量
|
||||
* @param evidenceShotCount 具有手部记录覆盖的镜头数量
|
||||
* @returns 后端结构化校验响应
|
||||
*/
|
||||
function handDiagnosticsResponse(evidenceShotCount: number) {
|
||||
@@ -595,8 +595,9 @@ describe('拆解页内容滚动', () => {
|
||||
const provided = mountPage([record])
|
||||
await selectTab('分镜')
|
||||
const toolbar = wrapper!.get('.breakdown-storyboard-toolbar')
|
||||
expect(toolbar.get('.breakdown-episode-picker > span').text()).toBe('选择剧集')
|
||||
expect(toolbar.find('.breakdown-episode-picker > span').exists()).toBe(false)
|
||||
const select = toolbar.getComponent(NSelect)
|
||||
expect(select.attributes('aria-label')).toBe('选择分镜剧集')
|
||||
expect(select.props('value')).toBe(1)
|
||||
expect(toolbar.text()).toContain('长剧集')
|
||||
expect(toolbar.get('.breakdown-storyboard-summary').text()).toContain('25 个节拍 · 25 个镜头')
|
||||
@@ -627,11 +628,11 @@ describe('拆解页内容滚动', () => {
|
||||
expect(wrapper!.find('.breakdown-storyboard router-link-stub').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('分镜顶部无叠加操作行,选择标签保持单行且统计操作垂直居中', () => {
|
||||
it('分镜顶部无叠加操作行,下拉框可收缩且统计操作垂直居中', () => {
|
||||
// 仅保护样式契约,DOM 环境不提供真实布局坐标。
|
||||
const css = readAllStyles()
|
||||
expect(css).toMatch(/\.breakdown-result-pad\s*\{[^}]*padding:\s*0(?:px)?/)
|
||||
expect(css).toMatch(/\.breakdown-episode-picker > span\s*\{[^}]*flex-shrink:\s*0;[^}]*white-space:\s*nowrap;/)
|
||||
expect(css).toMatch(/\.breakdown-episode-picker\s*\{[^}]*min-width:\s*0(?:px)?;/)
|
||||
expect(css).toMatch(/\.breakdown-storyboard-summary\s*\{[^}]*align-items:\s*center;/)
|
||||
})
|
||||
|
||||
@@ -747,7 +748,7 @@ describe('拆解页内容滚动', () => {
|
||||
expect(issues?.textContent).toContain('读取修复清单')
|
||||
})
|
||||
|
||||
it('诊断摘要与弹窗按需读取,展开结构化校验后展示证据不足', async () => {
|
||||
it('诊断摘要与弹窗按需读取,保留通用检查但不展示旧手部统计', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async input => {
|
||||
const url = String(input)
|
||||
if (url.includes('storyboard-legacy-action-diagnosis-results')) return diagnosisResultsResponse()
|
||||
@@ -767,12 +768,12 @@ describe('拆解页内容滚动', () => {
|
||||
expect(panel.get('.storyboard-diagnosis-dialog').attributes('aria-busy')).toBe('false')
|
||||
const footer = panel.get('.n-drawer-footer')
|
||||
expect(footer.text()).toContain('预览诊断范围')
|
||||
expect(footer.text()).toContain('启动 AI 诊断')
|
||||
expect(footer.text()).toContain('启动 AI 复查')
|
||||
expect(footer.text()).toContain('关闭')
|
||||
await panel.get('.n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
expect(panel.text()).toContain('有效动作证据 0 / 25 镜')
|
||||
expect(panel.text()).toContain('证据不足,暂无法判断冲突情况')
|
||||
expect(panel.text()).not.toContain('手部记录覆盖')
|
||||
expect(panel.text()).toContain('未填写记录不代表镜头有误')
|
||||
expect(panel.get('.n-collapse-item__header-extra button').text()).toBe('刷新校验')
|
||||
await panel.get('.n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
@@ -832,7 +833,7 @@ describe('拆解页内容滚动', () => {
|
||||
expect(panel.get('.diagnosis-dialog-content').element).toBe(content)
|
||||
})
|
||||
|
||||
it('刷新已加载的结构化校验保留证据正文和图标占位,不触发整窗遮罩', async () => {
|
||||
it('刷新通用动作检查保留高级摘要和图标占位,不触发整窗遮罩', async () => {
|
||||
let handRequests = 0
|
||||
let resolveRefresh: ((value: Response) => void) | undefined
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async input => {
|
||||
@@ -856,14 +857,14 @@ describe('拆解页内容滚动', () => {
|
||||
const panel = qualityDialog()
|
||||
await panel.get('.n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
const evidence = panel.findAll('p').find(item => item.text().includes('有效动作证据'))!.element
|
||||
const evidence = panel.get('.diagnosis-inspection-details').element
|
||||
const refreshButton = panel.findAll('button').find(button => button.text() === '刷新校验')!
|
||||
const refreshIcon = refreshButton.find('.n-button__icon')
|
||||
await refreshButton.trigger('click')
|
||||
await flushPromises()
|
||||
try {
|
||||
expect(panel.text()).toContain('有效动作证据 0 / 25 镜')
|
||||
expect(panel.findAll('p').find(item => item.text().includes('有效动作证据'))!.element).toBe(evidence)
|
||||
expect(panel.text()).not.toContain('手部记录覆盖')
|
||||
expect(panel.get('.diagnosis-inspection-details').element).toBe(evidence)
|
||||
const spin = wrapper!
|
||||
.findAllComponents(NSpin)
|
||||
.find(item => item.classes().includes('storyboard-diagnosis-dialog'))!
|
||||
@@ -876,7 +877,7 @@ describe('拆解页内容滚动', () => {
|
||||
await flushPromises()
|
||||
}
|
||||
expect(refreshButton.classes()).not.toContain('n-button--loading')
|
||||
expect(panel.findAll('p').find(item => item.text().includes('有效动作证据'))!.element).toBe(evidence)
|
||||
expect(panel.get('.diagnosis-inspection-details').element).toBe(evidence)
|
||||
expect(panel.get('.n-collapse-item__header-extra button').element).toBe(refreshButton.element)
|
||||
})
|
||||
|
||||
@@ -918,7 +919,10 @@ describe('拆解页内容滚动', () => {
|
||||
expect((close.element as HTMLButtonElement).disabled).toBe(false)
|
||||
await close.trigger('click')
|
||||
await flushPromises()
|
||||
resolveFirst!(handDiagnosticsResponse(25))
|
||||
const late = await handDiagnosticsResponse(25).json()
|
||||
late.data.warningCount = 1
|
||||
late.data.diagnostics = [{ episodeNo: 1, beatNo: 1, shotNo: 1, phaseNo: 1, characterRef: '@CH0001', actionIds: ['a1', 'a2'], code: 'hand_occupancy_conflict', severity: 'warning', suggestion: '已失效的动作检查问题' }]
|
||||
resolveFirst!(new Response(JSON.stringify(late), { status: 200, headers: { 'Content-Type': 'application/json' } }))
|
||||
await flushPromises()
|
||||
await wrapper!.get('.storyboard-diagnosis-summary button').trigger('click')
|
||||
await flushPromises()
|
||||
@@ -926,8 +930,8 @@ describe('拆解页内容滚动', () => {
|
||||
expect(panel.get('.storyboard-diagnosis-dialog').attributes('aria-busy')).toBe('false')
|
||||
await panel.get('.n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
expect(panel.text()).not.toContain('有效动作证据 25 / 25')
|
||||
expect(panel.text()).toContain('有效动作证据 0 / 25 镜')
|
||||
expect(panel.text()).not.toContain('已失效的动作检查问题')
|
||||
expect(panel.text()).not.toContain('手部记录覆盖')
|
||||
expect(handRequests).toBe(2)
|
||||
})
|
||||
|
||||
|
||||
@@ -43,16 +43,21 @@ describe('候选预检查与最终提交门禁', () => {
|
||||
openPanel()
|
||||
expect(preview).not.toHaveBeenCalled()
|
||||
expect(commit).not.toHaveBeenCalled()
|
||||
expect(wrapper!.findAll('button').some(button => button.text() === '重新检查')).toBe(true)
|
||||
await wrapper!.findAll('button').find(button => button.text() === '重新检查')!.trigger('click')
|
||||
expect(wrapper!.emitted('refresh')).toHaveLength(1)
|
||||
await checkCandidate()
|
||||
expect(commit).not.toHaveBeenCalled()
|
||||
expect(document.querySelector('.app-dialog')?.textContent).toContain('确认提交候选为正式结果')
|
||||
await confirmCandidate()
|
||||
expect(preview).toHaveBeenCalledTimes(2)
|
||||
expect(commit).toHaveBeenCalledExactlyOnceWith('candidate-project')
|
||||
expect(wrapper!.emitted('refresh')).toHaveLength(1)
|
||||
expect(wrapper!.text()).toContain('候选已提交')
|
||||
expect(wrapper!.emitted('refresh')).toHaveLength(2)
|
||||
expect(wrapper!.text()).toContain('拆解结果已保存并采用')
|
||||
expect(wrapper!.findAll('button').some(button => button.text() === '重新检查')).toBe(false)
|
||||
await wrapper!.setProps({ state: candidateState({ storyboardPersisted: true, candidateCommitted: true }), quality: breakdownQuality(selectBreakdownSource([candidateCheckpoint(candidateState({ storyboardPersisted: true, candidateCommitted: true }))]), null) })
|
||||
expect(wrapper!.findAll('button').some(button => button.text() === '提交候选为正式结果')).toBe(false)
|
||||
expect(wrapper!.findAll('button').some(button => button.text() === '重新检查')).toBe(false)
|
||||
})
|
||||
it('ready=false 显示未通过项且不打开最终确认', async () => {
|
||||
const result = commitPreview()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { diagnosisHasAttention, diagnosisReason } from '@/features/breakdown/diagnosis'
|
||||
import type { LegacyActionDiagnosisResults } from '@/features/breakdown/types'
|
||||
|
||||
/**
|
||||
* 修订后的镜头尚未做额外 AI 复查,动作占用没有报告具体问题。
|
||||
* @returns 与真实诊断列表一致的最小记录
|
||||
*/
|
||||
function repaired(): LegacyActionDiagnosisResults['shots'][number] {
|
||||
return { shotId: 'repaired-shot', episodeNo: 1, beatNo: 7, shotNo: 1, title: '已修订镜头', diagnosisId: null,
|
||||
status: 'not_diagnosed', issues: [], createdAt: null, repairStatus: 'repaired', requiresPostRepairDiagnosis: true,
|
||||
resourceAudit: { status: 'insufficient_evidence', issueCount: 0, evidenceCount: 2, expectedActionCount: 0, coveredActionCount: 0, coverage: null } }
|
||||
}
|
||||
|
||||
describe('实际修复问题与独立 AI 复查分类', () => {
|
||||
it('已修订但没有额外 AI 诊断不算需要修复', () => {
|
||||
expect(diagnosisHasAttention(repaired())).toBe(false)
|
||||
})
|
||||
it('过期的冲突或待核对建议不能当成当前动作问题', () => {
|
||||
expect(diagnosisHasAttention({ ...repaired(), status: 'stale', shotStale: true,
|
||||
bodyMotionFindings: [{ dimension: 'balance', status: 'conflict', description: '旧冲突', quote: '旧原文' }] })).toBe(false)
|
||||
expect(diagnosisHasAttention({ ...repaired(), status: 'insufficient_evidence' })).toBe(false)
|
||||
})
|
||||
it('当前明确冲突和实时资源问题始终保留,不能因已经修订而隐藏', () => {
|
||||
expect(diagnosisHasAttention({ ...repaired(), status: 'conflict_found', policyStatus: 'current', shotStale: false })).toBe(true)
|
||||
expect(diagnosisHasAttention({ ...repaired(), resourceAudit: { ...repaired().resourceAudit!, status: 'conflict_found', issueCount: 1 } })).toBe(true)
|
||||
expect(diagnosisHasAttention({ ...repaired(), status: 'no_conflict_found', policyStatus: 'current',
|
||||
bodyMotionFindings: [{ dimension: 'balance', status: 'conflict', description: '当前冲突', quote: '原文' }] })).toBe(true)
|
||||
})
|
||||
it('可选 AI 复查受限不要求重新拆解或替用户放开模型请求', () => {
|
||||
for (const code of ['QUALITY_POLICY_SNAPSHOT_UNKNOWN', 'QUALITY_POLICY_SNAPSHOT_INVALID']) {
|
||||
expect(diagnosisReason(code)).toContain('AI 复查')
|
||||
expect(diagnosisReason(code)).not.toContain('重新生成拆解候选')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -25,6 +25,44 @@ beforeEach(() => { vi.spyOn(preparationApi, 'revisions').mockResolvedValue({ pro
|
||||
afterEach(() => { wrapper?.unmount(); wrapper = undefined; vi.restoreAllMocks(); vi.unstubAllGlobals(); document.body.innerHTML = '' })
|
||||
|
||||
describe('单镜头诊断收费前来源检查', () => {
|
||||
it('高级检查保留复查记录与范围,隐藏旧手部统计且不改变诊断启动条件', async () => {
|
||||
const start = mocks()
|
||||
vi.spyOn(breakdownApi, 'diagnosisPreflight').mockResolvedValue(checked())
|
||||
vi.mocked(breakdownApi.handOccupancyDiagnostics).mockResolvedValue({ projectId: 'diag-p', shotCount: 61, evidenceShotCount: 42,
|
||||
warningCount: 0, assessment: 'partial_evidence', diagnostics: [] } as never)
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-p', episodeNo: 1, episodeNos: [1] } })
|
||||
wrapper.getComponent(StoryboardDiagnosis).vm.open({ episodeNo: 1, beatNo: 1, shotNo: 1 }); await flushPromises()
|
||||
const drawer = new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!)
|
||||
expect(drawer.text()).toContain('高级检查详情')
|
||||
expect(drawer.find('.diagnosis-counts').exists()).toBe(false)
|
||||
expect(drawer.text()).not.toContain('42 / 61')
|
||||
expect(drawer.text()).not.toContain('缺少结构化动作证据')
|
||||
expect(drawer.find('.diagnosis-preview').exists()).toBe(false)
|
||||
const disabledBefore = drawer.get('[aria-label="启动 AI 复查"]').attributes('disabled')
|
||||
await drawer.get('.diagnosis-evidence-collapse .n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
expect(drawer.text()).not.toContain('手部记录覆盖')
|
||||
expect(drawer.text()).not.toContain('全项目手部记录')
|
||||
expect(drawer.find('.diagnosis-counts').exists()).toBe(true)
|
||||
expect(drawer.text()).not.toContain('未填写手部记录')
|
||||
expect(drawer.get('.diagnosis-evidence-collapse').text()).not.toContain('证据不足')
|
||||
expect(drawer.get('.diagnosis-evidence-collapse').text()).toContain('当前复查范围')
|
||||
expect(drawer.get('[aria-label="启动 AI 复查"]').attributes('disabled')).toBe(disabledBefore)
|
||||
expect(start).not.toHaveBeenCalled()
|
||||
})
|
||||
it('确实检出的结构化冲突在普通区域可见,不随高级详情一起隐藏', async () => {
|
||||
mocks()
|
||||
vi.mocked(breakdownApi.handOccupancyDiagnostics).mockResolvedValue({ projectId: 'diag-p', shotCount: 1, evidenceShotCount: 1,
|
||||
warningCount: 1, assessment: 'complete_evidence', diagnostics: [{ episodeNo: 1, beatNo: 1, shotNo: 1, phaseNo: 1,
|
||||
characterRef: '@CH0001', actionIds: ['a1','a2'], code: 'hand_occupancy_conflict', severity: 'warning', suggestion: '右手同时执行了冲突动作' }] } as never)
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-p', episodeNo: 1, episodeNos: [1] } })
|
||||
await flushPromises(); await wrapper.get('button').trigger('click'); await flushPromises()
|
||||
const drawer = new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!)
|
||||
expect(drawer.text()).toContain('右手同时执行了冲突动作')
|
||||
expect(drawer.find('.diagnosis-evidence-collapse').text()).not.toContain('右手同时执行了冲突动作')
|
||||
expect(drawer.findAll('.problem-surface').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('规则缺失、跨项目、已可复用和不完整检查都不能进入新诊断', () => {
|
||||
expect(diagnosisCanStart(checked(), 'diag-p', 'db-shot')).toBe(true)
|
||||
for (const invalid of [{ projectId: 'other' }, { shotId: 'other' }, { existingValid: true }, { shouldDiagnose: false }, { policyRevision: null }, { policyFingerprint: null }, { errors: ['QUALITY_POLICY_SNAPSHOT_UNKNOWN'] }, { eligibleForFurtherValidation: false }])
|
||||
@@ -38,7 +76,7 @@ describe('单镜头诊断收费前来源检查', () => {
|
||||
expect(read).toHaveBeenCalledWith('diag-p', 'db-shot')
|
||||
const drawer = new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!)
|
||||
expect(drawer.text()).toContain('缺少可信的质量规则记录')
|
||||
expect(drawer.get('[aria-label="启动 AI 诊断"]').attributes('disabled')).toBeDefined()
|
||||
expect(drawer.get('[aria-label="启动 AI 复查"]').attributes('disabled')).toBeDefined()
|
||||
expect(start).not.toHaveBeenCalled()
|
||||
})
|
||||
it('费用确认后再次检查,规则变化时保留只读结果并撤销启动', async () => {
|
||||
@@ -46,13 +84,13 @@ describe('单镜头诊断收费前来源检查', () => {
|
||||
vi.spyOn(breakdownApi, 'diagnosisPreflight').mockResolvedValueOnce(checked()).mockResolvedValue({ ...checked(), policyRevision: 4, policyFingerprint: 'b'.repeat(64) })
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-p', episodeNo: 1, episodeNos: [1] } })
|
||||
wrapper.getComponent(StoryboardDiagnosis).vm.open({ episodeNo: 1, beatNo: 1, shotNo: 1 }); await flushPromises()
|
||||
await new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 诊断"]').trigger('click')
|
||||
await new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 复查"]').trigger('click')
|
||||
await flushPromises()
|
||||
const confirmation = new DOMWrapper(document.querySelector('.app-dialog')!)
|
||||
await confirmation.findAll('button').find(button => button.text() === '确认启动 AI 诊断')!.trigger('click')
|
||||
await confirmation.findAll('button').find(button => button.text() === '确认启动 AI 复查')!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(start).not.toHaveBeenCalled()
|
||||
expect(new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 诊断"]').attributes('disabled')).toBeDefined()
|
||||
expect(new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 复查"]').attributes('disabled')).toBeDefined()
|
||||
})
|
||||
it('镜头描述在费用确认期间变化时必须重新预览,不能直接诊断新内容', async () => {
|
||||
const start = mocks()
|
||||
@@ -60,8 +98,8 @@ describe('单镜头诊断收费前来源检查', () => {
|
||||
vi.mocked(breakdownApi.legacyActionDiagnosisPreview).mockResolvedValueOnce(preview()).mockResolvedValue({ ...preview(), candidates: [{ ...preview().candidates[0]!, description: '已更改的新镜头' }] })
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-p', episodeNo: 1, episodeNos: [1] } })
|
||||
wrapper.getComponent(StoryboardDiagnosis).vm.open({ episodeNo: 1, beatNo: 1, shotNo: 1 }); await flushPromises()
|
||||
await new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 诊断"]').trigger('click'); await flushPromises()
|
||||
await new DOMWrapper(document.querySelector('.app-dialog')!).findAll('button').find(button => button.text() === '确认启动 AI 诊断')!.trigger('click'); await flushPromises()
|
||||
await new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!).get('[aria-label="启动 AI 复查"]').trigger('click'); await flushPromises()
|
||||
await new DOMWrapper(document.querySelector('.app-dialog')!).findAll('button').find(button => button.text() === '确认启动 AI 复查')!.trigger('click'); await flushPromises()
|
||||
expect(start).not.toHaveBeenCalled()
|
||||
})
|
||||
it('修订条件与历史按需读取,跨项目响应不显示为可修订', async () => {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { flushPromises, mount, DOMWrapper, type VueWrapper } from '@vue/test-utils'
|
||||
import { NSelect } from 'naive-ui'
|
||||
import StoryboardDiagnosis from '@/features/breakdown/components/StoryboardDiagnosis.vue'
|
||||
import { projectContextKey } from '@/features/projects/context'
|
||||
import { testProjectContext } from '@/testing/project-context'
|
||||
import WorkflowExecutionPanel from '@/features/workflows/WorkflowExecutionPanel.vue'
|
||||
import { breakdownApi } from '@/features/breakdown/api'
|
||||
import type { LegacyActionDiagnosisResults } from '@/features/breakdown/types'
|
||||
@@ -15,16 +18,71 @@ let wrapper: VueWrapper | undefined
|
||||
afterEach(() => { wrapper?.unmount(); wrapper = undefined; vi.restoreAllMocks(); vi.unstubAllGlobals(); document.body.innerHTML = '' })
|
||||
|
||||
describe('诊断版本及复查展示', () => {
|
||||
it('顶部摘要优先表达正式审核通过,不因没有额外 AI 记录提示分镜尚未诊断', async () => {
|
||||
const current = { ...shot, status: 'not_diagnosed' as const, policyStatus: 'not_diagnosed' as const, shotStale: false, bodyMotionFindings: [] }
|
||||
vi.spyOn(breakdownApi, 'legacyActionDiagnosisResults').mockResolvedValue({ projectId: 'diag-update', episodeNo: 1,
|
||||
counts: { total: 1, conflict: 0, clear: 0, insufficient: 0, invalid: 0, stale: 0, pending: 1 }, shots: [current] })
|
||||
const context = testProjectContext('diag-update')
|
||||
wrapper = mount(StoryboardDiagnosis, { props: { projectId: 'diag-update', episodeNo: 1, episodeNos: [1] },
|
||||
global: { provide: { [projectContextKey as symbol]: context } } })
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('分镜校验与审核已通过')
|
||||
expect(wrapper.text()).not.toContain('尚未诊断')
|
||||
context.data.value!.stageReadiness.breakdown = { ready: false, reason: '审核已失效' }
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).not.toContain('分镜校验与审核已通过')
|
||||
expect(wrapper.text()).toContain('正式分镜检查待确认')
|
||||
context.data.value!.stageReadiness.projectId = 'other-project'
|
||||
context.data.value!.stageReadiness.breakdown.ready = true
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).not.toContain('分镜校验与审核已通过')
|
||||
})
|
||||
it('有当前真实问题时摘要仍明确提示处理,不被正式审核状态盖住', async () => {
|
||||
const current = { ...shot, status: 'conflict_found' as const, policyStatus: 'current' as const, shotStale: false, bodyMotionFindings: [] }
|
||||
vi.spyOn(breakdownApi, 'legacyActionDiagnosisResults').mockResolvedValue({ projectId: 'diag-update', episodeNo: 1,
|
||||
counts: { total: 1, conflict: 1, clear: 0, insufficient: 0, invalid: 0, stale: 0, pending: 0 }, shots: [current] })
|
||||
wrapper = mount(StoryboardDiagnosis, { props: { projectId: 'diag-update', episodeNo: 1, episodeNos: [1] },
|
||||
global: { provide: { [projectContextKey as symbol]: testProjectContext('diag-update') } } })
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('1 个镜头有实际问题待处理')
|
||||
expect(wrapper.text()).not.toContain('分镜校验与审核已通过')
|
||||
})
|
||||
|
||||
it('已修订并审核通过默认不列入需处理,可在可选复查中查看且没有修复按钮', async () => {
|
||||
const current = { ...shot, status: 'not_diagnosed' as const, policyStatus: 'not_diagnosed' as const,
|
||||
shotStale: false, bodyMotionFindings: [], handAudit: undefined,
|
||||
resourceAudit: { status: 'insufficient_evidence' as const, issueCount: 0, evidenceCount: 2, expectedActionCount: 0, coveredActionCount: 0, coverage: null } }
|
||||
vi.spyOn(breakdownApi, 'legacyActionDiagnosisResults').mockResolvedValue({ projectId: 'diag-update', episodeNo: 1,
|
||||
counts: { total: 1, conflict: 0, clear: 0, insufficient: 0, invalid: 0, stale: 0, pending: 1 }, shots: [current] })
|
||||
vi.spyOn(breakdownApi, 'handOccupancyDiagnostics').mockResolvedValue({ projectId: 'diag-update', shotCount: 1, evidenceShotCount: 0, diagnostics: [] } as never)
|
||||
const start = vi.spyOn(breakdownApi, 'startLegacyActionDiagnosis')
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-update', episodeNo: 1, episodeNos: [1] },
|
||||
global: { provide: { [projectContextKey as symbol]: testProjectContext('diag-update') } } })
|
||||
await flushPromises(); await wrapper.get('button').trigger('click'); await flushPromises()
|
||||
const dialog = new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!)
|
||||
expect(dialog.findAll('.diagnosis-result-item')).toHaveLength(0)
|
||||
expect(dialog.text()).toContain('当前正式分镜已审核通过')
|
||||
expect(dialog.findAll('button').some(item => item.text() === '查看可选 AI 复查')).toBe(false)
|
||||
wrapper!.getComponent(NSelect).vm.$emit('update:value', 'review')
|
||||
await flushPromises()
|
||||
expect(dialog.findAll('.diagnosis-result-item')).toHaveLength(1)
|
||||
expect(dialog.text()).toContain('已修订并审核通过')
|
||||
expect(dialog.text()).not.toContain('动作占用证据不足')
|
||||
expect(dialog.find('[aria-label="查看并修订动作"]').exists()).toBe(false)
|
||||
expect(start).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('修订完成不显示全部通过,展示规则和镜头过期、手部覆盖及全身疑点', async () => {
|
||||
vi.spyOn(breakdownApi, 'legacyActionDiagnosisResults').mockResolvedValue({ projectId: 'diag-update', episodeNo: 1, counts: { total: 1, conflict: 0, clear: 0, insufficient: 0, invalid: 0, stale: 1, pending: 0 }, shots: [shot] })
|
||||
vi.spyOn(breakdownApi, 'handOccupancyDiagnostics').mockResolvedValue({ projectId: 'diag-update', shotCount: 1, evidenceShotCount: 0, diagnostics: [] } as never)
|
||||
wrapper = mount(StoryboardDiagnosis, { attachTo: document.body, props: { projectId: 'diag-update', episodeNo: 1, episodeNos: [1] } })
|
||||
await flushPromises(); await wrapper.get('button').trigger('click'); await flushPromises()
|
||||
const dialog = new DOMWrapper(document.querySelector('[aria-label="动作诊断"]')!)
|
||||
expect(dialog.text()).toContain('镜头已修订,AI 待复查')
|
||||
wrapper!.getComponent(NSelect).vm.$emit('update:value', 'review'); await flushPromises()
|
||||
expect(dialog.text()).toContain('镜头已修订,可按需进行 AI 复查。')
|
||||
expect(dialog.text()).toContain('镜头内容已变化')
|
||||
expect(dialog.text()).toContain('质量规则已变化')
|
||||
expect(dialog.text()).toContain('手部动作证据 1 / 2')
|
||||
expect(dialog.text()).not.toContain('手部动作证据 1 / 2')
|
||||
expect(dialog.text()).toContain('重心需要核对')
|
||||
expect(dialog.text()).not.toContain('全部通过')
|
||||
})
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import StoryboardList from '@/features/breakdown/components/StoryboardList.vue'
|
||||
import type { EpisodePlan, EpisodeShots } from '@/features/breakdown/types'
|
||||
|
||||
/** 一条不涉及实际服务的正式分镜,用于验证定位语义。 */
|
||||
const plan: EpisodePlan = { episodeNo: 1, episodeTitle: '第一集', storyGoal: '', centralConflict: '', emotionalArc: '', pacing: '', endingHook: '',
|
||||
beats: [{ beatNo: 1, title: '场景', purpose: 'establish', description: '内容', visualFocus: '', narrativeGoal: '', emotionalTone: '', estimatedDurationSeconds: 5, subjectRefs: [], isKeyBeat: false }] }
|
||||
/** 当前正式镜头正文。 */
|
||||
const episode: EpisodeShots = { episodeNo: 1, episodePlan: plan, beatShots: [{ beatNo: 1, shots: [{ shotNo: 1, title: '无问题镜头', description: '正文', visualFocus: '', subjectRefs: [], durationSeconds: 5 }] }] }
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => { wrapper?.unmount(); vi.restoreAllMocks() })
|
||||
|
||||
describe('分镜定位与问题状态分离', () => {
|
||||
it('只有从当前实际问题定位时使用错误标记,普通定位会清除旧错误标记', async () => {
|
||||
wrapper = mount(StoryboardList, { props: { plans: [plan], episodes: [episode] } })
|
||||
const target = wrapper.get('[data-shot-position="1-1-1"]')
|
||||
await wrapper.getComponent(StoryboardList).vm.locate({ episodeNo: 1, beatNo: 1, shotNo: 1 }, { problem: true })
|
||||
expect(target.classes()).toContain('diagnosis-problem-located')
|
||||
await wrapper.getComponent(StoryboardList).vm.locate({ episodeNo: 1, beatNo: 1, shotNo: 1 })
|
||||
expect(target.classes()).toContain('diagnosis-located')
|
||||
expect(target.classes()).not.toContain('diagnosis-problem-located')
|
||||
})
|
||||
it('正式数据刷新后清除旧定位,不让已处理的问题继续标红', async () => {
|
||||
wrapper = mount(StoryboardList, { props: { plans: [plan], episodes: [episode] } })
|
||||
await wrapper.getComponent(StoryboardList).vm.locate({ episodeNo: 1, beatNo: 1, shotNo: 1 }, { problem: true })
|
||||
await wrapper.setProps({ episodes: [structuredClone(episode)] })
|
||||
await flushPromises()
|
||||
expect(wrapper.find('.diagnosis-problem-located').exists()).toBe(false)
|
||||
expect(wrapper.find('.diagnosis-located').exists()).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -93,10 +93,10 @@ describe('连续剧本阅读器', () => {
|
||||
/\.reader-chapter-heading\s*\{[^}]*position:\s*sticky;[^}]*top:\s*0;[^}]*z-index:\s*2;[^}]*background:\s*var\(--reader-background\)/
|
||||
)
|
||||
expect(css).toMatch(
|
||||
/\.reader-chapter-heading\s*\{[^}]*margin-inline:\s*calc\(var\(--reader-gutter\) \* -1\);[^}]*padding:\s*14px var\(--reader-gutter\) 18px;/
|
||||
/\.reader-chapter-heading\s*\{[^}]*margin-inline:\s*calc\(var\(--reader-gutter\) \* -1\);[^}]*padding:\s*0 var\(--reader-gutter\) 18px;/
|
||||
)
|
||||
expect(css).toMatch(/@media \(max-width: 800px\)[\s\S]*?\.reader-content\s*\{[^}]*padding-inline:\s*18px/)
|
||||
expect(css).toMatch(/@media \(max-width: 800px\)[\s\S]*?\.reader-content\s*\{[^}]*--reader-gutter:\s*18px/)
|
||||
expect(css).toMatch(/@media \(max-width: 1023px\)[\s\S]*?\.reader-content\s*\{[^}]*padding:\s*24px/)
|
||||
expect(css).toMatch(/@media \(max-width: 1023px\)[\s\S]*?\.reader-content\s*\{[^}]*--reader-gutter:\s*24px/)
|
||||
})
|
||||
|
||||
it('按编号连续渲染全部剧集、元数据和空正文,标题不截断,模型内容只按文本显示', () => {
|
||||
|
||||
@@ -217,11 +217,14 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(wrapper!.get(skeleton).attributes('aria-busy')).toBe('true')
|
||||
expect(wrapper!.find('.workspace-loading').exists()).toBe(false)
|
||||
expect(wrapper!.get('.project-title').text()).toBe('')
|
||||
expect(wrapper!.findAll('.project-header-action-placeholder')).toHaveLength(2)
|
||||
expect(wrapper!.find('.project-header .n-button').exists()).toBe(false)
|
||||
expect(mounted).not.toHaveBeenCalled()
|
||||
|
||||
resolveDetail(project('skeleton-first', 'completed'))
|
||||
await flushPromises()
|
||||
expect(wrapper!.find(skeleton).exists()).toBe(false)
|
||||
expect(wrapper!.find('.project-header-action-placeholder').exists()).toBe(false)
|
||||
expect(wrapper!.get('.workspace-probe').text()).toBe(section)
|
||||
|
||||
pending = new Promise<ProjectDetail>(resolve => {
|
||||
|
||||
Reference in new issue
Block a user