Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
e2e(server): adapt tests to new layout directly
Elian Doranfe3160e7a1b4
diff --git a/apps/server-e2e/src/note_types/pdf.spec.ts b/apps/server-e2e/src/note_types/pdf.spec.tsindex 65bbeb1fb2..d79ddb37e4 100644--- a/apps/server-e2e/src/note_types/pdf.spec.ts+++ b/apps/server-e2e/src/note_types/pdf.spec.ts@@ -1,12 +1,12 @@-import test, { BrowserContext, expect, Page } from "@playwright/test";+import test, { expect, Page } from "@playwright/test";import App from "../support/app";test.beforeEach(async ({ page, context }) => {- const app = await setLayout({ page, context }, true);+ const app = new App(page, context);+ await app.goto();await app.setOption("rightPaneCollapsedItems", "[]");});-test.afterEach(async ({ page, context }) => await setLayout({ page, context }, false));test("Table of contents works", async ({ page, context }) => {const app = new App(page, context);@@ -107,13 +107,6 @@ test("Layers listing works", async ({ page, context }) => {await expect(layersList.locator(".pdf-layer-item")).toHaveCount(0);});-async function setLayout({ page, context}: { page: Page; context: BrowserContext }, newLayout: boolean) {- const app = new App(page, context);- await app.goto();- await app.setOption("newLayout", newLayout ? "true" : "false");- return app;-}-class PdfHelper {private contentFrame: ReturnType<Page["frameLocator"]>;diff --git a/apps/server-e2e/src/note_types/text.spec.ts b/apps/server-e2e/src/note_types/text.spec.tsindex c99ad5d7d6..25e45a551f 100644--- a/apps/server-e2e/src/note_types/text.spec.ts+++ b/apps/server-e2e/src/note_types/text.spec.ts@@ -1,4 +1,5 @@-import { test, expect, Page } from "@playwright/test";+import { expect, test } from "@playwright/test";+import App from "../support/app";test("Table of contents is displayed", async ({ page, context }) => {@@ -8,7 +9,7 @@ test("Table of contents is displayed", async ({ page, context }) => {await app.goToNoteInNewTab("Table of contents");await expect(app.sidebar).toContainText("Table of Contents");- const rootList = app.sidebar.locator(".toc-widget > span > ol");+ const rootList = app.sidebar.locator(".toc > ol");// Heading 1.1// Heading 1.1@@ -42,7 +43,7 @@ test("Highlights list is displayed", async ({ page, context }) => {await app.closeAllTabs();await app.goToNoteInNewTab("Highlights list");- await expect(app.sidebar).toContainText("Highlights List");+ await expect(app.sidebar).toContainText("10 highlights");const rootList = app.sidebar.locator(".highlights-list ol");let index = 0;for (const highlightedEl of ["Bold 1", "Italic 1", "Underline 1", "Colored text 1", "Background text 1", "Bold 2", "Italic 2", "Underline 2", "Colored text 2", "Background text 2"]) {diff --git a/apps/server-e2e/src/support/app.ts b/apps/server-e2e/src/support/app.tsindex 12097c6567..9185a19189 100644--- a/apps/server-e2e/src/support/app.ts+++ b/apps/server-e2e/src/support/app.ts@@ -37,7 +37,7 @@ export default class App {this.noteTreeHoistedNote = this.noteTree.locator(".fancytree-node", { has: page.locator(".unhoist-button") });this.launcherBar = page.locator("#launcher-container");this.currentNoteSplit = page.locator(".note-split:not(.hidden-ext)");- this.currentNoteSplitTitle = this.currentNoteSplit.locator(".note-title");+ this.currentNoteSplitTitle = this.currentNoteSplit.locator(".note-title").first();this.currentNoteSplitContent = this.currentNoteSplit.locator(".note-detail-printable.visible");this.sidebar = page.locator("#right-pane");}diff --git a/apps/server/spec/db/document.db b/apps/server/spec/db/document.dbindex c488fb1071..ad993226e0 100644Binary files a/apps/server/spec/db/document.db and b/apps/server/spec/db/document.db differ