mirror of
https://github.com/zadam/trilium.git
synced 2026-01-01 12:14:24 +01:00
test(server/pdf): basic page navigation test
This commit is contained in:
parent
cfccbb8927
commit
b9456ca466
@ -5,7 +5,10 @@ import test, { BrowserContext, expect, Page } from "@playwright/test";
|
||||
import App from "../support/app";
|
||||
|
||||
describe("PDF sidebar", () => {
|
||||
// test.beforeAll(async ({ page, context }) => await setLayout({ page, context }, false));
|
||||
test.beforeAll(async ({ page, context }) => {
|
||||
const app = await setLayout({ page, context }, true);
|
||||
await app.setOption("rightPaneCollapsedItems", "[]");
|
||||
});
|
||||
// test.beforeAll(async ({ page, context }) => await setLayout({ page, context }, true));
|
||||
|
||||
test("Table of contents works", async ({ page, context }) => {
|
||||
@ -22,12 +25,32 @@ describe("PDF sidebar", () => {
|
||||
await toc.locator("li", { hasText: "Logan Pick-Up" }).click();
|
||||
await pdfHelper.expectPageToBe(13);
|
||||
});
|
||||
|
||||
test("Page navigation works", async ({ page, context }) => {
|
||||
const app = new App(page, context);
|
||||
await app.goto();
|
||||
await app.goToNoteInNewTab("Dacia Logan.pdf");
|
||||
|
||||
const pagesList = app.sidebar.locator(".pdf-pages-list");
|
||||
|
||||
// Check count is correct.
|
||||
await expect(app.sidebar).toContainText("28 pages");
|
||||
expect(await pagesList.locator(".pdf-page-item").count()).toBe(28);
|
||||
|
||||
// Go to page 3.
|
||||
await pagesList.locator(".pdf-page-item").nth(2).click();
|
||||
|
||||
const pdfHelper = new PdfHelper(app);
|
||||
await pdfHelper.expectPageToBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user