Files
Pulse/tests/integration/scripts/report-stable-e2e-failures.test.mjs
rcourtman b92893351d Make release dry-run diagnostics fail closed (#1758)
* Make release dry-run diagnostics fail closed

Select the installed Chromium project with retries disabled, replace the unconditional pass with fail-closed API and rendered-UI readiness assertions, retain actionable runtime evidence, and guard the release workflow contract against regression.

Contract-Neutral: Release diagnostic and workflow verification hardening only; no product runtime contract changes.

* Expose stable E2E failure identities

Project Playwright JUnit failures into bounded GitHub annotations so repeated stable-tier failures can be diagnosed without rerunning or weakening the gate. Keep the full reports and runtime logs as the forensic record, and cover annotation parsing and escaping with deterministic tests.

Contract-Neutral: This changes CI failure observability only and does not alter product runtime behavior, stable-tier membership, retries, or verdict semantics.

---------

Co-authored-by: rcourtman <rcourtman@users.noreply.github.com>
2026-08-22 07:28:29 +01:00

58 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import assert from 'node:assert/strict';
import test from 'node:test';
import {
githubAnnotations,
parseFailedTestcases,
} from './report-stable-e2e-failures.mjs';
test('extracts failed and errored Playwright testcases without reporting passes', () => {
const xml = `<?xml version="1.0"?>
<testsuites>
<testcase name="passes" classname="chromium › 63-pbs-active-tasks.spec.ts › PBS active tasks" />
<testcase name="shows a running task" classname="chromium › 63-pbs-active-tasks.spec.ts › PBS active tasks">
<failure message="63-pbs-active-tasks.spec.ts:83:3 shows a running task"><![CDATA[[chromium] › stable test
Error: Expected "running" but received "stopped"]]></failure>
</testcase>
<testcase name="loads history" classname="chromium › journeys/07-audit-log-resilience.spec.ts › audit log">
<error><![CDATA[Timeout 10000ms exceeded
at tests/journeys/07-audit-log-resilience.spec.ts:30:1]]></error>
</testcase>
</testsuites>`;
assert.deepEqual(parseFailedTestcases(xml), [
{
file: 'tests/integration/tests/63-pbs-active-tasks.spec.ts',
message: 'Error: Expected "running" but received "stopped"',
name: 'shows a running task',
},
{
file: 'tests/integration/tests/journeys/07-audit-log-resilience.spec.ts',
message: 'Timeout 10000ms exceeded',
name: 'loads history',
},
]);
});
test('emits bounded GitHub annotations with command escaping', () => {
assert.deepEqual(
githubAnnotations([
{
file: 'tests/integration/tests/example.spec.ts',
message: 'expected 100%, got 0%\nsecond line',
name: 'renders: cards, tables',
},
]),
[
'::error file=tests/integration/tests/example.spec.ts,title=Stable E2E failure%3A renders%3A cards%2C tables::expected 100%25, got 0%25%0Asecond line',
],
);
});
test('keeps a failed stable step observable when JUnit has no testcase failure', () => {
assert.match(
githubAnnotations([])[0],
/^::error title=Stable E2E failure details unavailable::/,
);
});