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

This commit is contained in:
SiriusXT 2025-05-06 21:27:58 +08:00
parent 9b1ddd970c
commit 52d6d05159

View File

@ -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', '');
});