e2ed
Version:
E2E testing framework over Playwright
25 lines (24 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderApiStatisticsItem = renderApiStatisticsItem;
const sanitizeHtml_1 = require("../sanitizeHtml");
const renderDuration_1 = require("./renderDuration");
const renderDuration = renderDuration_1.renderDuration;
const sanitizeHtml = sanitizeHtml_1.sanitizeHtml;
/**
* Renders singe item of `ApiStatistics` (pages, requests or resources).
* This base client function should not use scope variables (except other base functions).
* @internal
*/
function renderApiStatisticsItem({ count, duration, isHeader, name, size, }) {
const bytesInKiB = 1_024;
const durationHtml = renderDuration(duration / count);
const countHtml = `${count}x`;
const nameHtml = isHeader ? sanitizeHtml `<b>${name}</b>` : sanitizeHtml `${name}`;
const sizeHtml = size === undefined ? '' : `${(size / count / bytesInKiB).toFixed(2)} KiB `;
return sanitizeHtml `
<span class="step-expanded step-expanded_is-empty">
<span class="step-expanded__name">${nameHtml}</span>
<span class="step-expanded__time">${countHtml} ${sizeHtml}${durationHtml}</span>
</span>`;
}