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.
44 lines
2.7 KiB
JavaScript
44 lines
2.7 KiB
JavaScript
// The Color theme menu in Settings works from the keyboard, has no color inputs, and the main window's empty tab uses the new theme background.
|
|
import assert from "node:assert/strict";
|
|
import { mockTauri, openPage, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
|
|
|
await runSmoke("appearance/colorThemeMenu", async ({ browser }) => {
|
|
// The settings window changes the main window through shared localStorage, so both pages need one context.
|
|
const context = await browser.newContext({ viewport: { width: 1200, height: 850 } });
|
|
await mockTauri(context, {
|
|
commands: test => ({
|
|
...test.workspace({ root: "C:\\color-theme-menu", files: { "a.md": "# Note\n\nOriginal text." } }),
|
|
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
|
spelling_menu_install: () => null,
|
|
}),
|
|
});
|
|
const page = await openPage(context);
|
|
await page.goto(smokeUrl);
|
|
await page.locator('[data-tree-rel="a.md"]').waitFor();
|
|
const settings = await openPage(context);
|
|
await settings.goto(smokeUrl + "/?settingsWindow=true");
|
|
await settings.getByRole("button", { name: "Appearance", exact: true }).click();
|
|
await settings.getByRole("button", { name: "Color theme", exact: true }).click();
|
|
// Menu entries now name the mode ("RuneStone Dark" is the default; src/lib/theme/AppearanceSettings.svelte:20-22). The next entry is Claude Light.
|
|
await settings.getByRole("menuitemradio", { name: "RuneStone Dark", exact: true }).focus();
|
|
await settings.keyboard.press("ArrowDown");
|
|
await settings.keyboard.press("Enter");
|
|
assert.equal(await settings.evaluate(() => document.documentElement.dataset.palette), "claude");
|
|
assert.equal(await settings.locator("input[type=color]").count(), 0);
|
|
await page.getByRole("button", { name: "New tab (Ctrl T)", exact: true }).click();
|
|
await page.locator(".empty").waitFor();
|
|
await page.waitForFunction(() => document.documentElement.dataset.palette === "claude");
|
|
// The empty tab is transparent over the work area layer, which paints the theme background (src/lib/layout/Workbench.svelte:1258, :1548).
|
|
assert.equal(await page.locator(".empty").evaluate(node => getComputedStyle(node).backgroundColor), "rgba(0, 0, 0, 0)");
|
|
assert.equal(await page.locator(".workarea-background").evaluate(node => {
|
|
const reference = document.createElement("span");
|
|
reference.style.color = "var(--rs-bg)";
|
|
node.append(reference);
|
|
const matches = getComputedStyle(node).backgroundColor === getComputedStyle(reference).color;
|
|
reference.remove();
|
|
return matches;
|
|
}), true);
|
|
assert.deepEqual([...page.errors, ...settings.errors], []);
|
|
console.log("PASS: keyboard theme selection, no color inputs, and the empty tab uses the theme background");
|
|
});
|