Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Stabilize E2E tier test identity

pulse-triage[bot]974f102333d5
diff --git a/tests/integration/scripts/check-e2e-tiering.mjs b/tests/integration/scripts/check-e2e-tiering.mjs
index 617b97183d..fb2c3cb4e8 100644
--- a/tests/integration/scripts/check-e2e-tiering.mjs
+++ b/tests/integration/scripts/check-e2e-tiering.mjs
@@ -9,6 +9,7 @@ import {
PROBATION_SPECS,
QUARANTINED_SPECS,
} from '../e2e-tiering.mjs';
+import { parsePlaywrightTestIdentity } from './e2e-tier-identity.mjs';
const integrationRoot = path.resolve(fileURLToPath(new URL('..', import.meta.url)));
const testsRoot = path.join(integrationRoot, 'tests');
@@ -79,12 +80,12 @@ function listPlaywrightTests(tier) {
const tests = new Map();
for (const rawLine of result.stdout.split('\n')) {
- const line = rawLine.replace(/\x1b\[[0-9;]*m/g, '');
- const match = line.match(/^\s*\[([^\]]+)\] › ((.+?\.spec\.ts):\d+:\d+ › .+)$/);
- if (!match) continue;
- const key = `[${match[1]}] › ${match[2]}`;
- if (tests.has(key)) throw new Error(`Playwright listed a duplicate test: ${key}`);
- tests.set(key, match[3]);
+ const identity = parsePlaywrightTestIdentity(rawLine);
+ if (!identity) continue;
+ if (tests.has(identity.key)) {
+ throw new Error(`Playwright listed a duplicate test: ${identity.key}`);
+ }
+ tests.set(identity.key, identity.specFile);
}
return tests;
}
diff --git a/tests/integration/scripts/e2e-tier-identity.mjs b/tests/integration/scripts/e2e-tier-identity.mjs
new file mode 100644
index 0000000000..0350a96e34
--- /dev/null
+++ b/tests/integration/scripts/e2e-tier-identity.mjs
@@ -0,0 +1,17 @@
+const PLAYWRIGHT_LIST_LINE = /^\s*\[([^\]]+)\] › (.+?\.spec\.ts):\d+:\d+ › (.+)$/;
+
+// Playwright's transform cache can report the same test at its authored line
+// on one --list process and at a transformed line on the next. Source
+// coordinates are presentation metadata, not test identity; tier accounting
+// is project + spec + title.
+export function parsePlaywrightTestIdentity(rawLine) {
+ const line = rawLine.replace(/\x1b\[[0-9;]*m/g, '');
+ const match = line.match(PLAYWRIGHT_LIST_LINE);
+ if (!match) return null;
+
+ const [, project, specFile, title] = match;
+ return {
+ key: `[${project}] › ${specFile} › ${title}`,
+ specFile,
+ };
+}
diff --git a/tests/integration/scripts/e2e-tier-identity.test.mjs b/tests/integration/scripts/e2e-tier-identity.test.mjs
new file mode 100644
index 0000000000..016fcf9079
--- /dev/null
+++ b/tests/integration/scripts/e2e-tier-identity.test.mjs
@@ -0,0 +1,32 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+
+import { parsePlaywrightTestIdentity } from './e2e-tier-identity.mjs';
+
+test('tier identity ignores unstable Playwright source coordinates', () => {
+ const authored = parsePlaywrightTestIdentity(
+ ' [chromium] › 59-workloads-column-layout.spec.ts:148:3 › Workloads column layout › keeps Type readable',
+ );
+ const transformed = parsePlaywrightTestIdentity(
+ ' [chromium] › 59-workloads-column-layout.spec.ts:97:3 › Workloads column layout › keeps Type readable',
+ );
+
+ assert.deepEqual(authored, transformed);
+ assert.deepEqual(authored, {
+ key: '[chromium] › 59-workloads-column-layout.spec.ts › Workloads column layout › keeps Type readable',
+ specFile: '59-workloads-column-layout.spec.ts',
+ });
+});
+
+test('tier identity retains project, spec, and complete title path', () => {
+ assert.equal(parsePlaywrightTestIdentity('unrelated output'), null);
+ assert.deepEqual(
+ parsePlaywrightTestIdentity(
+ '\u001b[2m [mobile-safari] › nested/example.spec.ts:10:7 › suite › test\u001b[22m',
+ ),
+ {
+ key: '[mobile-safari] › nested/example.spec.ts › suite › test',
+ specFile: 'nested/example.spec.ts',
+ },
+ );
+});