Skip to content

Build your personal knowledge base with Trilium Notes

Add e2e: open and activate notes from the launch pane and tree

SiriusXT52d6d05159db
diff --git a/apps/server-e2e/src/layout/open_note_and_activate.spec.ts b/apps/server-e2e/src/layout/open_note_and_activate.spec.ts
new file mode 100644
index 0000000000..b6e4d47bf7
--- /dev/null
+++ b/apps/server-e2e/src/layout/open_note_and_activate.spec.ts
@@ -0,0 +1,49 @@
+import { test, expect } from "@playwright/test";
+import App from "../support/app";
+
+const NOTE_TITLE = "Trilium Integration Test DB";
+
+test("Opens and activate a note from launcher Bar", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.closeAllTabs();
+ await app.goToNoteInNewTab(NOTE_TITLE);
+
+ const calendarButton = app.launcherBar.locator(".launcher-button.bx-calendar-star.visible");
+ await expect(calendarButton).toBeVisible();
+
+ await page.keyboard.down('Control');
+ await page.keyboard.down('Shift');
+
+ await calendarButton.click();
+
+ await page.keyboard.up('Control');
+ await page.keyboard.up('Shift');
+
+ const tabs = app.tabBar.locator(".note-tab");
+ await expect(tabs).toHaveCount(2);
+
+ const secondTab = tabs.nth(1);
+ await expect(secondTab).toHaveAttribute('active', '');
+});
+
+test("Opens and activate a note from note tree", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.closeAllTabs();
+ await app.goToNoteInNewTab(NOTE_TITLE);
+
+ await page.keyboard.down('Control');
+ await page.keyboard.down('Shift');
+
+ await app.noteTreeActiveNote.click();
+
+ await page.keyboard.up('Control');
+ await page.keyboard.up('Shift');
+
+ const tabs = app.tabBar.locator(".note-tab");
+ await expect(tabs).toHaveCount(2);
+
+ const secondTab = tabs.nth(1);
+ await expect(secondTab).toHaveAttribute('active', '');
+});
\ No newline at end of file