tdpw
Version:
CLI tool for uploading Playwright test reports to TestDino platform with Azure storage support
116 lines • 3.9 kB
TypeScript
/**
* Enhanced Upload Service - Complete Integration
* Implements the full upload flow: Azure files → JSON + URLs → TestDino API
*/
import type { Config } from '../config';
import { ReportUploadResponse } from './api';
/**
* Service to upload Playwright report and metadata to TestDino
*/
export declare class UploadService {
private readonly config;
private readonly apiClient;
private readonly sasService;
constructor(config: Config);
/**
* Get report directory from JSON file path
*/
private getReportDirectory;
/**
* Generate unique Azure blob path for attachment using UUID
* This eliminates any possibility of path collisions regardless of directory structure
*/
private createJsonAttachmentPath;
/**
* Generate a unique identifier for attachments
* Uses timestamp + random string for uniqueness
*/
private generateUniqueId;
/**
* Extract file extension from attachment info
*/
private getFileExtension;
/**
* Main upload orchestration method
* Flow: Collect Metadata → Upload Azure Files → Send JSON + URLs to API
*/
uploadReport(jsonPath: string, htmlDir?: string, traceDir?: string): Promise<ReportUploadResponse>;
/**
* Collect all metadata with ZERO data loss guarantee
* CRITICAL: Each collector has fallbacks - never fails completely
*/
private collectMetadata;
/**
* Collect Git metadata with comprehensive error handling
*/
private collectGitMetadataWithFallback;
/**
* Collect CI metadata with error handling
*/
private collectCiMetadataWithFallback;
/**
* Collect System metadata with error handling
*/
private collectSystemMetadataWithFallback;
/**
* Fallback Git metadata when all collection methods fail
*/
private getGitMetadataFallback;
/**
* Fallback CI metadata when collection fails
*/
private getCiMetadataFallback;
/**
* Fallback System metadata when collection fails
*/
private getSystemMetadataFallback;
/**
* STRICT ENFORCEMENT: Validate we have required files/directories after auto-discovery
* FAILS HARD if user enabled options but we can't deliver what they requested
*/
private enforceStrictUploadRequirements;
/**
* Validate directory is accessible and contains expected content
*/
private validateDirectoryAccess;
/**
* STRICT ENFORCEMENT: Validate critical metadata is available
* FAILS HARD if essential metadata is missing when uploads are enabled
*/
private enforceStrictMetadataRequirements;
/**
* Validate and sanitize path prefix from SAS response
* CRITICAL: Ensures reliable URL generation even with malformed server responses
*/
private validateAndSanitizePathPrefix;
/**
* Validate SAS response completeness and generate safe fallbacks
*/
private validateSasResponse;
/**
* Implement basic upload resume logic for failed uploads
* Retries failed uploads with exponential backoff
*/
/**
* Extract test configuration metadata from Playwright report
*/
private extractTestMetadata;
/**
* Extract reporter configuration from Playwright config
*/
private extractReporterConfig;
/**
* Upload HTML, trace files, and attachments to Azure storage with proper directory structure
*/
private uploadToAzure;
/**
* Build the final payload combining base report + metadata + Azure URLs
* This must match the exact structure from sample-report.json
*/
private buildFinalPayload;
/**
* Upload with graceful fallback for failed Azure uploads
*/
uploadWithFallback(jsonPath: string, htmlDir?: string, traceDir?: string): Promise<ReportUploadResponse>;
}
//# sourceMappingURL=upload.d.ts.map