Skip to content

Build your personal knowledge base with Trilium Notes

e2e(server): wrong import

Elian Doran053812e5f0aa
diff --git a/apps/server-e2e/src/note_types/pdf.spec.ts b/apps/server-e2e/src/note_types/pdf.spec.ts
index a97f1b02fa..99fe02173f 100644
--- a/apps/server-e2e/src/note_types/pdf.spec.ts
+++ b/apps/server-e2e/src/note_types/pdf.spec.ts
@@ -1,5 +1,4 @@
import test, { BrowserContext, expect, Page } from "@playwright/test";
-import { describe } from "vitest";
import App from "../support/app";
@@ -9,92 +8,88 @@ test.beforeEach(async ({ page, context }) => {
});
test.afterEach(async ({ page, context }) => await setLayout({ page, context }, false));
-describe("PDF sidebar", () => {
-
- test("Table of contents works", async ({ page, context }) => {
- const app = new App(page, context);
- await app.goto();
- await app.goToNoteInNewTab("Dacia Logan.pdf");
-
- const toc = app.sidebar.locator(".toc");
-
- await expect(toc.locator("li")).toHaveCount(48);
- await expect(toc.locator("li", { hasText: "Logan Van" })).toHaveCount(1);
-
- const pdfHelper = new PdfHelper(app);
- await toc.locator("li", { hasText: "Logan Pick-Up" }).click();
- await pdfHelper.expectPageToBe(13);
-
- await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
- await expect(toc.locator("li")).toHaveCount(0);
- });
+test("Table of contents works", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.goToNoteInNewTab("Dacia Logan.pdf");
- test("Page navigation works", async ({ page, context }) => {
- const app = new App(page, context);
- await app.goto();
- await app.goToNoteInNewTab("Dacia Logan.pdf");
+ const toc = app.sidebar.locator(".toc");
- const pagesList = app.sidebar.locator(".pdf-pages-list");
+ await expect(toc.locator("li")).toHaveCount(48);
+ await expect(toc.locator("li", { hasText: "Logan Van" })).toHaveCount(1);
- // Check count is correct.
- await expect(app.sidebar).toContainText("28 pages");
- expect(await pagesList.locator(".pdf-page-item").count()).toBe(28);
+ const pdfHelper = new PdfHelper(app);
+ await toc.locator("li", { hasText: "Logan Pick-Up" }).click();
+ await pdfHelper.expectPageToBe(13);
- // Go to page 3.
- await pagesList.locator(".pdf-page-item").nth(2).click();
+ await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
+ await expect(toc.locator("li")).toHaveCount(0);
+});
- const pdfHelper = new PdfHelper(app);
- await pdfHelper.expectPageToBe(3);
+test("Page navigation works", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.goToNoteInNewTab("Dacia Logan.pdf");
- await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
- await expect(pagesList.locator(".pdf-page-item")).toHaveCount(1);
- });
+ const pagesList = app.sidebar.locator(".pdf-pages-list");
- test("Attachments listing works", async ({ page, context }) => {
- const app = new App(page, context);
- await app.goto();
- await app.goToNoteInNewTab("Dacia Logan.pdf");
+ // Check count is correct.
+ await expect(app.sidebar).toContainText("28 pages");
+ expect(await pagesList.locator(".pdf-page-item").count()).toBe(28);
- const attachmentsList = app.sidebar.locator(".pdf-attachments-list");
- await expect(app.sidebar).toContainText("2 attachments");
- await expect(attachmentsList.locator(".pdf-attachment-item")).toHaveCount(2);
+ // Go to page 3.
+ await pagesList.locator(".pdf-page-item").nth(2).click();
- const attachmentInfo = attachmentsList.locator(".pdf-attachment-item", { hasText: "Note.trilium" });
- await expect(attachmentInfo).toContainText("3.36 MiB");
+ const pdfHelper = new PdfHelper(app);
+ await pdfHelper.expectPageToBe(3);
- // Download the attachment and check its size.
- const [ download ] = await Promise.all([
- page.waitForEvent("download"),
- attachmentInfo.locator(".bx-download").click()
- ]);
- expect(download).toBeDefined();
+ await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
+ await expect(pagesList.locator(".pdf-page-item")).toHaveCount(1);
+});
- await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
- await expect(attachmentsList.locator(".pdf-attachment-item")).toHaveCount(0);
- });
+test("Attachments listing works", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.goToNoteInNewTab("Dacia Logan.pdf");
- test("Layers listing works", async ({ page, context }) => {
- const app = new App(page, context);
- await app.goto();
- await app.goToNoteInNewTab("Layers test.pdf");
+ const attachmentsList = app.sidebar.locator(".pdf-attachments-list");
+ await expect(app.sidebar).toContainText("2 attachments");
+ await expect(attachmentsList.locator(".pdf-attachment-item")).toHaveCount(2);
- // Check count is correct.
- await expect(app.sidebar).toContainText("2 layers");
- const layersList = app.sidebar.locator(".pdf-layers-list");
- await expect(layersList.locator(".pdf-layer-item")).toHaveCount(2);
+ const attachmentInfo = attachmentsList.locator(".pdf-attachment-item", { hasText: "Note.trilium" });
+ await expect(attachmentInfo).toContainText("3.36 MiB");
- // Toggle visibility of the first layer.
- const firstLayer = layersList.locator(".pdf-layer-item").first();
- await expect(firstLayer).toContainText("Tongue out");
- await expect(firstLayer).toContainClass("hidden");
- await firstLayer.click();
- await expect(firstLayer).not.toContainClass("visible");
+ // Download the attachment and check its size.
+ const [ download ] = await Promise.all([
+ page.waitForEvent("download"),
+ attachmentInfo.locator(".bx-download").click()
+ ]);
+ expect(download).toBeDefined();
- await app.clickNoteOnNoteTreeByTitle("Dacia Logan.pdf");
- await expect(layersList.locator(".pdf-layer-item")).toHaveCount(0);
- });
+ await app.clickNoteOnNoteTreeByTitle("Layers test.pdf");
+ await expect(attachmentsList.locator(".pdf-attachment-item")).toHaveCount(0);
});
+test("Layers listing works", async ({ page, context }) => {
+ const app = new App(page, context);
+ await app.goto();
+ await app.goToNoteInNewTab("Layers test.pdf");
+
+ // Check count is correct.
+ await expect(app.sidebar).toContainText("2 layers");
+ const layersList = app.sidebar.locator(".pdf-layers-list");
+ await expect(layersList.locator(".pdf-layer-item")).toHaveCount(2);
+
+ // Toggle visibility of the first layer.
+ const firstLayer = layersList.locator(".pdf-layer-item").first();
+ await expect(firstLayer).toContainText("Tongue out");
+ await expect(firstLayer).toContainClass("hidden");
+ await firstLayer.click();
+ await expect(firstLayer).not.toContainClass("visible");
+
+ await app.clickNoteOnNoteTreeByTitle("Dacia Logan.pdf");
+ 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);