diff --git a/e2e/shared_notes.spec.ts b/e2e/shared_notes.spec.ts new file mode 100644 index 000000000..a3ca3e0e8 --- /dev/null +++ b/e2e/shared_notes.spec.ts @@ -0,0 +1,10 @@ +import { test, expect, Page } from "@playwright/test"; +import App from "./support/app"; + +test("Goes to share root", async ({ page, context }) => { + const app = new App(page, context); + await app.goto({ url: "/share" }); + const noteTitle = "Shared notes"; + await expect(page).toHaveTitle(noteTitle); + await expect(page.locator("h1")).toHaveText(noteTitle); +}); diff --git a/e2e/support/app.ts b/e2e/support/app.ts index 231fac747..400af51d2 100644 --- a/e2e/support/app.ts +++ b/e2e/support/app.ts @@ -2,6 +2,7 @@ import { expect, Locator, Page } from "@playwright/test"; import type { BrowserContext } from "@playwright/test"; interface GotoOpts { + url?: string; isMobile?: boolean; } @@ -28,21 +29,27 @@ export default class App { this.sidebar = page.locator("#right-pane"); } - async goto(opts: GotoOpts = {}) { + async goto({ url, isMobile }: GotoOpts = {}) { await this.context.addCookies([ { url: BASE_URL, name: "trilium-device", - value: opts.isMobile ? "mobile" : "desktop" + value: isMobile ? "mobile" : "desktop" } ]); - await this.page.goto("/", { waitUntil: "networkidle" }); + if (!url) { + url = "/"; + } + + await this.page.goto(url, { waitUntil: "networkidle" }); // Wait for the page to load. - await expect(this.page.locator(".tree")) - .toContainText("Trilium Integration Test"); - await this.closeAllTabs(); + if (url === "/") { + await expect(this.page.locator(".tree")) + .toContainText("Trilium Integration Test"); + await this.closeAllTabs(); + } } async goToNoteInNewTab(noteTitle: string) { diff --git a/integration-tests/db/document.db b/integration-tests/db/document.db index c3a649e62..424f79b7e 100644 Binary files a/integration-tests/db/document.db and b/integration-tests/db/document.db differ