UNPKG

e2ed

Version:

E2E testing framework over Playwright

27 lines (26 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderSteps = renderSteps; const assertValueIsDefined_1 = require("../assertValueIsDefined"); const sanitizeHtml_1 = require("../sanitizeHtml"); const renderStep_1 = require("./renderStep"); const assertValueIsDefined = assertValueIsDefined_1.assertValueIsDefined; const createSafeHtmlWithoutSanitize = sanitizeHtml_1.createSafeHtmlWithoutSanitize; const renderStep = renderStep_1.renderStep; /** * Renders list of step of test run. * This base client function should not use scope variables (except other base functions). * @internal */ function renderSteps({ endTimeInMs, logEvents }) { const stepHtmls = []; for (let index = 0; index < logEvents.length; index += 1) { const logEvent = logEvents[index]; assertValueIsDefined(logEvent); const nextLogEvent = logEvents[index + 1]; const nextLogEventTime = nextLogEvent?.time ?? endTimeInMs; const stepHtml = renderStep({ logEvent, nextLogEventTime }); stepHtmls.push(stepHtml); } return createSafeHtmlWithoutSanitize `${stepHtmls.join('')}`; }