e2ed
Version:
E2E testing framework over Playwright
35 lines (34 loc) • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSummaryPackResults = void 0;
const internal_1 = require("../../constants/internal");
const getFailedTestsMainParams_1 = require("./getFailedTestsMainParams");
const MAX_FAILED_TESTS_COUNT = 8;
/**
* Get summary pack results (count of tests for each status).
* @internal
*/
const getSummaryPackResults = (fullTestRuns, lastRetry) => {
const allFailedTestsMainParams = (0, getFailedTestsMainParams_1.getFailedTestsMainParams)(lastRetry);
const failedTestsMainParams = allFailedTestsMainParams.slice(0, MAX_FAILED_TESTS_COUNT);
if (allFailedTestsMainParams.length > MAX_FAILED_TESTS_COUNT) {
failedTestsMainParams.push('...');
}
const printedFailedTests = ` (${failedTestsMainParams.join(', ')})`;
const countsOfStatuses = [];
for (const status of internal_1.ORDER_OF_TEST_RUN_STATUSES_FOR_DISPLAY) {
const source = internal_1.TEST_RUN_STATUSES_OF_UNIQUE_TESTS.includes(status)
? fullTestRuns
: lastRetry?.fullTestRuns;
const count = source?.filter((fullTestRun) => fullTestRun.status === status)?.length ?? 0;
if (count > 0) {
countsOfStatuses.push(`${count} ${status}`);
if (status === "failed" /* TestRunStatus.Failed */) {
countsOfStatuses[countsOfStatuses.length - 1] = `${String(countsOfStatuses.at(-1))}${printedFailedTests}`;
}
}
}
const printedCountsOfStatuses = countsOfStatuses.join(', ') || 'no tests were run';
return printedCountsOfStatuses;
};
exports.getSummaryPackResults = getSummaryPackResults;