UNPKG

e2ed

Version:

E2E testing framework over Playwright

35 lines (34 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiStatisticsItem = void 0; const renderDuration_1 = require("./renderDuration"); const renderDuration = renderDuration_1.renderDuration; /** * Renders singe item of `ApiStatistics` (pages, requests or resources). * This base client function should not use scope variables (except other base functions). * @internal */ const ApiStatisticsItem = ({ count, duration, isHeader, name, size, url, }) => { const bytesInKiB = 1_024; const durationHtml = renderDuration(duration / count); const countHtml = `${count}x`; const sizeHtml = size === undefined ? '' : `${(size / count / bytesInKiB).toFixed(2)} KiB / `; let nameHtml; if (isHeader) { nameHtml = jsx.createElement("b", null, name); } else if (url !== undefined) { nameHtml = (jsx.createElement("a", { href: url, rel: "noreferrer", target: "_blank" }, name)); } else { nameHtml = jsx.createElement(jsx.Fragment, null, name); } return (jsx.createElement("span", { class: "step-expanded step-expanded_is-empty" }, jsx.createElement("span", { class: "step-expanded__name" }, nameHtml), jsx.createElement("span", { class: "step-expanded__time" }, countHtml, " / ", sizeHtml, durationHtml))); }; exports.ApiStatisticsItem = ApiStatisticsItem;