/** * Generates a short unique filename from screenshot path * If original filename is too long, uses hash-based name * * @param {string} screenshotPath - Path to screenshot file * @returns {string} Short filename (max 80 chars) */ export function generateShortFilename(screenshotPath: string): string; /** * Formats a step object according to Testomat.io Step Schema * * This function transforms a raw step object from test frameworks (CodeceptJS, Playwright, etc.) * into a standardized format compatible with Testomat.io API. It ensures all text fields are * truncated to 250 characters as defined in testomat-api-definition.yml. * * Processed fields: * - category: step type (framework, user, hook) - defaults to 'user' * - title: step name/description, truncated to 250 chars * - duration: step execution time in seconds * - log: optional log output, truncated to 250 chars * - artifacts: optional array of artifact URLs (screenshots), each truncated to 250 chars * - error: error details (message + stack) if step failed, each truncated to 250 chars * - steps: recursively formats nested steps * * Schema reference: testomat-api-definition.yml (Step object) * * @param {Object} step - Raw step object from test framework * @param {string} [step.category] - Step category: 'user', 'framework', or 'hook' * @param {string} [step.title] - Step title/name * @param {number} [step.duration] - Step duration in seconds * @param {string} [step.log] - Log output for this step * @param {string[]} [step.artifacts] - Array of artifact URLs (screenshots) * @param {string|Object} [step.error] - Error details - can be string or object with message/stack * @param {Object[]} [step.steps] - Array of nested child steps * @returns {Object} Formatted step object matching Testomat.io Step Schema with: * category, title, duration, and optional log, artifacts, error, and steps fields * * @example * const rawStep = { * category: 'user', * title: 'I click on button', * duration: 1.5, * error: { message: 'Element not found', stack: 'at test.js:10:5' } * }; * const formatted = formatStep(rawStep); * // Returns: { category: 'user', title: 'I click on button', duration: 1.5, error: {...} } */ export function formatStep(step: { category?: string; title?: string; duration?: number; log?: string; artifacts?: string[]; error?: string | any; steps?: any[]; }): any; /** * Adds status field to step * * Normalizes step status from test frameworks to Testomat.io standard format. * Maps framework-specific statuses ('success', 'failed', 'passed') to Testomat.io * standard values ('passed', 'failed'). * * Status mapping: * - 'success' → 'passed' * - 'passed' → 'passed' * - 'failed' → 'failed' * - Any other value → 'passed' (default) * * If step already has a status, it won't be overwritten. If error is provided * and step doesn't have status, it will be set to 'failed'. * * Schema reference: testomat-api-definition.yml (Step.status enum) * * @param {Object} step - Step object to add status to (modified in place) * @param {string} [step.status] - Existing status (won't be overwritten if present) * @param {string} status - Status from test framework: 'success', 'failed', or 'passed' * @param {Error|Object|null} err - Error object if step failed * @returns {Object} The same step object with added status field * * @example * const step = { title: 'Click button' }; * addStatusToStep(step, 'success', null); * // step.status === 'passed' * * @example * const step2 = { title: 'Find element' }; * addStatusToStep(step2, 'failed', new Error('Not found')); * // step2.status === 'failed' */ export function addStatusToStep(step: { status?: string; }, status: string, err: Error | any | null): any; /** * Adds screenshot to step as artifacts array * * Extracts screenshot path from artifacts and adds it to the step's artifacts array. * The actual upload will happen in the client's addTestRun method. * * Artifact format supports: * - Array format: [{ screenshot: '/path/to/screenshot.png' }] * - Object format: { screenshot: '/path/to/screenshot.png' } * * Screenshot path can be specified as: * - Object with path property: { screenshot: { path: '/path/to/file.png' } } * - Object with screenshot property: { screenshot: { screenshot: '/path/to/file.png' } } * - Direct string path: { screenshot: '/path/to/file.png' } * * @param {Object} step - Step object to add artifacts to (modified in place) * @param {string[]} [step.artifacts] - Existing artifacts array (won't be overwritten if present) * @param {Object|Object[]|null} artifacts - Artifacts from test framework * @returns {Object} The same step object with artifacts array added * * @example * const step = { title: 'Click button' }; * const artifacts = { screenshot: '/tmp/screenshot.png' }; * addArtifactsToStep(step, artifacts); * // step.artifacts === ['/tmp/screenshot.png'] */ export function addArtifactsToStep(step: { artifacts?: string[]; }, artifacts: any | any[] | null): any; /** * Appends one artifact path to a step. * * Unlike addArtifactsToStep, this helper accepts a direct path (or URL-like string) * and does not check file existence, so callers can attach fallback artifacts * collected from logs or async trace outputs. * * @param {Object} step - Step object to update (modified in place) * @param {string} artifactPath - Artifact path to append * @returns {Object} The same step object with updated artifacts */ export function addArtifactPathToStep(step: any, artifactPath: string): any;