mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
A release-readiness QA pass over the whole product. The commits split into defects a user would hit and gates that were reporting green while measuring nothing. ## Fixes that change behaviour Rate limiting was bypassable on every install: TRUST_PROXY defaulted to true, so request.ip came from a client-set header and a forged X-Forwarded-For got past the login limiter. The default is now a private-network trust list. A transient Postgres outage stranded in-flight jobs, leaving finished output on disk with no row pointing at it. A reconciler now resolves those rows and adopts the bytes rather than dropping the work. A Redis connection that moved to a new address wedged every read-blocked consumer, so completions stopped signalling while health still answered 200. Socket timeouts plus subscriber pings recover it. Installing more than one AI bundle left the shared venv multi-versioned and silently broke three tools. The installer now reconciles distributions to one version each. Converting an image to JXL at quality 1 through 4 returned a 500, because libjxl 0.7 rejects the distance those values compute. The quality is floored at what the encoder honours. A missing ffmpeg was also reported to the user as a corrupt upload; it now says the engine is unavailable. RAW uploads reached an unpatched LibRaw on arm64, so it is built from source at 0.22.2, and the release scan was split so it can fail on an unfixed critical instead of hiding it behind ignore-unfixed. ## Gates that could not fail Two mutation lanes ran zero mutants because Stryker crawled the gitignored docs build; coverage discarded its whole report on any failing test; the lint gate skipped root tests, scripts, and two workspaces; and several generated matrices counted a host missing ffmpeg as a passing tool. Each now measures what it claims. Full evidence and the outstanding release items are tracked locally and are not part of this branch.
193 lines
6.4 KiB
TypeScript
193 lines
6.4 KiB
TypeScript
import { expect, test, uploadTestImage } from "./helpers";
|
|
|
|
test.describe("Visual regression: Home page", () => {
|
|
test("home page layout - desktop", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
// Let animations and fonts settle
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("home-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("home page layout - tablet", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 768, height: 1024 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("home-tablet.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("home page layout - mobile", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("home-mobile.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
test.describe("Visual regression: Login page", () => {
|
|
test("login page layout - desktop", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/login");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("login-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("login page layout - mobile", async ({ page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto("/login");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("login-mobile.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
test.describe("Visual regression: Tool pages", () => {
|
|
test("resize tool - desktop (empty state)", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/image/resize");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("resize-empty-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("resize tool - desktop (with file uploaded)", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/image/resize");
|
|
await uploadTestImage(page);
|
|
await page.waitForTimeout(500);
|
|
|
|
// Mask the image viewer area since the test image may render slightly
|
|
// differently across runs; we care about the settings panel layout.
|
|
await expect(page).toHaveScreenshot("resize-uploaded-desktop.png", {
|
|
maxDiffPixelRatio: 0.02,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("resize tool - mobile (empty state)", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto("/image/resize");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("resize-empty-mobile.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("compress tool - desktop (empty state)", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/image/compress");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("compress-empty-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("convert tool - desktop (empty state)", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/image/convert");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("convert-empty-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
test.describe("Visual regression: Fullscreen grid", () => {
|
|
// 2.0 removed the /fullscreen route. The home page ("/") is now the tool
|
|
// catalog, which is the equivalent grid view, so these capture "/".
|
|
|
|
test("fullscreen grid - desktop", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await expect(page.locator("[data-search-input]")).toBeVisible();
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("fullscreen-grid-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("fullscreen grid - tablet", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 768, height: 1024 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await expect(page.locator("[data-search-input]")).toBeVisible();
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("fullscreen-grid-tablet.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
|
|
test("fullscreen grid - mobile", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await expect(page.locator("[data-search-input]")).toBeVisible();
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page).toHaveScreenshot("fullscreen-grid-mobile.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
fullPage: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
test.describe("Visual regression: Sidebar", () => {
|
|
test("sidebar collapsed vs expanded appearance - desktop", async ({ loggedInPage: page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await page.goto("/");
|
|
await page.waitForLoadState("networkidle");
|
|
await page.waitForTimeout(500);
|
|
|
|
// 2.0 removed the desktop sidebar; navigation now lives in the top nav bar
|
|
// (the <header> banner). Capture that region in place of the old sidebar.
|
|
const nav = page.getByRole("banner").first();
|
|
await expect(nav).toBeVisible();
|
|
|
|
await expect(nav).toHaveScreenshot("sidebar-desktop.png", {
|
|
maxDiffPixelRatio: 0.01,
|
|
});
|
|
});
|
|
});
|