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
@@ -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('全部通过')
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user