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
chore(regroup): reintroduce old e2e tests
Elian Doran3dee1725b378
diff --git a/_regroup/integration-tests/auth.setup.ts b/_regroup/integration-tests/auth.setup.tsdeleted file mode 100644index 9b31eec499..0000000000--- a/_regroup/integration-tests/auth.setup.ts+++ /dev/null@@ -1,17 +0,0 @@-import { test as setup, expect } from "@playwright/test";--const authFile = "playwright/.auth/user.json";--const ROOT_URL = "http://localhost:8082";-const LOGIN_PASSWORD = "demo1234";--// Reference: https://playwright.dev/docs/auth#basic-shared-account-in-all-tests--setup("authenticate", async ({ page }) => {- await page.goto(ROOT_URL);- await expect(page).toHaveURL(`${ROOT_URL}/login`);-- await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD);- await page.getByRole("button", { name: "Login" }).click();- await page.context().storageState({ path: authFile });-});diff --git a/_regroup/integration-tests/duplicate.spec.ts b/_regroup/integration-tests/duplicate.spec.tsdeleted file mode 100644index fe079952bd..0000000000--- a/_regroup/integration-tests/duplicate.spec.ts+++ /dev/null@@ -1,9 +0,0 @@-import { test, expect } from "@playwright/test";--test("Can duplicate note with broken links", async ({ page }) => {- await page.goto(`http://localhost:8082/#2VammGGdG6Ie`);- await page.locator(".tree-wrapper .fancytree-active").getByText("Note map").click({ button: "right" });- await page.getByText("Duplicate subtree").click();- await expect(page.locator(".toast-body")).toBeHidden();- await expect(page.locator(".tree-wrapper").getByText("Note map (dup)")).toBeVisible();-});diff --git a/_regroup/integration-tests/example.disabled.ts b/_regroup/integration-tests/example.disabled.tsdeleted file mode 100644index a149fe3286..0000000000--- a/_regroup/integration-tests/example.disabled.ts+++ /dev/null@@ -1,18 +0,0 @@-import { test, expect } from "@playwright/test";--test("has title", async ({ page }) => {- await page.goto("https://playwright.dev/");-- // Expect a title "to contain" a substring.- await expect(page).toHaveTitle(/Playwright/);-});--test("get started link", async ({ page }) => {- await page.goto("https://playwright.dev/");-- // Click the get started link.- await page.getByRole("link", { name: "Get started" }).click();-- // Expects page to have a heading with the name of Installation.- await expect(page.getByRole("heading", { name: "Installation" })).toBeVisible();-});diff --git a/_regroup/integration-tests/settings.spec.ts b/_regroup/integration-tests/settings.spec.tsdeleted file mode 100644index b3fe16fda3..0000000000--- a/_regroup/integration-tests/settings.spec.ts+++ /dev/null@@ -1,21 +0,0 @@-import test, { expect } from "@playwright/test";--test("Native Title Bar not displayed on web", async ({ page }) => {- await page.goto("http://localhost:8082/#root/_hidden/_options/_optionsAppearance");- await expect(page.getByRole("heading", { name: "Theme" })).toBeVisible();- await expect(page.getByRole("heading", { name: "Native Title Bar (requires" })).toBeHidden();-});--test("Tray settings not displayed on web", async ({ page }) => {- await page.goto("http://localhost:8082/#root/_hidden/_options/_optionsOther");- await expect(page.getByRole("heading", { name: "Note Erasure Timeout" })).toBeVisible();- await expect(page.getByRole("heading", { name: "Tray" })).toBeHidden();-});--test("Spellcheck settings not displayed on web", async ({ page }) => {- await page.goto("http://localhost:8082/#root/_hidden/_options/_optionsSpellcheck");- await expect(page.getByRole("heading", { name: "Spell Check" })).toBeVisible();- await expect(page.getByRole("heading", { name: "Tray" })).toBeHidden();- await expect(page.getByText("These options apply only for desktop builds")).toBeVisible();- await expect(page.getByText("Enable spellcheck")).toBeHidden();-});diff --git a/_regroup/integration-tests/tree.spec.ts b/_regroup/integration-tests/tree.spec.tsdeleted file mode 100644index 257375fa81..0000000000--- a/_regroup/integration-tests/tree.spec.ts+++ /dev/null@@ -1,18 +0,0 @@-import test, { expect } from "@playwright/test";--test("Renders on desktop", async ({ page, context }) => {- await page.goto("http://localhost:8082");- await expect(page.locator(".tree")).toContainText("Trilium Integration Test");-});--test("Renders on mobile", async ({ page, context }) => {- await context.addCookies([- {- url: "http://localhost:8082",- name: "trilium-device",- value: "mobile"- }- ]);- await page.goto("http://localhost:8082");- await expect(page.locator(".tree")).toContainText("Trilium Integration Test");-});diff --git a/_regroup/integration-tests/update_check.spec.ts b/_regroup/integration-tests/update_check.spec.tsdeleted file mode 100644index 38e28bf229..0000000000--- a/_regroup/integration-tests/update_check.spec.ts+++ /dev/null@@ -1,12 +0,0 @@-import { test, expect } from "@playwright/test";--const expectedVersion = "0.90.3";--test("Displays update badge when there is a version available", async ({ page }) => {- await page.goto("http://localhost:8080");- await page.getByRole("button", { name: "" }).click();- await page.getByText(`Version ${expectedVersion} is available,`).click();-- const page1 = await page.waitForEvent("popup");- expect(page1.url()).toBe(`https://github.com/TriliumNext/Trilium/releases/tag/v${expectedVersion}`);-});diff --git a/apps/server-e2e/src/duplicate.spec.ts b/apps/server-e2e/src/duplicate.spec.tsnew file mode 100644index 0000000000..56c1709605--- /dev/null+++ b/apps/server-e2e/src/duplicate.spec.ts@@ -0,0 +1,14 @@+import { test, expect } from "@playwright/test";+import App from "./support/app";++test("Can duplicate note with broken links", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto({+ url: "http://localhost:8082/#root/Q5abPvymDH6C/2VammGGdG6Ie"+ });++ await app.noteTree.getByText("Note map").first().click({ button: "right" });+ await page.locator("#context-menu-container").getByText("Duplicate").click();+ await expect(page.locator(".toast-body")).toBeHidden();+ await expect(app.noteTree.getByText("Note map (dup)")).toBeVisible();+});diff --git a/apps/server-e2e/src/settings.spec.ts b/apps/server-e2e/src/settings.spec.tsnew file mode 100644index 0000000000..28210e57ce--- /dev/null+++ b/apps/server-e2e/src/settings.spec.ts@@ -0,0 +1,25 @@+import test, { expect } from "@playwright/test";+import App from "./support/app";++test("Native Title Bar not displayed on web", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto({ url: "http://localhost:8082/#root/_hidden/_options/_optionsAppearance" });+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Theme" })).toBeVisible();+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Native Title Bar (requires" })).toBeHidden();+});++test("Tray settings not displayed on web", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto({ url: "http://localhost:8082/#root/_hidden/_options/_optionsOther" });+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Note Erasure Timeout" })).toBeVisible();+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Tray" })).toBeHidden();+});++test("Spellcheck settings not displayed on web", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto({ url: "http://localhost:8082/#root/_hidden/_options/_optionsSpellcheck" });+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Spell Check" })).toBeVisible();+ await expect(app.currentNoteSplitContent.getByRole("heading", { name: "Tray" })).toBeHidden();+ await expect(app.currentNoteSplitContent.getByText("These options apply only for desktop builds")).toBeVisible();+ await expect(app.currentNoteSplitContent.getByText("Enable spellcheck")).toBeHidden();+});diff --git a/apps/server-e2e/src/tree.spec.ts b/apps/server-e2e/src/tree.spec.tsnew file mode 100644index 0000000000..f1ca8f88fa--- /dev/null+++ b/apps/server-e2e/src/tree.spec.ts@@ -0,0 +1,14 @@+import test, { expect } from "@playwright/test";+import App from "./support/app";++test("Renders on desktop", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto();+ await expect(app.noteTree).toContainText("Trilium Integration Test");+});++test("Renders on mobile", async ({ page, context }) => {+ const app = new App(page, context);+ await app.goto({ isMobile: true });+ await expect(app.noteTree).toContainText("Trilium Integration Test");+});