mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: address review nitpicks in test-recorder
- Guard box() against empty lines array (RangeError on Math.max) - Sanitize testName in recording template to prevent injection
This commit is contained in:
@@ -25,6 +25,8 @@ export function generateRecordingTemplate(
|
||||
? ` // Load the selected workflow\n await comfyPage.workflow.loadWorkflow('${options.workflow.replace(/'/g, "\\'")}')\n await comfyPage.nextFrame()\n`
|
||||
: ''
|
||||
|
||||
const safeName = options.testName.replace(/[`$\\]/g, '')
|
||||
|
||||
const code = `/**
|
||||
* Auto-generated recording session.
|
||||
* This file is temporary — it will be deleted after recording.
|
||||
@@ -36,7 +38,7 @@ import {
|
||||
comfyExpect as expect
|
||||
} from '../fixtures/ComfyPage'
|
||||
|
||||
test('recording: ${options.testName}', async ({ comfyPage }) => {
|
||||
test('recording: ${safeName}', async ({ comfyPage }) => {
|
||||
${workflowLine}
|
||||
// ┌────────────────────────────────────────────────────────┐
|
||||
// │ The Playwright Inspector will open. │
|
||||
|
||||
@@ -32,6 +32,7 @@ export function header(text: string) {
|
||||
}
|
||||
|
||||
export function box(lines: string[]) {
|
||||
if (lines.length === 0) return
|
||||
const maxLen = Math.max(...lines.map((l) => l.length))
|
||||
const border = '─'.repeat(maxLen + 4)
|
||||
console.log(` ┌${border}┐`)
|
||||
|
||||
Reference in New Issue
Block a user