Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/scripts/smoke-clip-publishing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,19 @@ assert.equal(mergeGeneratedPublishingCopy(exportReadyWithoutCopy, { hook: ' ' })
assert.match(cardSource, /Generate publishing copy/);
assert.match(cardSource, /Refresh publishing copy/);
assert.match(cardSource, /Copy ready/);
assert.match(cardSource, /aiBusy: boolean/);
assert.match(cardSource, /disabled=\{isSuggested \|\| aiBusy \|\| isGeneratingPublishingCopy\}/);
assert.match(panelSource, /aiBusy=\{isProcessing\}/);
assert.match(cardSource, /onChange\(\{ title: suggestion \}\)/);
assert.match(panelSource, /mergeGeneratedPublishingCopy\(draft, data\)/);
assert.match(panelSource, /mergeGeneratedPublishingCopy\(draft, metadata\)/);
assert.match(panelSource, /function getClipMetadataInputFingerprint\(draft: ClipDraft, words: Word\[\]\)/);
assert.match(panelSource, /inputFingerprint = getClipMetadataInputFingerprint\(draft, words\)/);
assert.match(panelSource, /useAIStore\.getState\(\)\.clipDrafts\.find\(\(item\) => item\.id === draft\.id\)/);
assert.match(panelSource, /useEditorStore\.getState\(\)\.words/);
assert.match(panelSource, /getClipMetadataInputFingerprint\(currentDraft, currentWords\) !== inputFingerprint/);
assert.match(panelSource, /mergeGeneratedPublishingCopy\(currentDraft, data\)/);
assert.match(panelSource, /sourceJob\.inputFingerprint/);
assert.match(panelSource, /getClipMetadataInputFingerprint\(currentDraft, currentWords\) !== sourceJob\.inputFingerprint/);
assert.match(panelSource, /mergeGeneratedPublishingCopy\(currentDraft, metadata\)/);
assert.doesNotMatch(`${panelSource}\n${cardSource}`, /\bPackage\b|\bPackaged\b/);
const generationBody = panelSource.match(/const generatePublishingCopy = useCallback\(([\s\S]*?)\n\s{2}\);\n\s{2}\n\s{2}const retryAIJob/)?.[1] || '';
assert.doesNotMatch(generationBody, /lastError/);
Expand Down
25 changes: 22 additions & 3 deletions frontend/scripts/smoke-clips-first-lifecycle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,28 @@ assert.match(aiStoreSource, /clipReviewDecisions: \{\}/);
assert.match(aiStoreSource, /providers: \{/);
assert.match(panelSource, /if \(!isCurrentClipWorkspace\(\)\) return;\s+setEditPlanResult\(data\);/);
assert.match(panelSource, /if \(!isCurrentClipWorkspace\(\)\) return;\s+setFillerResult\(data\);/);
assert.match(panelSource, /const result = await pollAIJob<unknown>[\s\S]*if \(!isCurrentClipWorkspace\(\)\) return;/);
assert.match(panelSource, /const cancelAIJob = useCallback\([\s\S]*if \(!isCurrentClipWorkspace\(\)\) return;/);
assert.match(panelSource, /finally \{\s+if \(isCurrentClipWorkspace\(\)\) setProcessing\(false\);/);
assert.match(panelSource, /type AIJobRunContext = \{[\s\S]*workspaceEpoch: number/);
assert.match(panelSource, /const activeAIJobRunRef = useRef<AIJobRunContext \| null>\(null\)/);
assert.match(panelSource, /Another AI action is still running/);
assert.match(panelSource, /const isCurrentAIJobRun = useCallback/);
assert.match(panelSource, /let jobRes: Response;[\s\S]*jobRes = await fetch\(`\$\{backendUrl\}\/jobs\/\$\{jobId\}`\)[\s\S]*Connection interrupted; checking AI job status[\s\S]*continue;/);
assert.match(panelSource, /if \(!jobRes\.ok\) \{[\s\S]*jobRes\.status === 404[\s\S]*AI job status unavailable; retrying[\s\S]*continue;/);
assert.match(panelSource, /let job: AIJob<T>;[\s\S]*job = \(await jobRes\.json\(\)\) as AIJob<T>[\s\S]*AI job status was unreadable; retrying[\s\S]*continue;/);
assert.match(panelSource, /setActiveAIJob\(\{ \.\.\.job, \.\.\.context, workspaceEpoch: run\.workspaceEpoch, runId: run\.id \}\)/);
assert.match(panelSource, /workspaceEpoch: run\.workspaceEpoch/);
assert.match(panelSource, /runId: run\.id/);
assert.match(panelSource, /current && current\.workspaceEpoch !== clipWorkspaceEpoch \? null : current/);
const cancelAIJobBody = panelSource.match(/const cancelAIJob = useCallback\(async \(\) => \{([\s\S]*?)\n\s*\}, \[/)?.[1] || '';
assert.match(cancelAIJobBody, /const run = activeAIJobRunRef\.current/);
assert.match(cancelAIJobBody, /if \(job\.workspaceEpoch !== run\.workspaceEpoch \|\| job\.runId !== run\.id \|\| !isCurrentAIJobRun\(run\)\) return/);
assert.match(cancelAIJobBody, /await fetch\([\s\S]*if \(!isCurrentAIJobRun\(run\)\) return/);
assert.doesNotMatch(cancelAIJobBody, /setProcessing\(false/);
const retryAIJobBody = panelSource.match(/const retryAIJob = useCallback\(async \(\) => \{([\s\S]*?)\n\s*\}, \[/)?.[1] || '';
assert.match(retryAIJobBody, /const sourceJob = activeAIJob/);
assert.match(retryAIJobBody, /sourceJob\.workspaceEpoch !== useAIStore\.getState\(\)\.clipWorkspaceEpoch/);
assert.match(retryAIJobBody, /run = beginAIJobRun\(\)/);
assert.match(retryAIJobBody, /pollAIJob<unknown>\(jobId, sourceJob\.label, context, run\)/);
assert.match(retryAIJobBody, /if \(!isCurrentAIJobRun\(run\)\) return/);

const openFileBody = appSource.match(/const handleOpenFile = async \(intent: WorkflowIntent = 'full-video'\) => \{([\s\S]*?)\n\s*\};\s*const handleBrowserFileChange/)?.[1] || '';
const browserChangeBody = appSource.match(/const handleBrowserFileChange = async \(e: React\.ChangeEvent<HTMLInputElement>\) => \{([\s\S]*?)\n\s*\};\s*const handleBrowserDrop/)?.[1] || '';
Expand Down
8 changes: 5 additions & 3 deletions frontend/scripts/smoke-errors-accessibility.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ assert.match(waveform, /aria-label=\{followPlayhead \? 'Stop following playhead'
assert.match(waveform, /aria-label="Zoom out"/);
assert.match(waveform, /aria-label="Zoom in"/);

assert.match(ai, /activeAIJob\.id.*\/jobs\/\$\{activeAIJob\.id\}\/retry|\/jobs\/\$\{activeAIJob\.id\}\/retry/);
assert.match(ai, /\/jobs\/\$\{sourceJob\.id\}\/retry/);
assert.match(ai, /ai:clip-metadata/);
assert.match(ai, /appendDiscoveredClipDrafts/);
assert.match(ai, /setCreatorNotice/);
assert.match(ai, /setCreatorNotice\(null\);\s*const startRes/);
assert.match(ai, /setCreatorNotice\(null\);\s*setProcessing\(true, `Retrying/);
assert.match(ai, /setCreatorNotice\(null\);\s*setProcessing\(true, processingMessage\);\s*try \{\s*const startRes/);
assert.match(ai, /setCreatorNotice\(null\);\s*setProcessing\(true, `Retrying \$\{sourceJob\.label\}/);
assert.match(ai, /Another AI action is still running/);
assert.match(ai, /const canRetry = !busy && \(job\.status === 'failed' \|\| job\.status === 'canceled'\)/);
const generatePublishingCopyBody = ai.match(/const generatePublishingCopy = useCallback\(([\s\S]*?)\n \);\n\n const retryAIJob/)?.[1] || '';
assert.match(generatePublishingCopyBody, /getCreatorErrorPresentation\('ai-action', err\)/);
assert.doesNotMatch(generatePublishingCopyBody, /getCreatorErrorPresentation\('clip-action', err\)/);
Expand Down
Loading