Move the smoke tests onto the shared harness

Each smoke test now uses tests/smoke/_harness/ for Playwright, the Tauri
IPC mock, the in-memory workspace, and output folders, instead of its
own copy. The tests keep their interactions and assertions. Mock
handlers that the app never calls are gone.

- Split the four mixed regression scripts into 18 feature tests.
- Update tests that broke when the app changed on purpose. Each update
  cites the app source that shows the new behavior.
- Mark two real app defects with @known-issue: the settings window
  controls are 1px shorter than the main window controls, and plugin
  tabs cannot be reordered by dragging without a workspace.
- Merge three palette unit tests into one table-driven test.
- The native tests load Playwright through the harness and read
  NATIVE_CDP_URL, with their old variable names as fallbacks.
- A failed smoke test saves a screenshot and prints the console errors.
- The runner runs failed tests once more, alone, and reports a test
  that then passes as flaky.

Result: 89 passed, 1 flaky, 2 known issues, 0 failed. Before, 45 of 78
passed.
This commit is contained in:
Knotty Wyvern
2026-10-27 20:58:55 -07:00
parent c66ea1ce83
commit 69f90df571
109 changed files with 5920 additions and 7915 deletions
@@ -0,0 +1,33 @@
// Import a custom theme JSON in Settings > Appearance; its dark and light backgrounds apply.
import assert from "node:assert/strict";
import path from "node:path";
import { mockTauri, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
const name = "appearance/themeImport";
await runSmoke(name, async ({ page }) => {
const output = await outputDir(name);
await mockTauri(page, {
commands: test => ({
...test.workspace({ root: "C:\\theme-import", files: { "a.md": "# Alpha\n" } }),
plugins_snapshot: () => ({ plugins: [], issues: [] }),
}),
});
await page.goto(smokeUrl + "/?settingsWindow=true");
await page.getByRole("button", { name: "Appearance", exact: true }).click();
const theme = { schema: 1, id: "smoke", name: "Smoke theme", light: { bg: "#fefefe", text: "#222222", accent: "#334499" }, dark: { bg: "#181820", text: "#eeeeee", accent: "#aabbff" } };
const importTheme = () => page.locator('input[type=file][aria-label="Theme JSON file"]').setInputFiles({ name: "smoke.json", mimeType: "application/json", buffer: Buffer.from(JSON.stringify(theme)) });
const background = () => page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--rs-bg").trim());
await importTheme();
await page.waitForFunction(() => document.documentElement.dataset.palette === "custom:smoke");
assert.equal(await background(), "#181820");
// A custom theme now keeps one palette. A schema 1 file converts with the current mode (src/lib/theme/customThemes.ts:38,
// src/lib/theme/AppearanceSettings.svelte:70), and the light/dark select became the Color theme menu (AppearanceSettings.svelte:20-31, :113).
await page.getByRole("button", { name: "Color theme", exact: true }).click();
await page.getByRole("menuitemradio", { name: "RuneStone Light", exact: true }).click();
await page.waitForFunction(() => document.documentElement.dataset.palette !== "custom:smoke");
await importTheme();
await page.waitForFunction(() => document.documentElement.dataset.palette === "custom:smoke");
assert.equal(await background(), "#fefefe");
await page.screenshot({ path: path.join(output, "custom-theme-light.png") });
console.log("PASS: custom theme import applies its dark and light backgrounds");
}, { timeout: 15000 });