playwright-testrail-sync
Version: 
TestRail Integration for Playwright with comprehensive logging and error handling
47 lines • 1.62 kB
JavaScript
;
/**
 * Attachment manager
 * Handles attachment storage and batch operations
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.storeTestAttachments = storeTestAttachments;
exports.uploadAttachmentsToResults = uploadAttachmentsToResults;
/**
 * Store test attachments for later upload to test results
 */
function storeTestAttachments(caseId, result, testAttachments, logger) {
    testAttachments.push({ caseId, result });
    logger.debug("Stored attachments for later upload", {
        caseId,
        attachmentCount: result.attachments?.length || 0,
    });
}
/**
 * Upload attachments to test results
 */
async function uploadAttachmentsToResults(testAttachments, state, options, apiClient, logger, getTestResultForCase, uploadAttachmentsToResult) {
    logger.verboseAttachment("Uploading attachments to test results", {
        attachmentCount: testAttachments.length,
    });
    for (const { caseId, result } of testAttachments) {
        try {
            // Get the test result ID for this case
            const testResult = await getTestResultForCase(caseId);
            if (testResult) {
                await uploadAttachmentsToResult(testResult.id, result);
            }
            else {
                logger.verbose("No test result found for case", {
                    caseId,
                });
            }
        }
        catch (error) {
            logger.error("Failed to upload attachments for case", {
                caseId,
                error: error.message,
            });
        }
    }
}
//# sourceMappingURL=attachment-manager.js.map