UNPKG

@chtsinc/ch-playwright-report

Version:

Custom Playwright Reporter that logs test and execution results to MongoDB

37 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExecutionReportUtil = void 0; const ch_javascript_sdk_1 = require("@chtsinc/ch-javascript-sdk"); const execution_env_setup_1 = require("../reporter-setup/execution-env-setup"); class ExecutionReportUtil { static createExecutionReport(executionContext) { const executionReport = new ch_javascript_sdk_1.ExecutionReport(executionContext.executionId, executionContext.subscriptionKey, executionContext.site); executionReport.project = executionContext.project; executionReport.applicationName = executionContext.applicationName; executionReport.testType = this.resolveTestType(executionContext.testType); executionReport.environmentInfo = execution_env_setup_1.ExecutionEnvSetup.createEnvironmentInfo(executionContext); return executionReport; } static finalizeExecutionReport(executionReport) { executionReport.endDateTime = new Date(); return executionReport; } static setReportUrl(executionReport, reportUrl) { executionReport.additionalInfo.set("AZURE_HTMLREPORT_URL", reportUrl); return executionReport; } static resolveTestType(testType) { switch (testType?.toLowerCase()) { case "app": return ch_javascript_sdk_1.TestType.APP; case "api": return ch_javascript_sdk_1.TestType.API; case "web": default: return ch_javascript_sdk_1.TestType.WEB; } } } exports.ExecutionReportUtil = ExecutionReportUtil; //# sourceMappingURL=execution-report-util.js.map