feat(short-drama-agent-front): 接入摄影审核与首帧制作

This commit is contained in:
GJ committed 2026-11-06 17:10:52 +08:00
1 parent 3503926d62
commit 751106985e
32 files changed
+1970 -153

No files matched your search

+58 -16
View File
@@ -70,6 +70,15 @@ function recoveryButton(label: string) {
return [...document.querySelectorAll('button')].find(item => item.textContent?.trim() === label)!
}
/**
* 在实际弹窗中定位当前可操作的按钮。
* @param label 完整按钮文字
* @returns 对应按钮
*/
function dialogButton(label: string) {
return [...document.querySelectorAll<HTMLButtonElement>('button')].find(item => item.textContent?.trim() === label)
}
describe('精简公开资产回归', () => {
it('无内部字段的视频可播放,晋升使用后端权限,会话通过不能授权', async () => {
const projectId = 'public-video-contract'
@@ -298,24 +307,35 @@ describe('精简公开资产回归', () => {
const projectId = 'keyframe-promotion-contract'
const primary = keyframeFixture()
const candidate = keyframeFixture({ id: 'keyframe-2', isPrimary: false })
let persistedQuality = 'unknown'
const primaryRequests: string[] = []
vi.stubGlobal(
'fetch',
vi.fn<typeof fetch>().mockImplementation(
async url =>
new Response(
JSON.stringify({
data: String(url).endsWith('/generation-models')
? imageCatalog
: String(url).endsWith('/creative-profile')
? generationProfile(projectId)
: String(url).endsWith('/keyframes')
? [primary, candidate]
: []
})
)
)
vi.fn<typeof fetch>().mockImplementation(async (url, options) => {
if (options?.method === 'PUT') {
primaryRequests.push(String(url))
return new Response(JSON.stringify({ data: { ...candidate, isPrimary: true } }))
}
return new Response(
JSON.stringify({
data: String(url).endsWith('/generation-models')
? imageCatalog
: String(url).endsWith('/creative-profile')
? generationProfile(projectId)
: String(url).endsWith('/keyframes')
? [primary, candidate]
: String(url).endsWith('/quality-review')
? {
effectiveQualityStatus: String(url).includes(candidate.id)
? persistedQuality
: 'passed'
}
: []
})
)
})
)
const wrapper = mount(ShotProductionAssets, {
let wrapper = mount(ShotProductionAssets, {
attachTo: document.body,
props: { projectId, shot, disabled: false }
})
@@ -365,7 +385,29 @@ describe('精简公开资产回归', () => {
expect(sessionKeyframePassed(projectId, shot.shotId, candidate.id)).toBe(true)
expect(
[...document.querySelectorAll('button')].some(item => item.textContent?.includes('设为主首帧'))
).toBe(true)
).toBe(false)
wrapper.unmount()
persistedQuality = 'passed'
wrapper = mount(ShotProductionAssets, {
attachTo: document.body,
props: { projectId, shot, disabled: false }
})
await flushPromises()
await wrapper
.findAll('button')
.find(item => item.text().includes('管理候选'))!
.trigger('click')
await flushPromises()
const promote = dialogButton('设为主首帧')
expect(promote).toBeDefined()
promote?.click()
await flushPromises()
dialogButton('确认切换')?.click()
await flushPromises()
expect(primaryRequests).toEqual([
'/api/storyboard-shots/' + shot.shotId + '/keyframes/' + candidate.id + '/primary'
])
} finally {
wrapper.unmount()
}