RuneStone 1.0.0

This commit is contained in:
Knotty Wyvern
2026-11-16 04:21:21 -07:00
commit b52eeb14a1
827 changed files with 241421 additions and 0 deletions
+92
View File
@@ -0,0 +1,92 @@
// Settings density: title bars and window controls match the main window, compact plugin rows, narrow layouts, Git dialog focus, many categories.
// @known-issue The settings window controls are 35px high and the main window's are 36px: the settings header draws its divider as a border inside the shared title bar height.
import assert from "node:assert/strict";
import path from "node:path";
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
await runSmoke("settings/density", async ({ browser }) => {
const output = await outputDir("settings/density");
const context = await browser.newContext({ viewport: { width: 1152, height: 815 } });
await mockTauri(context, {
commands: () => ({
plugins_snapshot: () => ({ root: "D:/RuneStone/plugins", plugins: Array.from({ length: 7 }, (_, index) => ({
manifest: { schemaVersion: 1, id: `org.example.plugin-${index}`, name: `Example plugin ${index + 1}`, author: "RuneStone Team", description: "A plugin description with enough text to check readable wrapping.", version: "0.1.1", apiVersion: 1, entry: "main.js", access: "full-app" },
enabled: false, hash: "test", installedAt: 1791390000000, path: `D:/RuneStone/plugins/plugin-${index}`, error: null, removal: false,
})) }),
workspace_last_path: () => null,
"plugin:window|is_maximized": () => false,
}),
});
const main = await openPage(context, { timeout: 7000 });
const settings = await openPage(context, { timeout: 7000 });
await main.goto(smokeUrl);
await settings.goto(`${smokeUrl}/?settingsWindow=true`);
await settings.getByRole("heading", { name: "General", exact: true }).waitFor();
const header = settings.locator("dialog > header");
const mainHeader = main.locator(".header");
assert.equal((await header.boundingBox()).height, (await mainHeader.boundingBox()).height, "Settings and main title bars share their height");
for (const name of ["Minimize window", "Maximize window", "Close window"]) {
const a = await main.getByRole("button", { name, exact: true }).boundingBox();
const b = await settings.getByRole("button", { name, exact: true }).boundingBox();
assert.equal(a.width, b.width);
assert.equal(a.height, b.height, `${name} has the same dimensions in both windows`);
}
await settings.getByRole("button", { name: "Plug-ins", exact: true }).click();
await settings.getByRole("switch", { name: "Example plugin 1", exact: true }).waitFor();
const content = settings.locator(".content");
const pluginRows = content.locator(".row");
assert.equal(await pluginRows.count(), 7);
for (const theme of ["dark", "light"]) {
await settings.evaluate(value => { document.documentElement.dataset.theme = value; }, theme);
for (const width of [1152, 540, 360]) {
await settings.setViewportSize({ width, height: width === 1152 ? 815 : 420 });
assert(await settings.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
assert(await content.evaluate(element => element.scrollWidth <= element.clientWidth), "The plugin content does not scroll horizontally");
const rows = await pluginRows.evaluateAll(elements => elements.map(element => element.getBoundingClientRect().height));
if (width === 1152) {
assert(rows.every(height => height <= 100), `Desktop plugin rows stay compact: ${rows}`);
const count = await pluginRows.evaluateAll(elements => {
const container = elements[0].closest(".content").getBoundingClientRect();
return elements.filter(element => element.getBoundingClientRect().bottom <= container.bottom).length;
});
assert(count >= 5, `At least five complete plugin rows fit at the screenshot size, got ${count}`);
}
const copy = pluginRows.first().locator(".plugin-copy");
const controls = pluginRows.first().locator(".controls");
const a = await copy.boundingBox(), b = await controls.boundingBox();
assert(a.x + a.width <= b.x + 1 || a.y + a.height <= b.y + 1, "Plugin text does not overlap its actions");
for (const button of await controls.getByRole("button").all()) {
const bounds = await button.boundingBox();
assert(bounds.width >= 28 && bounds.height >= 28);
assert(await button.getAttribute("aria-label"));
}
await settings.screenshot({ path: path.join(output, `${theme}-${width}.png`) });
}
}
await settings.setViewportSize({ width: 540, height: 420 });
await settings.getByRole("button", { name: "Install from Git link", exact: true }).click();
const install = settings.getByRole("dialog", { name: "Install from Git link", exact: true });
await install.waitFor();
assert(await install.getByRole("textbox", { name: "Repository link", exact: true }).isVisible());
assert.equal(await settings.evaluate(() => document.activeElement?.textContent), "Cancel");
await settings.keyboard.press("Escape");
await install.waitFor({ state: "detached" });
assert.equal(await settings.evaluate(() => document.activeElement?.textContent), "Install from Git link");
await settings.getByRole("button", { name: "General", exact: true }).click();
assert(await settings.getByRole("spinbutton", { name: "Auto-save interval", exact: true }).isVisible());
await settings.evaluate(async () => {
const { pluginTools } = await import("/src/lib/plugins/external.ts");
pluginTools.set(Array.from({ length: 12 }, (_, index) => ({ owner: "org.example.plugin-0", id: `settings-${index}`, title: `Plugin settings ${index + 1}`, surface: "settings" })));
});
await settings.setViewportSize({ width: 360, height: 420 });
const sidebar = settings.locator("dialog aside");
assert((await sidebar.boundingBox()).height <= 154, "Many plugin categories leave space for setting controls");
assert(await sidebar.evaluate(element => element.scrollWidth <= element.clientWidth));
await settings.getByRole("button", { name: "Plugin settings 12", exact: true }).scrollIntoViewIfNeeded();
const category = await settings.getByRole("button", { name: "Plugin settings 12", exact: true }).boundingBox();
const navigation = await sidebar.boundingBox();
assert(category.y >= navigation.y && category.y + category.height <= navigation.y + navigation.height, "Every plugin category remains reachable");
assert(await settings.getByRole("spinbutton", { name: "Auto-save interval", exact: true }).isVisible());
assert.deepEqual([...main.errors, ...settings.errors], []);
console.log("Settings density smoke passed: matching title bars and window controls, seven plugin rows, compact layout, readable text, accessible actions, both themes, narrow layouts, Git dialog focus, and many plugin categories.");
});