Files
RuneStone/tests/smoke/editor/modeSwitcherHover.smoke.mjs
T
Knotty Wyvern 69f90df571 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.
2026-10-27 20:58:55 -07:00

20 lines
930 B
JavaScript

// The document mode switcher expands within 500 ms when the pointer hovers it.
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
await runSmoke("editor/modeSwitcherHover", async ({ page }) => {
await mockTauri(page, {
commands: test => ({
...test.workspace({ root: "C:\\mode-switcher", files: { "a.md": "# Alpha\n\nTemplate body.\n" } }),
plugins_snapshot: () => ({ plugins: [], issues: [] }),
spelling_menu_install: () => null,
}),
});
await page.goto(smokeUrl);
await page.locator('[data-tree-rel="a.md"]').click();
await page.locator(".cm-content").waitFor();
await page.locator(".mode-switcher").first().hover();
await page.waitForFunction(() => document.querySelector(".mode-switcher")?.classList.contains("expanded"), null, { timeout: 500 });
await page.mouse.move(500, 400);
console.log("PASS: the mode switcher expands on hover");
}, { timeout: 15000 });