UNPKG

e2ed

Version:

E2E testing framework over Playwright

29 lines (28 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.maybeRenderApiStatistics = maybeRenderApiStatistics; const render_1 = require("./render"); const renderApiStatistics = render_1.renderApiStatistics; /** * Renders `ApiStatistics` by `runHash`, if this is a one of kind of `ApiStatistics` hash * (pages, requests or resources). * This base client function should not use scope variables (except other base functions). * @internal */ function maybeRenderApiStatistics(runHash) { const hash = String(runHash); const pagesHash = 'api-statistics-pages'; const requestsHash = 'api-statistics-requests'; const resourcesHash = 'api-statistics-resources'; if (hash !== pagesHash && hash !== requestsHash && hash !== resourcesHash) { return; } const { reportClientData } = reportClientState; if (reportClientData === undefined) { // eslint-disable-next-line no-console console.error(`Cannot find report client data in JSON report data (tried to click "${hash}"). Probably JSON report data not yet completely loaded. Please try click again later`); return; } const { apiStatistics } = reportClientData; return renderApiStatistics({ apiStatistics, hash }); }