mirror of
https://github.com/sotashimozono/obsidian-remote-ssh.git
synced 2026-07-22 17:10:32 +00:00
The first CI run mixed genuine product defects with three HARNESS faults. A red that isn't a real defect is as corrosive as a green that isn't real, so separate them. No assertion was weakened. 1. UNBOUNDED ACTIONS (the systemic one). playwright.config.ts set no `actionTimeout`, so Playwright's default of 0 — wait forever — applied to every click. Obsidian's File Explorer under Xvfb can leave a node ATTACHED BUT NEVER ACTIONABLE (hover popovers swallow pointer events, rows paint lazily), so a bare `.click()` blocked until the 180 s test timeout and reported nothing. Three tests burned 3.0 min each with no message, reading as "the product hung" when the harness was simply waiting. Now bounded at 30 s, and the specs additionally dump vault-model / DOM diagnostics on expiry, so a stuck locator explains itself instead of eating the clock. 2. RENDERER CSP BLOCKED THE BRIDGE PROBE. images' four bridge tests failed with a contentless `TypeError: Failed to fetch`. Obsidian's renderer CSP forbids page-JS `fetch()` to `http://127.0.0.1:<port>` (connect-src) — NOT a ResourceBridge defect. Proof: in the same run the root-note `<img>` embed test PASSED on the very same URL, because img-src is allowed. The measurement was wrong, not the product. Bytes and headers are now fetched from the NODE test process (no CSP), with a real PNG IHDR parse replacing createImageBitmap; `<img>` rendering is still asserted in-page, which is the actual user path. Every assertion kept, including "the 2048px source must come back at the 1024 cap AND smaller than the original" — the check that catches ResourceBridge silently falling back to the full binary. 3. CROSS-SPEC CONTAMINATION — caused by a real defect. sync.spec's `create — new note appears on remote`, previously green, went red. The new specs seed fixture plugins into the remote's community-plugins.json, and because `pushCommunityPlugins` is a monotonic UNION (the very defect plugin-code-roundtrip test 6 pins), the ids can never be removed — so every later spec's shadow vault pulled them in at connect. New helpers/remote-reset.ts force-restores the remote's community-plugins.json to its exact original bytes and purges fixture plugin dirs (including the per-device copies under .obsidian/user/<clientId>/) in afterAll regardless of outcome, plus a defensive pre-clean in beforeAll. That a test harness MUST do this is itself evidence of the defect's blast radius — it is recorded in the docblock. Test 6 is byte-for-byte unchanged and stays red. Also fixed a FALSE GREEN: links test 8 (Quick Switcher finds a note in an unexpanded subfolder) searched a folder that test 6 expands earlier in the same session, so its green proved nothing. It now uses an independent `-sub2/` fixture that no other test touches. Expected to go honestly red — the same user-visible harm as test 5.
48 lines
2.2 KiB
TypeScript
48 lines
2.2 KiB
TypeScript
import { defineConfig } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright config for Obsidian E2E smoke tests.
|
|
*
|
|
* Obsidian is an Electron app — we can't use `_electron.launch()`
|
|
* because Obsidian bundles its own Electron and its entry point
|
|
* isn't a bare `main.js`. Instead, the test helper launches the
|
|
* Obsidian binary directly with `--remote-debugging-port` and
|
|
* Playwright connects via CDP (`browserType.connectOverCDP`).
|
|
*
|
|
* Env vars consumed by helpers:
|
|
* OBSIDIAN_PATH — path to the Obsidian binary / AppImage
|
|
* TEST_VAULT — path to the pre-scaffolded test vault
|
|
* CDP_PORT — debugging port (default: 9222)
|
|
* E2E_DEMO — set to include `demo.spec.ts` (media capture only)
|
|
*/
|
|
export default defineConfig({
|
|
testDir: '.',
|
|
testMatch: '**/*.spec.ts',
|
|
// `demo.spec.ts` is the SCREENCAST RECORDER, not a test: it asserts
|
|
// nothing, it drives the UI purely to emit PNG frames for the README GIF.
|
|
// `testMatch` was picking it up, so it ran inside the behavioural
|
|
// "Obsidian E2E smoke" job — where it burns CI minutes and can only ever
|
|
// go red for reasons unrelated to product behaviour, which is corrosive to
|
|
// trusting the suite. Excluded by default; the `Record demo + push GIF`
|
|
// workflow sets E2E_DEMO=1 to opt it back in.
|
|
testIgnore: process.env.E2E_DEMO ? [] : ['**/demo.spec.ts'],
|
|
timeout: 120_000,
|
|
// Playwright's DEFAULT actionTimeout is 0 — wait FOREVER. With Obsidian's
|
|
// virtualised File Explorer under Xvfb a node can be *attached but never
|
|
// actionable* (hover popovers swallow pointer events, rows paint lazily), so
|
|
// a bare `.click()` blocked until the whole test timed out: three minutes
|
|
// burned with NO message, which reads as "the product hung" when in fact the
|
|
// harness was waiting. Bound it — an unactionable element now fails with
|
|
// Playwright's own locator diagnostic, well inside the 120 s test budget.
|
|
actionTimeout: 30_000,
|
|
retries: 1,
|
|
workers: 1, // Obsidian is a single-instance app
|
|
use: {
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
reporter: [
|
|
['list'],
|
|
['html', { open: 'never', outputFolder: '../e2e-results' }],
|
|
],
|
|
});
|