test: e2e smoke; docs: README; ci: release workflow
Co-Authored-By: Claude
This commit is contained in:
27
e2e/publish.spec.ts
Normal file
27
e2e/publish.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { launchObsidian, withPlugin } from "./harness";
|
||||
|
||||
test("plugin loads, command registered, modal opens & prefills", async () => {
|
||||
const obs = await launchObsidian();
|
||||
try {
|
||||
await withPlugin(obs, "jekyll-publish");
|
||||
|
||||
const hasCommand = await obs.page.evaluate(() =>
|
||||
Boolean((window as any).app.commands.commands["jekyll-publish:publish-current-note"])
|
||||
);
|
||||
expect(hasCommand).toBe(true);
|
||||
|
||||
const modalOpened = await obs.page.evaluate(async () => {
|
||||
const app = (window as any).app;
|
||||
const file = app.vault.getFiles().find((f: any) => f.extension === "md");
|
||||
await app.workspace.getLeaf(true).openFile(file);
|
||||
app.commands.executeCommandById("jekyll-publish:publish-current-note");
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
const heading = document.querySelector(".modal-container h2");
|
||||
return heading?.textContent ?? "";
|
||||
});
|
||||
expect(modalOpened).toContain("Publish to Jekyll");
|
||||
} finally {
|
||||
await obs.close();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user