html-reporter
Version:
Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.
93 lines • 2.6 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReporterTestAdapter = void 0;
const lodash_1 = __importDefault(require("lodash"));
const utils_1 = require("./utils");
const common_utils_1 = require("../../common-utils");
// This class is primarily useful when cloning ReporterTestResult.
// It allows to override some properties while keeping computable
// properties valid, e.g. id
class ReporterTestAdapter {
constructor(testResult) {
this._testResult = testResult;
this._errorDetails = this._testResult.errorDetails || null;
}
get attempt() {
return this._testResult.attempt;
}
get browserId() {
return this._testResult.browserId;
}
get description() {
return this._testResult.description;
}
get error() {
return this._testResult.error;
}
get errorDetails() {
if (!lodash_1.default.isNil(this._errorDetails)) {
return this._errorDetails;
}
this._errorDetails = (0, utils_1.extractErrorDetails)(this);
return this._errorDetails;
}
get file() {
return this._testResult.file;
}
get fullName() {
return this._testResult.fullName;
}
get history() {
return this._testResult.history;
}
get id() {
return (0, common_utils_1.getTestHash)(this);
}
get imageDir() {
return (0, common_utils_1.getShortMD5)(this.fullName);
}
get imagesInfo() {
return this._testResult.imagesInfo;
}
get meta() {
return this._testResult.meta;
}
get multipleTabs() {
return this._testResult.multipleTabs;
}
get screenshot() {
return this.error?.screenshot;
}
get sessionId() {
return this._testResult.sessionId;
}
get skipReason() {
return this._testResult.skipReason;
}
get state() {
return { name: this.testPath.at(-1) };
}
get status() {
return this._testResult.status;
}
get testPath() {
return this._testResult.testPath;
}
get timestamp() {
return this._testResult.timestamp;
}
get url() {
return this._testResult.url;
}
get duration() {
return this._testResult.duration;
}
get attachments() {
return this._testResult.attachments;
}
}
exports.ReporterTestAdapter = ReporterTestAdapter;
//# sourceMappingURL=reporter.js.map