RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// Export theme template in Settings > Appearance: success, cancel, and an export error.
|
||||
import assert from "node:assert/strict";
|
||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("appearance/themeExport", async ({ page }) => {
|
||||
await mockTauri(page, {
|
||||
state: { exportResult: "C:\\exports\\my-theme.json", exportError: "" },
|
||||
commands: test => ({
|
||||
...test.workspace({ root: "C:\\theme-export" }),
|
||||
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
||||
theme_export: () => {
|
||||
if (test.state.exportError) throw new Error(test.state.exportError);
|
||||
return test.state.exportResult;
|
||||
},
|
||||
}),
|
||||
});
|
||||
const exportButton = page.getByRole("button", { name: "Export theme template" });
|
||||
await page.goto(smokeUrl + "/?settingsWindow=true");
|
||||
await page.getByRole("button", { name: "Appearance", exact: true }).click();
|
||||
await exportButton.click();
|
||||
await page.getByRole("status").filter({ hasText: "Theme saved to" }).waitFor();
|
||||
// Exported templates use theme schema 3 (exportAppearanceTheme in src/lib/theme/appearance.ts).
|
||||
assert.equal(await page.evaluate(() => JSON.parse(window.__TEST__.calls.find(call => call.command === "theme_export").args.contents).schema), 3);
|
||||
await page.evaluate(() => { window.__TEST__.state.exportResult = null; });
|
||||
await exportButton.click();
|
||||
await page.getByText("Export canceled.", { exact: true }).waitFor();
|
||||
await page.evaluate(() => { window.__TEST__.state.exportError = "Disk is full"; });
|
||||
await exportButton.click();
|
||||
await page.getByRole("alert").filter({ hasText: "Disk is full" }).waitFor();
|
||||
console.log("PASS: theme export success, cancel, and error");
|
||||
}, { viewport: { width: 1200, height: 850 } });
|
||||
Reference in New Issue
Block a user