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.
43 lines
2.0 KiB
JavaScript
43 lines
2.0 KiB
JavaScript
// Tree rename keeps pins and bookmarks: the file menu offers Copy system path, and Undo rename, Ctrl+Z, and Ctrl+Y restore the marks.
|
|
import assert from "node:assert/strict";
|
|
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
|
|
|
await runSmoke("tree/renameMarks", async ({ page }) => {
|
|
await mockTauri(page, {
|
|
commands: test => {
|
|
const workspace = test.workspace({
|
|
root: "C:\\rename-marks",
|
|
files: { "a.md": "# Note\n\nOriginal text.", ".runestone/marks.json": JSON.stringify({ pins: ["a.md"], bookmarks: ["a.md"], order: { "": ["a.md"] } }) },
|
|
});
|
|
test.files = workspace.files;
|
|
return {
|
|
...workspace,
|
|
workspace_list: args => workspace.workspace_list(args).filter(entry => args.rel || entry.rel_path !== ".runestone"),
|
|
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
|
spelling_menu_install: () => null,
|
|
};
|
|
},
|
|
});
|
|
const row = path => page.locator(`[data-tree-rel="${path}"]`);
|
|
const item = name => page.getByRole("menuitem", { name, exact: true });
|
|
await page.goto(smokeUrl);
|
|
await row("a.md").click({ button: "right" });
|
|
assert.equal(await item("Copy path").count(), 0);
|
|
assert.equal(await item("Copy system path").count(), 1);
|
|
await item("Rename").click();
|
|
await page.locator(".tree input").fill("renamed.md");
|
|
await page.locator(".tree input").press("Enter");
|
|
await row("renamed.md").waitFor();
|
|
await row("renamed.md").click({ button: "right" });
|
|
assert.equal(await item("Undo rename").count(), 1);
|
|
await page.keyboard.press("Escape");
|
|
await row("renamed.md").focus();
|
|
await page.keyboard.press("Control+z");
|
|
await row("a.md").waitFor();
|
|
assert.deepEqual(await page.evaluate(() => JSON.parse(window.__TEST__.files.get(".runestone/marks.json")).pins), ["a.md"]);
|
|
await row("a.md").focus();
|
|
await page.keyboard.press("Control+y");
|
|
await row("renamed.md").waitFor();
|
|
console.log("PASS: Copy system path, rename, Undo rename, and Ctrl+Z and Ctrl+Y with marks");
|
|
}, { viewport: { width: 1200, height: 850 } });
|