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:
@@ -0,0 +1,31 @@
|
||||
// Ctrl+Tab selects the next working tab and Ctrl+Shift+Tab returns to the previous one.
|
||||
import assert from "node:assert/strict";
|
||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("tabs/cycleShortcuts", async ({ page }) => {
|
||||
await mockTauri(page, {
|
||||
commands: test => ({
|
||||
...test.workspace({ root: "C:\\tab-cycle", files: { "a.md": "# Alpha\n", "b.md": "# Beta\n" } }),
|
||||
plugins_snapshot: () => ({ plugins: [], issues: [] }),
|
||||
spelling_menu_install: () => null,
|
||||
}),
|
||||
});
|
||||
async function open(name) {
|
||||
await page.keyboard.press("Control+p");
|
||||
await page.getByRole("textbox", { name: "Find a file" }).fill(name);
|
||||
await page.getByRole("dialog").getByRole("button").filter({ hasText: name }).first().click();
|
||||
await page.getByRole("tab", { name, exact: true }).waitFor();
|
||||
}
|
||||
const selected = () => page.getByRole("tab", { selected: true }).getAttribute("data-path");
|
||||
await page.goto(smokeUrl);
|
||||
await page.getByText("tab-cycle", { exact: true }).waitFor();
|
||||
await open("a.md");
|
||||
await open("b.md");
|
||||
await page.locator(".cm-content").click();
|
||||
const before = await selected();
|
||||
await page.keyboard.press("Control+Tab");
|
||||
assert.notEqual(await selected(), before);
|
||||
await page.keyboard.press("Control+Shift+Tab");
|
||||
assert.equal(await selected(), before);
|
||||
console.log("PASS: Ctrl+Tab and Ctrl+Shift+Tab cycle working tabs");
|
||||
});
|
||||
Reference in New Issue
Block a user