e2ed
Version:
E2E testing framework over Playwright
30 lines (29 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeApiStatistics = void 0;
const ApiStatistics_1 = require("./ApiStatistics");
const ApiStatistics = ApiStatistics_1.ApiStatistics;
/**
* 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
*/
const MaybeApiStatistics = ({ 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 jsx.createElement(jsx.Fragment, null);
}
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 jsx.createElement(jsx.Fragment, null);
}
const { apiStatistics } = reportClientData;
return jsx.createElement(ApiStatistics, { apiStatistics: apiStatistics, hash: hash });
};
exports.MaybeApiStatistics = MaybeApiStatistics;