[eric] e2e: wire the visibility recorder into the combinatorial and round-trip specs so every action gets a per-test timeline file alongside the playwright trace

This commit is contained in:
Eric
2026-05-28 00:35:16 -07:00
parent ff93a24d74
commit 4e7b8a93e9
2 changed files with 18 additions and 2 deletions
+11 -1
View File
@@ -1,5 +1,6 @@
import { test, expect, ElectronApplication, Page, Locator } from '@playwright/test';
import { launchApp, waitForMainWindow } from '../helpers/launch';
import { startVisibility, VisibilityHandle } from '../helpers/visibility';
import fs from 'fs';
import os from 'os';
import path from 'path';
@@ -62,14 +63,23 @@ test.describe('combinatorial user flows', () => {
expect(fresh.map((e) => `${e.kind}: ${e.text}`).join('\n'), `unexpected errors during: ${label}`).toBe('');
};
let vis: VisibilityHandle;
test.beforeAll(async () => {
app = await launchApp();
page = await waitForMainWindow(app);
vis = await startVisibility(app, page, 'combinatorial-flows');
page.on('pageerror', (e) => errors.push({ kind: 'pageerror', text: String(e?.message ?? e) }));
page.on('console', (m) => { if (m.type() === 'error') errors.push({ kind: 'console', text: m.text() }); });
baselineCrashes = rendererCrashes();
});
test.afterAll(async () => { await app?.close().catch(() => {}); });
test.afterAll(async () => {
try { await vis?.stop(); } catch {}
await app?.close().catch(() => {});
});
// Per-test mark so events.jsonl is searchable by test name.
test.beforeEach(async ({}, info) => { vis?.mark('test-begin', { title: info.titlePath.join(' > ') }); });
test.afterEach(async ({}, info) => { vis?.mark('test-end', { title: info.titlePath.join(' > '), status: info.status }); });
// The "test the test" sanity check: prove our must() helper fails loudly when
// a target is missing. If this ever passes silently, every later assertion is
+7 -1
View File
@@ -1,5 +1,6 @@
import { test, expect, ElectronApplication, Page } from '@playwright/test';
import { launchApp, waitForMainWindow, hasAnyProviderKey } from '../helpers/launch';
import { startVisibility, VisibilityHandle } from '../helpers/visibility';
import fs from 'fs';
import os from 'os';
import path from 'path';
@@ -25,6 +26,7 @@ test.describe('real agent round-trip', () => {
let app: ElectronApplication;
let page: Page;
let baselineCrashes = 0;
let vis: VisibilityHandle;
// Whole describe skips with a clear reason when no key is wired, so we
// never silently green this on a leg that can't actually test it.
@@ -33,9 +35,13 @@ test.describe('real agent round-trip', () => {
test.skip(process.env.CI !== 'true' && process.env.OPENSWARM_E2E_SEED !== '1', 'seed gate not enabled; set OPENSWARM_E2E_SEED=1 for local runs');
app = await launchApp();
page = await waitForMainWindow(app);
vis = await startVisibility(app, page, 'real-agent-roundtrip');
baselineCrashes = crashCount();
});
test.afterAll(async () => { await app?.close().catch(() => {}); });
test.afterAll(async () => {
try { await vis?.stop(); } catch {}
await app?.close().catch(() => {});
});
test('compose, send, and receive an assistant reply', async ({}, info) => {
// Find the New Agent button on the dashboard toolbar.