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.
39 lines
2.0 KiB
JavaScript
39 lines
2.0 KiB
JavaScript
// Folder actions in the tree: Open in terminal, and the Show .runestone folder setting from the settings window.
|
|
import assert from "node:assert/strict";
|
|
import { mockTauri, openPage, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
|
|
|
await runSmoke("tree/folderActions", async ({ browser }) => {
|
|
// The settings window shares localStorage with the main window, so both pages need one context.
|
|
const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } });
|
|
await mockTauri(context, {
|
|
commands: test => {
|
|
const workspace = test.workspace({ root: "C:\\folder-actions", files: { "a.md": "# Alpha\n", "folder/keep.md": "# Keep\n", ".runestone/config.json": "{}" } });
|
|
return {
|
|
...workspace,
|
|
workspace_list: args => workspace.workspace_list(args).filter(entry => args.rel || args.showInternal || entry.rel_path !== ".runestone"),
|
|
workspace_open_terminal: () => null,
|
|
settings_open_window: () => null,
|
|
plugins_snapshot: () => ({ plugins: [], issues: [] }),
|
|
spelling_menu_install: () => null,
|
|
};
|
|
},
|
|
});
|
|
const page = await openPage(context, { timeout: 15000 });
|
|
const row = path => page.locator(`[data-tree-rel="${path}"]`);
|
|
await page.goto(smokeUrl);
|
|
await row("folder").click({ button: "right" });
|
|
await page.getByRole("menuitem", { name: "Open in terminal", exact: true }).click();
|
|
assert.ok(await page.evaluate(() => window.__TEST__.calls.some(call => call.command === "workspace_open_terminal" && call.args.rel === "folder")));
|
|
console.log("PASS: Open in terminal");
|
|
|
|
await page.keyboard.press("Control+,");
|
|
const settings = await openPage(context, { timeout: 15000 });
|
|
await settings.goto(smokeUrl + "/?settingsWindow=true");
|
|
await settings.getByRole("switch", { name: "Show .runestone folder" }).check();
|
|
await settings.close();
|
|
await row(".runestone").waitFor();
|
|
const errors = [...page.errors, ...settings.errors];
|
|
assert.deepEqual(errors, []);
|
|
console.log("PASS: Show .runestone folder reveals the internal folder");
|
|
});
|