fix: exclude known video names when renaming Playwright recordings

The AFTER step was renaming qa-before-session.webm instead of the new
recording. Filter out already-named files before picking the latest.
This commit is contained in:
snomiao
2026-03-21 00:00:28 +00:00
parent ae29224874
commit 99e6681237

View File

@@ -409,7 +409,10 @@ async function main() {
// Rename the recorded video to expected filename
const videoName =
opts.mode === 'before' ? 'qa-before-session.webm' : 'qa-session.webm'
const files = readdirSync(opts.outputDir).filter((f) => f.endsWith('.webm'))
const knownNames = new Set(['qa-before-session.webm', 'qa-session.webm'])
const files = readdirSync(opts.outputDir).filter(
(f) => f.endsWith('.webm') && !knownNames.has(f)
)
if (files.length > 0) {
const recorded = files[files.length - 1]
renameSync(