/** * Extra attachment with button that copies prompt to clipboard. */ import { escapeHtml } from '../../../utils'; import { createLogAttachment } from '../attachments/helpers'; export function createPromptAttachmentWithButton( testCaseStartedId: string | undefined, testStepId: string | undefined, prompt: string, ) { const html = createPromptAttachmentHtml(prompt); return createLogAttachment(testCaseStartedId, testStepId, html); } function createPromptAttachmentHtml(prompt: string) { const escapedPrompt = escapeHtml(JSON.stringify(prompt)); return [ ``, `Open ChatGPT`, ].join(' | '); } /** * Custom script - setup "Copy prompt" button click handlers. */ export const scriptCopyPrompt = ` `;