mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
Three-phase pipeline triggered by labels (qa-changes, qa-full, qa-issue): 1. Research: Claude writes Playwright E2E tests to reproduce reported bugs 2. Reproduce: Deterministic replay with video recording 3. Report: Deploy results to Cloudflare Pages with badges Key design decisions: - Playwright assertions are source of truth (not AI vision) - Agent has readFixture/readTest tools to discover project patterns - Bug-specific assertions required (trivial assertions banned) - Main branch dist cached by SHA to speed up before/after comparisons - QA deps installed inline in CI (no package.json changes needed) Verified across 48 runs (22 PRs + 26 issues) with 0 false positives. Amp-Thread-ID: https://ampcode.com/threads/T-019d519b-004f-71ce-b970-96edd971fbe0 Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d519b-004f-71ce-b970-96edd971fbe0 Co-authored-by: Amp <amp@ampcode.com>
151 lines
3.8 KiB
TypeScript
151 lines
3.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
extractPlatformFromArtifactDirName,
|
|
pickLatestVideosByPlatform,
|
|
selectVideoCandidateByFile
|
|
} from './qa-video-review'
|
|
|
|
describe('extractPlatformFromArtifactDirName', () => {
|
|
it('extracts and normalizes known qa artifact directory names', () => {
|
|
expect(
|
|
extractPlatformFromArtifactDirName('qa-report-Windows-22818315023')
|
|
).toBe('windows')
|
|
expect(
|
|
extractPlatformFromArtifactDirName('qa-report-macOS-22818315023')
|
|
).toBe('macos')
|
|
expect(
|
|
extractPlatformFromArtifactDirName('qa-report-Linux-22818315023')
|
|
).toBe('linux')
|
|
})
|
|
|
|
it('falls back to slugifying unknown directory names', () => {
|
|
expect(extractPlatformFromArtifactDirName('custom platform run')).toBe(
|
|
'custom-platform-run'
|
|
)
|
|
})
|
|
})
|
|
|
|
describe('pickLatestVideosByPlatform', () => {
|
|
it('keeps only the latest candidate per platform', () => {
|
|
const selected = pickLatestVideosByPlatform([
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/windows-old.mp4',
|
|
mtimeMs: 100
|
|
},
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/windows-new.mp4',
|
|
mtimeMs: 200
|
|
},
|
|
{
|
|
platformName: 'linux',
|
|
videoPath: '/tmp/linux.mp4',
|
|
mtimeMs: 150
|
|
}
|
|
])
|
|
|
|
expect(selected).toEqual([
|
|
{
|
|
platformName: 'linux',
|
|
videoPath: '/tmp/linux.mp4',
|
|
mtimeMs: 150
|
|
},
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/windows-new.mp4',
|
|
mtimeMs: 200
|
|
}
|
|
])
|
|
})
|
|
})
|
|
|
|
describe('selectVideoCandidateByFile', () => {
|
|
it('selects a single candidate by artifacts-relative path', () => {
|
|
const selected = selectVideoCandidateByFile(
|
|
[
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Windows-1/qa-session.mp4',
|
|
mtimeMs: 100
|
|
},
|
|
{
|
|
platformName: 'linux',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Linux-1/qa-session.mp4',
|
|
mtimeMs: 200
|
|
}
|
|
],
|
|
{
|
|
artifactsDir: '/tmp/qa-artifacts',
|
|
videoFile: 'qa-report-Linux-1/qa-session.mp4'
|
|
}
|
|
)
|
|
|
|
expect(selected).toEqual({
|
|
platformName: 'linux',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Linux-1/qa-session.mp4',
|
|
mtimeMs: 200
|
|
})
|
|
})
|
|
|
|
it('throws when basename matches multiple videos', () => {
|
|
expect(() =>
|
|
selectVideoCandidateByFile(
|
|
[
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Windows-1/qa-session.mp4',
|
|
mtimeMs: 100
|
|
},
|
|
{
|
|
platformName: 'linux',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Linux-1/qa-session.mp4',
|
|
mtimeMs: 200
|
|
}
|
|
],
|
|
{
|
|
artifactsDir: '/tmp/qa-artifacts',
|
|
videoFile: 'qa-session.mp4'
|
|
}
|
|
)
|
|
).toThrow('matched 2 videos')
|
|
})
|
|
|
|
it('throws when there is no matching video', () => {
|
|
expect(() =>
|
|
selectVideoCandidateByFile(
|
|
[
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Windows-1/qa-session.mp4',
|
|
mtimeMs: 100
|
|
}
|
|
],
|
|
{
|
|
artifactsDir: '/tmp/qa-artifacts',
|
|
videoFile: 'qa-report-macOS-1/qa-session.mp4'
|
|
}
|
|
)
|
|
).toThrow('No video matched')
|
|
})
|
|
|
|
it('throws when video file is missing', () => {
|
|
expect(() =>
|
|
selectVideoCandidateByFile(
|
|
[
|
|
{
|
|
platformName: 'windows',
|
|
videoPath: '/tmp/qa-artifacts/qa-report-Windows-1/qa-session.mp4',
|
|
mtimeMs: 100
|
|
}
|
|
],
|
|
{
|
|
artifactsDir: '/tmp/qa-artifacts',
|
|
videoFile: ' '
|
|
}
|
|
)
|
|
).toThrow('--video-file is required')
|
|
})
|
|
})
|