fix: intro subtitle + slower demo video

- Use annotate() instead of narrate() for intro (shows subtitle + TTS)
- Increase actionDelay from 500ms to 1500ms for human-readable pacing
- Add testcloud.comfy.org as cloud fallback server
- Fix knip ignoreDependencies
This commit is contained in:
snomiao
2026-04-10 23:21:52 +00:00
parent a3271cfde8
commit 03f2e1d183
2 changed files with 54 additions and 39 deletions

View File

@@ -1972,7 +1972,7 @@ async function main() {
const videoTestFile = `${projectRoot}/browser_tests/tests/qa-reproduce.spec.ts`
const testResultsDir = `${opts.outputDir}/test-results`
// Inject demowright narrate() call for TTS voice narration
// Inject demowright annotate() call for TTS + subtitle intro
const issueTitle =
issueCtx.match(/Title:\s*(.+)/)?.[1]?.trim() ?? 'Bug Reproduction'
let testCode = research.testCode
@@ -1981,18 +1981,19 @@ async function main() {
)
if (bodyMatch?.index !== undefined) {
const pos = bodyMatch.index + bodyMatch[0].length
const narrationInject = `
// demowright: narrate issue title (TTS + subtitle)
const introInject = `
// demowright: announce issue title with subtitle + TTS
try {
const { narrate: _narrate } = await import('demowright/helpers')
await _narrate(comfyPage.page, ${JSON.stringify('Reproducing: ' + issueTitle)})
console.log('[qa] narrate() completed successfully')
const { annotate: _intro } = await import('demowright/helpers')
await _intro(comfyPage.page, ${JSON.stringify('Reproducing: ' + issueTitle)}, async () => {
await comfyPage.page.waitForTimeout(3000)
})
} catch (e) {
console.log('[qa] narrate() failed:', e instanceof Error ? e.message : e)
console.warn('[qa] intro annotate failed:', e instanceof Error ? e.message : e)
}
`
testCode =
testCode.slice(0, pos) + narrationInject + testCode.slice(pos)
testCode.slice(0, pos) + introInject + testCode.slice(pos)
}
// Inject step-by-step annotate() calls wrapping each code block
// annotate(page, text, callback) shows subtitle + speaks TTS + runs action in parallel
@@ -2035,7 +2036,7 @@ export default withDemowright(baseConfig, {
keyboard: true,
cursorStyle: 'default',
keyFadeMs: 2000,
actionDelay: 500,
actionDelay: 1500,
audio: true,
autoAnnotate: true,
outputDir: '.demowright'

View File

@@ -26,6 +26,7 @@ const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url))
const RECORD_SCRIPT = resolve(SCRIPT_DIR, 'qa-record.ts')
const DEFAULT_REPO = 'Comfy-Org/ComfyUI_frontend'
const VALID_TARGETS = ['head', 'base', 'both'] as const
const CLOUD_FALLBACK_URL = 'https://testcloud.comfy.org/'
type PrTarget = (typeof VALID_TARGETS)[number]
type TargetType = 'issue' | 'pr'
@@ -58,9 +59,9 @@ if (!VALID_TARGETS.includes(prTarget)) {
process.exit(1)
}
// ── Ensure server is reachable ──
// ── Ensure server is reachable (may fall back to cloud) ──
await ensureServer(serverUrl)
const resolvedServerUrl = await ensureServer(serverUrl)
// ── Dispatch by mode ──
@@ -260,7 +261,7 @@ function runQaRecord(
'--output-dir',
outputDir,
'--url',
serverUrl
resolvedServerUrl
],
{ stdio: 'inherit', env: process.env }
)
@@ -269,10 +270,10 @@ function runQaRecord(
// ── Server management ──
async function ensureServer(url: string): Promise<void> {
async function ensureServer(url: string): Promise<string> {
if (await isReachable(url)) {
console.warn(`Server OK: ${url}`)
return
return url
}
console.warn(`Server not reachable at ${url}, attempting auto-start...`)
@@ -292,7 +293,7 @@ async function ensureServer(url: string): Promise<void> {
)
proc.unref()
await waitForServer(url, 120000)
return
return url
} catch {
// comfy-cli not available
}
@@ -308,24 +309,32 @@ async function ensureServer(url: string): Promise<void> {
})
proc.unref()
await waitForServer(url, 120000)
return
return url
}
// Strategy 3: clone ComfyUI and start
console.warn('No ComfyUI installation found, cloning...')
const cloneDir = resolve('.comfy-qa/ComfyUI')
try {
execSync(
`git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git "${cloneDir}"`,
{ stdio: 'inherit', timeout: 120000 }
)
console.warn('Installing ComfyUI dependencies...')
execSync('pip install -r requirements.txt', {
cwd: cloneDir,
stdio: 'inherit',
timeout: 300000
})
console.warn('Starting ComfyUI...')
if (!existsSync(resolve(cloneDir, 'main.py'))) {
console.warn('No ComfyUI installation found, cloning...')
try {
execSync(
`git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git "${cloneDir}"`,
{ stdio: 'inherit', timeout: 120000 }
)
console.warn('Installing ComfyUI dependencies...')
execSync('pip install -r requirements.txt', {
cwd: cloneDir,
stdio: 'inherit',
timeout: 300000
})
} catch (err) {
console.warn(
`Clone/install failed: ${err instanceof Error ? err.message : err}`
)
}
}
if (existsSync(resolve(cloneDir, 'main.py'))) {
console.warn(`Starting ComfyUI from ${cloneDir}...`)
const proc = spawn('python', ['main.py', '--cpu', '--port', port], {
cwd: cloneDir,
stdio: 'ignore',
@@ -333,19 +342,24 @@ async function ensureServer(url: string): Promise<void> {
})
proc.unref()
await waitForServer(url, 120000)
return
} catch (err) {
console.error(
`Failed to setup ComfyUI: ${err instanceof Error ? err.message : err}`
)
return url
}
// Strategy 4: fallback to testcloud
console.warn(`Local server failed. Falling back to ${CLOUD_FALLBACK_URL}`)
if (await isReachable(CLOUD_FALLBACK_URL)) {
console.warn(`Cloud server OK: ${CLOUD_FALLBACK_URL}`)
return CLOUD_FALLBACK_URL
}
console.error(`
Server not running at ${url} and auto-start failed.
No ComfyUI server available. Tried:
1. ${url} (not reachable)
2. comfy-cli (not installed)
3. Local ComfyUI installation (not found)
4. ${CLOUD_FALLBACK_URL} (not reachable)
Manual options:
pip install comfy-cli && comfy install && comfy launch --cpu
python /path/to/ComfyUI/main.py --cpu --port ${port}
Install: pip install comfy-cli && comfy install && comfy launch --cpu
`)
process.exit(1)
}
@@ -411,7 +425,7 @@ function resolveOutputDir(defaultPath: string): string {
function logHeader(opts: { label: string; outputDir: string; extra?: string }) {
console.warn(`QA target: ${opts.label}`)
console.warn(`Output: ${opts.outputDir}`)
console.warn(`Server: ${serverUrl}`)
console.warn(`Server: ${resolvedServerUrl}`)
if (values.ref) console.warn(`Ref: ${values.ref}`)
if (opts.extra) console.warn(opts.extra)
}