Skip to content

Build your personal knowledge base with Trilium Notes

e2e(standalone): adapt in-app help tests

Elian Dorane17d432bb8bb
diff --git a/packages/trilium-e2e/src/help.spec.ts b/packages/trilium-e2e/src/help.spec.ts
index 0ac285a672..52d1f7e27e 100644
--- a/packages/trilium-e2e/src/help.spec.ts
+++ b/packages/trilium-e2e/src/help.spec.ts
@@ -1,5 +1,5 @@
-import { test, expect, Page } from "@playwright/test";
-import App from "./support/app";
+import { test, expect } from "@playwright/test";
+import App, { isStandalone } from "./support/app";
test("Help popup", async ({ page, context }) => {
page.setDefaultTimeout(15_000);
@@ -11,7 +11,7 @@ test("Help popup", async ({ page, context }) => {
await expect(page.locator(".help-cards")).toBeVisible();
});
-test("In-app-help works in English", async ({ page, context }) => {
+test("In-app-help works in English", async ({ page, context }, testInfo) => {
const app = new App(page, context);
await app.goto();
@@ -22,11 +22,20 @@ test("In-app-help works in English", async ({ page, context }) => {
app.noteTree.getByText("Troubleshooting").click();
await expect(app.currentNoteSplitTitle).toHaveValue("Troubleshooting");
- await app.currentNoteSplitContent.locator("p").first().waitFor({ state: "visible" });
- expect(await app.currentNoteSplitContent.locator("p").count()).toBeGreaterThan(10);
+
+ if (isStandalone(testInfo)) {
+ // Standalone renders help as webView iframes pointing to docs site
+ const iframe = app.currentNoteSplitContent.locator("iframe");
+ await expect(iframe).toBeVisible();
+ await expect(iframe).toHaveAttribute("src", /docs\.triliumnotes\.org.*troubleshooting/);
+ } else {
+ // Server/desktop renders help as inline doc content
+ await app.currentNoteSplitContent.locator("p").first().waitFor({ state: "visible" });
+ expect(await app.currentNoteSplitContent.locator("p").count()).toBeGreaterThan(10);
+ }
});
-test("In-app-help works in other languages", async ({ page, context }) => {
+test("In-app-help works in other languages", async ({ page, context }, testInfo) => {
const app = new App(page, context);
try {
await app.goto();
@@ -40,8 +49,15 @@ test("In-app-help works in other languages", async ({ page, context }) => {
app.noteTree.getByText("Troubleshooting").click();
await expect(app.currentNoteSplitTitle).toHaveValue("Troubleshooting");
- await app.currentNoteSplitContent.locator("p").first().waitFor({ state: "visible" });
- expect(await app.currentNoteSplitContent.locator("p").count()).toBeGreaterThan(10);
+
+ if (isStandalone(testInfo)) {
+ const iframe = app.currentNoteSplitContent.locator("iframe");
+ await expect(iframe).toBeVisible();
+ await expect(iframe).toHaveAttribute("src", /docs\.triliumnotes\.org.*troubleshooting/);
+ } else {
+ await app.currentNoteSplitContent.locator("p").first().waitFor({ state: "visible" });
+ expect(await app.currentNoteSplitContent.locator("p").count()).toBeGreaterThan(10);
+ }
} finally {
// Ensure English is set after each locale change to avoid any leaks to other tests.
await app.setOption("locale", "en");
diff --git a/packages/trilium-e2e/src/support/app.ts b/packages/trilium-e2e/src/support/app.ts
index 5b34eeca51..834537f6d8 100644
--- a/packages/trilium-e2e/src/support/app.ts
+++ b/packages/trilium-e2e/src/support/app.ts
@@ -12,6 +12,10 @@ export function getBaseUrl(): string {
return process.env["BASE_URL"] || `http://127.0.0.1:${port}`;
}
+export function isStandalone(testInfo: { project: { name: string } }): boolean {
+ return testInfo.project.name.includes("standalone");
+}
+
interface DropdownLocator extends Locator {
selectOptionByText: (text: string) => Promise<void>;
}