Skip to content

A full-featured download manager.

chore(test): consolidate playwright artifacts (#2173)

Dr_rOotda90b6a4e554
diff --git a/.claude/rules/browser-artifacts.md b/.claude/rules/browser-artifacts.md
new file mode 100644
index 00000000..0bdc6a93
--- /dev/null
+++ b/.claude/rules/browser-artifacts.md
@@ -0,0 +1,46 @@
+---
+description: Shared output locations for browser tests and ad hoc UI verification
+---
+
+# Browser Artifacts
+
+Run browser commands from the repository root. All generated Playwright and
+browser-verification artifacts belong under `output/playwright/`:
+
+| Artifact | Location |
+|---|---|
+| Automated test results, screenshots, traces, and videos | `output/playwright/test-results/<suite>/` |
+| HTML reports | `output/playwright/reports/<suite>/` |
+| Playwright CLI automatic snapshots and logs | `output/playwright/cli/` |
+| Ad hoc screenshots, scripts, preview harnesses, and review notes | `output/playwright/manual/<task-slug>/` |
+| Retained release-soak evidence, including JSON reports | `output/playwright/soak/<suite>/<run-id>/` |
+
+## Tool Configuration
+
+- Playwright Test suites set an explicit `outputDir`. Each suite owns a
+ separate directory because the runner cleans it before a run. Never point
+ a test runner at the shared `output/playwright/` root.
+- In tests, use `testInfo.outputPath(name)` or `test.info().outputPath(name)`
+ for generated files. Do not hardcode artifact paths in test bodies.
+- Reporters set explicit output paths. Open the Electron HTML report with
+ `pnpm exec playwright show-report output/playwright/reports/electron`.
+- Playwright CLI automatically loads `.playwright/cli.config.json` from the
+ repository root. Keep its default `outputDir` aligned with the table above.
+ Use a task-specific session name; explicitly named screenshots and other
+ captures go in `output/playwright/manual/<task-slug>/`.
+- For browser tools that do not read this config, pass the output path
+ explicitly. Place custom configs and temporary preview files in the same
+ task directory, with their outputs also inside `output/playwright/`.
+- Preserve explicit user or CI evidence-directory overrides and existing
+ restrictions on capturing pairing passwords or other secrets.
+
+## Repository Hygiene
+
+Do not create new browser-artifact directories at the repository root or
+under `e2e/`, `tests/`, `docs/`, `screenshots/`, or `outputs/`. The tracked
+`screenshots/` directory contains intentional product assets; `e2e/` and
+`tests/e2e/` contain test source and fixtures.
+
+Generated output stays ignored. Legacy ignored directories are not new output
+targets. Do not delete or move another task's evidence or active session
+files. Close only the browser sessions and preview servers you started.
diff --git a/.gitignore b/.gitignore
index b7758ce7..f7568050 100644
--- a/.gitignore
+++ b/.gitignore
@@ -155,13 +155,16 @@ graphify-out/*
/.obsidian-doc-context.json
/.obsidian-doc-context.json.tmp-*
-# Playwright e2e
+# Playwright configuration and generated artifacts
+/.playwright/*
+!/.playwright/cli.config.json
+/output/playwright/
+# Legacy artifact locations (keep old local evidence ignored)
/e2e/test-results
/e2e/playwright-report
/playwright-report
/test-results
-/.playwright
-/output/playwright
+.playwright-cli
.agents/
skills-lock.json
diff --git a/.playwright/cli.config.json b/.playwright/cli.config.json
new file mode 100644
index 00000000..9d9539e0
--- /dev/null
+++ b/.playwright/cli.config.json
@@ -0,0 +1,3 @@
+{
+ "outputDir": "output/playwright/cli"
+}
diff --git a/CLAUDE.md b/CLAUDE.md
index 4f68d748..549ef9dd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -46,6 +46,7 @@ their patterns match the files under inspection or modification.
| `commit-and-quality.md` | Required checks and conditional validation |
| `git-workflow.md` | Commits, branches, PRs, and releases |
| `language-and-docs.md` | Language and public/private documentation |
+| `browser-artifacts.md` | Browser test output paths and temporary UI verification files |
| `architecture.md` | Layer boundaries and transport flow |
| `electron-vite.md` | Build, packaging, native ABI, and pnpm |
| `code-style.md` | TypeScript, React, CSS, and file naming |
diff --git a/e2e/bridge/appimage.playwright.config.ts b/e2e/bridge/appimage.playwright.config.ts
index 106e0de0..cc4875ca 100644
--- a/e2e/bridge/appimage.playwright.config.ts
+++ b/e2e/bridge/appimage.playwright.config.ts
@@ -19,5 +19,5 @@ export default defineConfig({
reporter: [['list']],
// Pairing passwords must not enter traces, screenshots or video.
use: { trace: 'off', screenshot: 'off', video: 'off' },
- outputDir: '../test-results/appimage',
+ outputDir: '../../output/playwright/test-results/appimage',
})
diff --git a/e2e/bridge/remote-extension.playwright.config.ts b/e2e/bridge/remote-extension.playwright.config.ts
index b324d5e9..5643d542 100644
--- a/e2e/bridge/remote-extension.playwright.config.ts
+++ b/e2e/bridge/remote-extension.playwright.config.ts
@@ -21,5 +21,5 @@ export default defineConfig({
],
timeout: 120_000,
expect: { timeout: 15_000 },
- outputDir: '../test-results/remote-extension',
+ outputDir: '../../output/playwright/test-results/remote-extension',
})
diff --git a/e2e/task-inspector-activity.spec.ts b/e2e/task-inspector-activity.spec.ts
index 3d672cf1..5410c8ad 100644
--- a/e2e/task-inspector-activity.spec.ts
+++ b/e2e/task-inspector-activity.spec.ts
@@ -1,5 +1,3 @@
-import { mkdir } from 'node:fs/promises'
-import path from 'node:path'
import type { ElectronApplication, Page } from '@playwright/test'
import { Commands } from '@shared/protocol/commands'
import { Queries } from '@shared/protocol/queries'
@@ -24,8 +22,6 @@ import {
} from './fixtures/task-inspector-activity'
import { getFreePort } from './helpers/free-port'
-const SCREENSHOT_DIR = path.resolve('e2e/test-results/task-inspector-activity')
-
interface RuntimeTask {
id: string
name: string
@@ -251,7 +247,6 @@ async function openActivityForTask(
}
async function capture(page: Page, name: string): Promise<void> {
- await mkdir(SCREENSHOT_DIR, { recursive: true })
// Interaction assertions intentionally leave focus on the control that
// regained ownership. Visual-reference captures represent the resting
// surface, so remove that transient focus-visible treatment first.
@@ -261,7 +256,7 @@ async function capture(page: Page, name: string): Promise<void> {
}
})
await page.screenshot({
- path: path.join(SCREENSHOT_DIR, name),
+ path: test.info().outputPath(name),
animations: 'disabled',
})
}
diff --git a/e2e/web-directory-picker/playwright.config.ts b/e2e/web-directory-picker/playwright.config.ts
index 3a805598..cb641632 100644
--- a/e2e/web-directory-picker/playwright.config.ts
+++ b/e2e/web-directory-picker/playwright.config.ts
@@ -9,7 +9,7 @@ export default defineConfig({
timeout: 30_000,
expect: { timeout: 8_000 },
reporter: [['list']],
- outputDir: '../test-results/web-directory-picker',
+ outputDir: '../../output/playwright/test-results/web-directory-picker',
use: {
baseURL: 'http://127.0.0.1:4178',
browserName: 'chromium',
diff --git a/playwright.config.ts b/playwright.config.ts
index 1a4ab3d9..49c232a6 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -10,7 +10,13 @@ export default defineConfig({
fullyParallel: false,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI
- ? [['list'], ['html', { open: 'never' }]]
+ ? [
+ ['list'],
+ [
+ 'html',
+ { open: 'never', outputFolder: 'output/playwright/reports/electron' },
+ ],
+ ]
: [['list']],
// Most assertions wait for UI; allow a generous default since the
// first launch also boots aria2 and runs settings migration.
@@ -21,5 +27,5 @@ export default defineConfig({
screenshot: 'only-on-failure',
},
globalSetup: './e2e/global-setup.ts',
- outputDir: 'e2e/test-results',
+ outputDir: 'output/playwright/test-results/electron',
})
diff --git a/scripts/run-remote-extension-release-soak.mjs b/scripts/run-remote-extension-release-soak.mjs
index c3e68085..c17d36e7 100644
--- a/scripts/run-remote-extension-release-soak.mjs
+++ b/scripts/run-remote-extension-release-soak.mjs
@@ -409,7 +409,7 @@ export function runRemoteExtensionReleaseSoak({
const runId = started.toISOString().replaceAll(':', '-').replaceAll('.', '-')
const evidenceDirectory = resolve(
env.MOTRIX_REMOTE_EXTENSION_SOAK_EVIDENCE_DIR ??
- join('e2e/test-results/remote-extension-soak', runId)
+ join('output/playwright/soak/remote-extension', runId)
)
prepareEvidenceDirectory(evidenceDirectory)
const reportPath = join(evidenceDirectory, 'playwright-report.json')