Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Retain traces for failed e2e stability detector attempts (#7353)
Nick Gomez659bf2657117
diff --git a/packages/app/playwright.config.ts b/packages/app/playwright.config.tsindex fc27cb600..4fd138f9a 100644--- a/packages/app/playwright.config.ts+++ b/packages/app/playwright.config.ts@@ -32,6 +32,8 @@ import { SETUP_NON_RESULT_REPORTER } from './tests/stress/_helpers/setup-non-res*/const isCI = !!process.env.CI;+const traceSnapshotsOff = process.env.OK_E2E_TRACE_SNAPSHOTS === 'off';+/*** Logical CPUs one worker occupies. Since the per-worker-server migration a* worker is not just a browser: it owns a Vite dev server, a Hocuspocus CRDT@@ -146,9 +148,7 @@ export default defineConfig({// crops the sidebar in narrow-viewport tests. Retained only on failure to// bound storage growth.video: { mode: 'retain-on-failure', size: { width: 1280, height: 720 } },- // 'on-first-retry' captures trace on retry 1 only; subsequent retries skip- // to stay under the CI runtime envelope.- trace: 'on-first-retry',+ trace: traceSnapshotsOff ? { mode: 'on-first-retry', snapshots: false } : 'on-first-retry',screenshot: 'only-on-failure',},});diff --git a/packages/app/tests/meta/playwright-trace-snapshots.test.ts b/packages/app/tests/meta/playwright-trace-snapshots.test.tsnew file mode 100644index 000000000..fffc34645--- /dev/null+++ b/packages/app/tests/meta/playwright-trace-snapshots.test.ts@@ -0,0 +1,32 @@+import { afterEach, describe, expect, test, vi } from 'vitest';++async function loadE2eConfig(traceSnapshots: string | undefined) {+ vi.stubEnv('OK_E2E_TRACE_SNAPSHOTS', traceSnapshots);+ vi.resetModules();+ return (await import('../../playwright.config')).default;+}++afterEach(() => {+ vi.unstubAllEnvs();+ vi.resetModules();+});++describe('playwright trace snapshots', () => {+ test('the stability detector gate records traces without DOM snapshots', async () => {+ const config = await loadE2eConfig('off');+ expect(config.use?.trace).toEqual({ mode: 'on-first-retry', snapshots: false });+ });++ test('without the gate, first-retry traces keep their DOM snapshots', async () => {+ const config = await loadE2eConfig(undefined);+ expect(config.use?.trace).toBe('on-first-retry');+ });++ test.each(['', 'on', 'false'])(+ 'a gate value other than off (%j) keeps DOM snapshots',+ async (value) => {+ const config = await loadE2eConfig(value);+ expect(config.use?.trace).toBe('on-first-retry');+ },+ );+});diff --git a/packages/app/tests/stress/chat-explicit-hide-late-restore.e2e.ts b/packages/app/tests/stress/chat-explicit-hide-late-restore.e2e.tsindex 327218596..5759f19ed 100644--- a/packages/app/tests/stress/chat-explicit-hide-late-restore.e2e.ts+++ b/packages/app/tests/stress/chat-explicit-hide-late-restore.e2e.ts@@ -7,6 +7,9 @@ import type { WebSocketRoute } from '@playwright/test';import { dockUnitRect, expect, test, waitForActiveProviderSynced } from './_helpers';import { startHiddenChatAgent } from './hidden-chat-transport.test-helper';+// WARN: tracing perturbs the focus race this file's thread-tab toBeFocused assertion depends on.+test.use({ trace: 'off' });+test('a hidden Chat stays hidden through late thread restoration until its shortcut reveals it', async ({page,context,diff --git a/packages/app/tests/stress/frozen-table-headers.e2e.ts b/packages/app/tests/stress/frozen-table-headers.e2e.tsindex 2a9fc3df8..d0752d37e 100644--- a/packages/app/tests/stress/frozen-table-headers.e2e.ts+++ b/packages/app/tests/stress/frozen-table-headers.e2e.ts@@ -1,5 +1,8 @@import { expect, test, waitForActiveProviderSynced } from './_helpers';+// WARN: trace DOM snapshots force layouts that this file's LayoutCount assertion counts.+test.use({ trace: 'off' });+const LONG_TABLE_MARKDOWN = `# Metric Tracker| Metric | Count | Revenue | Growth |diff --git a/turbo.json b/turbo.jsonindex 3aebfb288..e3846a31e 100644--- a/turbo.json+++ b/turbo.json@@ -411,12 +411,12 @@"test:e2e": {"dependsOn": ["^build", "build"],"cache": false,- "passThroughEnv": ["OK_TEST_E2E_SERVING", "OK_E2E_COVERAGE_DIR"]+ "passThroughEnv": ["OK_TEST_E2E_SERVING", "OK_E2E_COVERAGE_DIR", "OK_E2E_TRACE_SNAPSHOTS"]},"@inkeep/open-knowledge-app#test:e2e": {"dependsOn": ["^build", "build", "@inkeep/open-knowledge#build"],"cache": false,- "passThroughEnv": ["OK_TEST_E2E_SERVING", "OK_E2E_COVERAGE_DIR"]+ "passThroughEnv": ["OK_TEST_E2E_SERVING", "OK_E2E_COVERAGE_DIR", "OK_E2E_TRACE_SNAPSHOTS"]},"test:perf": {"dependsOn": [],