Files
RuneStone/tests/smoke/tree/moveUndo.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

46 lines
1.9 KiB
JavaScript

// File moves in the tree: cut and paste, Undo and Redo file move from the folder menu, Ctrl+Z, and drag into a folder.
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
await runSmoke("tree/moveUndo", async ({ page }) => {
await mockTauri(page, {
commands: test => {
const workspace = test.workspace({ root: "C:\\move-undo", files: { "a.md": "# Alpha\n", "b.md": "# Beta\n", "folder/keep.md": "# Keep\n" } });
test.files = workspace.files;
return {
...workspace,
plugins_snapshot: () => ({ plugins: [], issues: [] }),
spelling_menu_install: () => null,
};
},
});
const row = path => page.locator(`[data-tree-rel="${path}"]`);
const menu = label => page.getByRole("menuitem", { name: label, exact: true });
const has = path => page.waitForFunction(path => window.__TEST__.files.has(path), path);
await page.goto(smokeUrl);
await row("b.md").click({ button: "right" });
await menu("Cut").click();
await row("folder").click({ button: "right" });
await menu("Paste").click();
await has("folder/b.md");
await row("folder").click({ button: "right" });
await menu("Undo file move").click();
await has("b.md");
await row("folder").click({ button: "right" });
await menu("Redo file move").click();
await has("folder/b.md");
await row("folder").focus();
await page.keyboard.press("Control+z");
await has("b.md");
console.log("PASS: cut and paste, menu undo and redo, and Ctrl+Z");
const sourceBox = await row("b.md").boundingBox(), folderBox = await row("folder").boundingBox();
await page.mouse.move(sourceBox.x + 50, sourceBox.y + sourceBox.height / 2);
await page.mouse.down();
await page.mouse.move(folderBox.x + 70, folderBox.y + folderBox.height / 2, { steps: 12 });
await page.mouse.up();
await has("folder/b.md");
await page.keyboard.press("Control+z");
await has("b.md");
console.log("PASS: drag into a folder, and Ctrl+Z");
}, { timeout: 15000 });