diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts b/tools/snapshot-tests/tests/basic-snapshots.spec.ts index 7f279399..84f1c1a1 100644 --- a/tools/snapshot-tests/tests/basic-snapshots.spec.ts +++ b/tools/snapshot-tests/tests/basic-snapshots.spec.ts @@ -1,5 +1,6 @@ import { type BrowserContext, expect, type Page, test } from "@playwright/test"; import { initialLocalStorage } from "./utils/add-notes-to-local-storage"; +import { maskedPdfScreenshot } from "./utils/screenshot-opts"; import { waitForPdfReady } from "./utils/wait-for-pdf"; const port = process.env.PLAYWRIGHT_PORT || "5173"; @@ -40,7 +41,7 @@ test.describe await page.goto(hostname, { waitUntil: "networkidle" }); await page.evaluate(() => document.fonts.ready); await waitForPdfReady(page); - await expect(page).toHaveScreenshot("homepage-outline.png", { fullPage: true }); + await expect(page).toHaveScreenshot("homepage-outline.png", maskedPdfScreenshot(page)); }); test.describe @@ -113,14 +114,14 @@ test.describe await page.locator('[data-testid="tab-content-search"]').waitFor({ state: "visible" }); } - await expect(page).toHaveScreenshot("search-initial.png", { fullPage: true }); + await expect(page).toHaveScreenshot("search-initial.png", maskedPdfScreenshot(page)); const searchInput = page.locator('input[placeholder*="search"]'); await searchInput.first().fill("protocol"); await page.locator(".search-results:not(.search-loading)").waitFor({ state: "visible" }); - await expect(page).toHaveScreenshot("search-with-query.png", { fullPage: true }); + await expect(page).toHaveScreenshot("search-with-query.png", maskedPdfScreenshot(page)); await searchInput.first().fill("blockchain"); await page.locator(".search-results:not(.search-loading)").waitFor({ state: "visible" }); - await expect(page).toHaveScreenshot("search-with-results.png", { fullPage: true }); + await expect(page).toHaveScreenshot("search-with-results.png", maskedPdfScreenshot(page)); }); }); }); @@ -138,14 +139,14 @@ test.describe("Top Bar Tests", () => { if ((await githubButton.count()) > 0) { await githubButton.first().click(); - await expect(page).toHaveScreenshot("topbar-github-expanded.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-github-expanded.png", maskedPdfScreenshot(page)); // Hover over dropdown options const dropdownOptions = page.locator('[role="menuitem"], .dropdown-item, .github-menu-item'); if ((await dropdownOptions.count()) > 0) { await dropdownOptions.first().hover(); - await expect(page).toHaveScreenshot("topbar-github-option-hover.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-github-option-hover.png", maskedPdfScreenshot(page)); } } }); @@ -165,7 +166,7 @@ test.describe("Top Bar Tests", () => { if ((await notesDropdown.count()) > 0) { await notesDropdown.first().click(); - await expect(page).toHaveScreenshot("topbar-notes-dropdown.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-notes-dropdown.png", maskedPdfScreenshot(page)); } }); @@ -186,11 +187,11 @@ test.describe("Top Bar Tests", () => { if ((await noteOptions.count()) > 0) { await noteOptions.first().click(); - await expect(page).toHaveScreenshot("topbar-notes-selected-on.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-notes-selected-on.png", maskedPdfScreenshot(page)); await noteOptions.first().click(); - await expect(page).toHaveScreenshot("topbar-notes-selected-off.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-notes-selected-off.png", maskedPdfScreenshot(page)); } } }); @@ -204,10 +205,10 @@ test.describe("Top Bar Tests", () => { const moreButton = page.locator('button:has-text("...")'); await moreButton.first().click(); - await expect(page).toHaveScreenshot("topbar-more-clicked.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-more-clicked.png", maskedPdfScreenshot(page)); const settingsMenuItem = page.locator("role=menuitem", { hasText: "Settings" }); await settingsMenuItem.click(); - await expect(page).toHaveScreenshot("topbar-more-settings-clicked.png", { fullPage: true }); + await expect(page).toHaveScreenshot("topbar-more-settings-clicked.png", maskedPdfScreenshot(page)); }); }); }); diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-dark-mode-linux.png index 76413c1b..4406fa4b 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-light-mode-linux.png index 242e9bea..6d2ba89f 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/homepage-outline-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-dark-mode-linux.png index d8607a3b..c824d1d7 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-light-mode-linux.png index a2ddd23b..5b727c89 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-initial-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-dark-mode-linux.png index c21785c8..7463499a 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-light-mode-linux.png index 668528bf..20dc6cc9 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-query-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-dark-mode-linux.png index 4ce75dc7..ee96d500 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-light-mode-linux.png index da40d8bd..197da0dd 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/search-with-results-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-dark-mode-linux.png index b9b61a08..5fa6cd80 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-light-mode-linux.png index 135ff147..3192dd63 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-expanded-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-dark-mode-linux.png index be0943ef..390fb72a 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-light-mode-linux.png index 2959377c..b6f1e432 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-github-option-hover-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-dark-mode-linux.png index 2e35c6a6..67f48a2f 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-light-mode-linux.png index a95126f0..33c7a77a 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-clicked-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-dark-mode-linux.png index bfe6e099..81eb55c7 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-light-mode-linux.png index d8514f03..51463b58 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-more-settings-clicked-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-dark-mode-linux.png index 7b55d368..b976e78a 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-light-mode-linux.png index d4dcecd4..bd7f3959 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-dropdown-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-dark-mode-linux.png index dab6bacf..8cc00872 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-light-mode-linux.png index 34141ef0..d9fd0752 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-off-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-dark-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-dark-mode-linux.png index 49233a5f..a8765e64 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-dark-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-light-mode-linux.png b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-light-mode-linux.png index 10d48f84..fe76e6f9 100644 Binary files a/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-light-mode-linux.png and b/tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/topbar-notes-selected-on-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts b/tools/snapshot-tests/tests/narrow-screen.spec.ts index f4ea38cc..eb3d235e 100644 --- a/tools/snapshot-tests/tests/narrow-screen.spec.ts +++ b/tools/snapshot-tests/tests/narrow-screen.spec.ts @@ -1,5 +1,6 @@ import { expect, test } from "@playwright/test"; import { initialLocalStorage } from "./utils/add-notes-to-local-storage"; +import { maskedPdfScreenshot } from "./utils/screenshot-opts"; import { waitForPdfReady } from "./utils/wait-for-pdf"; const port = process.env.PLAYWRIGHT_PORT || "5173"; @@ -21,8 +22,6 @@ function getCommonContext() { }; } -const screenshotOpts = { fullPage: true }; - test.describe("Narrow Screen - Bottom Drawer", () => { test("narrow layout shows bottom drawer collapsed", async ({ browser }) => { const context = await browser.newContext({ @@ -39,7 +38,7 @@ test.describe("Narrow Screen - Bottom Drawer", () => { await expect(drawer).toBeVisible(); await expect(drawer).toHaveClass(/collapsed/); - await expect(page).toHaveScreenshot("narrow-layout-collapsed.png", screenshotOpts); + await expect(page).toHaveScreenshot("narrow-layout-collapsed.png", maskedPdfScreenshot(page)); }); test("bottom drawer expands on click", async ({ browser }) => { @@ -59,7 +58,7 @@ test.describe("Narrow Screen - Bottom Drawer", () => { const drawer = page.locator(".bottom-drawer"); await expect(drawer).toHaveClass(/expanded/); - await expect(page).toHaveScreenshot("narrow-layout-expanded.png", screenshotOpts); + await expect(page).toHaveScreenshot("narrow-layout-expanded.png", maskedPdfScreenshot(page)); }); test("bottom drawer collapses on second click", async ({ browser }) => { @@ -83,7 +82,7 @@ test.describe("Narrow Screen - Bottom Drawer", () => { await handle.click(); await expect(page.locator(".bottom-drawer")).toHaveClass(/collapsed/); - await expect(page).toHaveScreenshot("narrow-layout-re-collapsed.png", screenshotOpts); + await expect(page).toHaveScreenshot("narrow-layout-re-collapsed.png", maskedPdfScreenshot(page)); }); test("narrow layout does not show split tab", async ({ browser }) => { @@ -122,7 +121,7 @@ test.describe("Narrow Screen - Bottom Drawer", () => { const splitPane = page.locator(".split-pane-view"); await expect(splitPane).toHaveCount(0); - await expect(page).toHaveScreenshot("narrow-layout-ignores-split.png", screenshotOpts); + await expect(page).toHaveScreenshot("narrow-layout-ignores-split.png", maskedPdfScreenshot(page)); }); }); @@ -141,6 +140,6 @@ test.describe("Narrow Screen - Tablet", () => { const drawer = page.locator(".bottom-drawer"); await expect(drawer).toBeVisible(); - await expect(page).toHaveScreenshot("tablet-layout.png", screenshotOpts); + await expect(page).toHaveScreenshot("tablet-layout.png", maskedPdfScreenshot(page)); }); }); diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-dark-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-dark-mode-linux.png index 4832eb15..cf783a1b 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-dark-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-light-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-light-mode-linux.png index 67468907..338e4b27 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-light-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-collapsed-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-dark-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-dark-mode-linux.png index 90ae8e57..8c990d71 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-dark-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-light-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-light-mode-linux.png index 135278a1..01acb51d 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-light-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-expanded-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-dark-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-dark-mode-linux.png index 4832eb15..cf783a1b 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-dark-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-light-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-light-mode-linux.png index 67468907..338e4b27 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-light-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-ignores-split-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-dark-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-dark-mode-linux.png index 4832eb15..cf783a1b 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-dark-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-light-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-light-mode-linux.png index 67468907..338e4b27 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-light-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/narrow-layout-re-collapsed-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-dark-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-dark-mode-linux.png index 3ce40bb1..48987d26 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-dark-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-light-mode-linux.png b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-light-mode-linux.png index 4eb006b2..548c0b3d 100644 Binary files a/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-light-mode-linux.png and b/tools/snapshot-tests/tests/narrow-screen.spec.ts-snapshots/tablet-layout-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts b/tools/snapshot-tests/tests/split-screen.spec.ts index ff787b85..54b79a68 100644 --- a/tools/snapshot-tests/tests/split-screen.spec.ts +++ b/tools/snapshot-tests/tests/split-screen.spec.ts @@ -1,5 +1,6 @@ import { expect, test } from "@playwright/test"; import { initialLocalStorage } from "./utils/add-notes-to-local-storage"; +import { maskedPdfScreenshot } from "./utils/screenshot-opts"; import { waitForPdfReady, waitForSplitPdfReady } from "./utils/wait-for-pdf"; const port = process.env.PLAYWRIGHT_PORT || "5173"; @@ -22,8 +23,6 @@ function getCommonContext() { }; } -const screenshotOpts = { fullPage: true }; - test.describe("Split Screen", () => { test("sidebar shows split tab icon", async ({ browser }) => { const context = await browser.newContext(getCommonContext()); @@ -36,7 +35,7 @@ test.describe("Split Screen", () => { const splitTab = page.locator('[data-testid="tab-split"]'); await expect(splitTab).toBeVisible(); - await expect(page).toHaveScreenshot("sidebar-with-split-tab.png", screenshotOpts); + await expect(page).toHaveScreenshot("sidebar-with-split-tab.png", maskedPdfScreenshot(page)); }); test("split view opens when clicking split tab", async ({ browser }) => { @@ -52,7 +51,7 @@ test.describe("Split Screen", () => { await page.locator(".split-pane-view").waitFor({ state: "visible", timeout: 5000 }); await waitForSplitPdfReady(page); - await expect(page).toHaveScreenshot("split-view-opened.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-view-opened.png", maskedPdfScreenshot(page)); }); test("split view opens via URL param", async ({ browser }) => { @@ -65,7 +64,7 @@ test.describe("Split Screen", () => { await page.locator(".split-pane-view").waitFor({ state: "visible", timeout: 5000 }); await waitForSplitPdfReady(page); - await expect(page).toHaveScreenshot("split-view-via-url.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-view-via-url.png", maskedPdfScreenshot(page)); }); test("split pane header - version dropdown", async ({ browser }) => { @@ -82,7 +81,7 @@ test.describe("Split Screen", () => { await versionButton.click({ force: true }); await page.locator('[role="menu"], [role="radiogroup"]').first().waitFor({ state: "visible", timeout: 5000 }); - await expect(page).toHaveScreenshot("split-header-version-dropdown.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-header-version-dropdown.png", maskedPdfScreenshot(page)); }); test("split pane header - options menu", async ({ browser }) => { @@ -99,7 +98,7 @@ test.describe("Split Screen", () => { await optionsButton.click({ force: true }); await page.locator('[role="menu"]').waitFor({ state: "visible", timeout: 5000 }); - await expect(page).toHaveScreenshot("split-header-options-menu.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-header-options-menu.png", maskedPdfScreenshot(page)); }); test("sidebar overlay in split mode", async ({ browser }) => { @@ -116,7 +115,7 @@ test.describe("Split Screen", () => { await sidebarButton.click({ force: true }); await page.locator(".sidebar-overlay-panel").waitFor({ state: "visible", timeout: 5000 }); - await expect(page).toHaveScreenshot("split-sidebar-overlay.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-sidebar-overlay.png", maskedPdfScreenshot(page)); }); test("sidebar overlay closes on Escape", async ({ browser }) => { @@ -136,7 +135,7 @@ test.describe("Split Screen", () => { await page.keyboard.press("Escape"); await page.locator(".sidebar-overlay-panel").waitFor({ state: "hidden", timeout: 2500 }); - await expect(page).toHaveScreenshot("split-sidebar-overlay-closed.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-sidebar-overlay-closed.png", maskedPdfScreenshot(page)); }); test("split view closes via options menu", async ({ browser }) => { @@ -157,7 +156,7 @@ test.describe("Split Screen", () => { await page.locator(".split-pane-view").waitFor({ state: "hidden", timeout: 2500 }); await page.locator(".gp-sidebar").waitFor({ state: "visible", timeout: 2500 }); - await expect(page).toHaveScreenshot("split-view-closed.png", screenshotOpts); + await expect(page).toHaveScreenshot("split-view-closed.png", maskedPdfScreenshot(page)); }); test("split tab not visible in sidebar overlay", async ({ browser }) => { @@ -196,6 +195,6 @@ test.describe("Version Compare", () => { const compareSection = page.locator('text="Compare with..."'); await expect(compareSection).toBeVisible(); - await expect(page).toHaveScreenshot("version-dropdown-with-compare.png", screenshotOpts); + await expect(page).toHaveScreenshot("version-dropdown-with-compare.png", maskedPdfScreenshot(page)); }); }); diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-dark-mode-linux.png index 76413c1b..4406fa4b 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-light-mode-linux.png index 242e9bea..6d2ba89f 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/sidebar-with-split-tab-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-dark-mode-linux.png index 082856f3..c80c79d2 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-light-mode-linux.png index dbd83d51..6080cdd3 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-options-menu-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-dark-mode-linux.png index b76c1c4e..c80c79d2 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-light-mode-linux.png index 406eacbb..6080cdd3 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-header-version-dropdown-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-dark-mode-linux.png index 9f890415..c80c79d2 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-light-mode-linux.png index 85370b88..6080cdd3 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-closed-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-dark-mode-linux.png index 5ef971bd..ee761129 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-light-mode-linux.png index 565264c8..076c81cb 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-sidebar-overlay-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-dark-mode-linux.png index d7a30f66..4406fa4b 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-light-mode-linux.png index 79855739..6d2ba89f 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-closed-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-dark-mode-linux.png index 0c3957ab..c80c79d2 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-light-mode-linux.png index 798ac5d4..6080cdd3 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-opened-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-dark-mode-linux.png index bfdfca11..c80c79d2 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-light-mode-linux.png index e29d57af..6080cdd3 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/split-view-via-url-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-dark-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-dark-mode-linux.png index a22946bb..4c03c2ed 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-dark-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-dark-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-light-mode-linux.png b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-light-mode-linux.png index 3bac5bd5..b9ada818 100644 Binary files a/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-light-mode-linux.png and b/tools/snapshot-tests/tests/split-screen.spec.ts-snapshots/version-dropdown-with-compare-light-mode-linux.png differ diff --git a/tools/snapshot-tests/tests/utils/screenshot-opts.ts b/tools/snapshot-tests/tests/utils/screenshot-opts.ts new file mode 100644 index 00000000..394315ec --- /dev/null +++ b/tools/snapshot-tests/tests/utils/screenshot-opts.ts @@ -0,0 +1,20 @@ +import type { Page } from "@playwright/test"; + +/** + * Build `toHaveScreenshot` options that mask out the rendered PDF. + * + * The PDF.js canvas can render a few pixels off between otherwise identical + * runs. That shift is not a regression we care about in these layout/chrome + * snapshots, but it trips the pixel-diff threshold because shifted text + * changes a band of pixels around every glyph. Masking the PDF viewer(s) lets + * us keep a tight threshold on the surrounding UI while ignoring the + * inherently non-deterministic PDF region. + * + * The selector matches both the main viewer and any split-pane viewer. + */ +export function maskedPdfScreenshot(page: Page) { + return { + fullPage: true, + mask: [page.locator(".pdf-viewer-root")], + }; +}