e2ed
Version:
E2E testing framework over Playwright
55 lines (54 loc) • 2.82 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestRunDescription = void 0;
const parseMarkdownLinks_1 = require("../parseMarkdownLinks");
const DatesInterval_1 = require("./DatesInterval");
const Duration_1 = require("./Duration");
const List_1 = require("./List");
const parseMarkdownLinks = parseMarkdownLinks_1.parseMarkdownLinks;
const DatesInterval = DatesInterval_1.DatesInterval;
const Duration = Duration_1.Duration;
const List = List_1.List;
/**
* Renders tag `<dl class="test-description">` with test run description.
* The value strings of meta can contain links in markdown format.
* This base client function should not use scope variables (except other base functions).
* @internal
*/
const TestRunDescription = ({ fullTestRun }) => {
const { endTimeInMs, outputDirectoryName, runError, startTimeInMs } = fullTestRun;
const { meta } = fullTestRun.options;
const metaHtmls = [];
for (const [key, value] of Object.entries(meta)) {
const valueWithLinks = parseMarkdownLinks `${value}`;
const metaHtml = (jsx.createElement(jsx.Fragment, null,
jsx.createElement("dt", { class: "test-description__term" }, key),
' ',
jsx.createElement("dd", { class: "test-description__definition" }, valueWithLinks)));
metaHtmls.push(metaHtml);
}
let traceHtml = jsx.createElement(jsx.Fragment, null);
if (runError !== undefined) {
const { internalDirectoryName } = reportClientState;
const traceLabel = 'Download trace';
const traceName = 'trace.zip';
const traceUrl = `./${internalDirectoryName}/${outputDirectoryName}/${traceName}`;
traceHtml = (jsx.createElement(jsx.Fragment, null,
jsx.createElement("dt", { class: "test-description__term" }, traceLabel),
' ',
jsx.createElement("dd", { class: "test-description__definition" },
jsx.createElement("a", { href: traceUrl, download: traceName, "aria-label": traceLabel }, traceName))));
}
return (jsx.createElement("dl", { class: "test-description", "aria-label": "Test meta data" },
jsx.createElement(List, { elements: metaHtmls }),
traceHtml,
jsx.createElement("dt", { class: "test-description__term" }, "Date"),
' ',
jsx.createElement("dd", { class: "test-description__definition" },
jsx.createElement(DatesInterval, { endTimeInMs: endTimeInMs, startTimeInMs: startTimeInMs })),
jsx.createElement("dt", { class: "test-description__term" }, "Duration"),
' ',
jsx.createElement("dd", { class: "test-description__definition" },
jsx.createElement(Duration, { durationInMs: endTimeInMs - startTimeInMs }))));
};
exports.TestRunDescription = TestRunDescription;