UNPKG

playwright-msteams-reporter-conditional

Version:

Microsoft Teams reporter for Playwright which allows you to send notifications about the status of your E2E tests.

45 lines (44 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTotalStatus = exports.getFailedTests = void 0; const getFailedTests = (suites) => { let ret = []; for (const suite of suites) { suite.allTests().map((test) => { const outcome = test.outcome(); if (outcome === 'unexpected') ret.push(test.parent.title + ' - ' + test.title); }); } return ret; }; exports.getFailedTests = getFailedTests; const getTotalStatus = (suites) => { let total = { passed: 0, flaky: 0, failed: 0, skipped: 0, }; for (const suite of suites) { const testOutcome = suite.allTests().map((test) => { return test.outcome(); }); for (const outcome of testOutcome) { if (outcome === "expected") { total.passed++; } else if (outcome === "flaky") { total.flaky++; } else if (outcome === "unexpected") { total.failed++; } else if (outcome === "skipped") { total.skipped++; } } } return total; }; exports.getTotalStatus = getTotalStatus;