Files
SnapOtter/tests/e2e-docs/responsive.spec.ts
T
SnapOtterandGitHub d10d0f544f fix: release QA hardening across processing, media, security, and CI gates (#649)
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.
2026-07-27 15:37:30 +08:00

75 lines
2.9 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { waitForHydration } from "./helpers";
/**
* VitePress switches to the desktop nav at 768px. Several locales carry
* top-level labels far longer than English (es 55 characters, pt-BR 54, th 53,
* ru 52, de 48 against en 33), so between 768px and the 960px sidebar
* breakpoint the navbar's right edge landed outside the viewport and the page
* scrolled sideways. apps/docs/.vitepress/theme/vars.css moves that one switch
* to 960px.
*
* English fits at every width, so an English-only check would have stayed green
* through the whole regression. The long-label locales are the point.
*/
const WIDTHS = [375, 767, 768, 900, 959, 960, 1280];
// The five longest nav-label locales plus English as the control.
const PAGES = [
"/guide/getting-started",
"/de/guide/getting-started",
"/es/guide/getting-started",
"/pt-BR/guide/getting-started",
"/th/guide/getting-started",
"/ru/guide/getting-started",
];
test.describe("Docs responsive layout", () => {
for (const path of PAGES) {
for (const width of WIDTHS) {
test(`${path} does not scroll sideways at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await page.goto(path);
await waitForHydration(page);
const { scrollWidth, clientWidth } = await page.evaluate(() => ({
scrollWidth: document.documentElement.scrollWidth,
clientWidth: document.documentElement.clientWidth,
}));
expect(
scrollWidth,
`${path} overflows by ${scrollWidth - clientWidth}px at ${width}px`,
).toBeLessThanOrEqual(clientWidth);
});
}
}
// Hiding the desktop menu is only safe if the overlay replaces it, so this
// pins the replacement rather than trusting the CSS to have both halves.
for (const width of [768, 900, 959]) {
test(`the hamburger overlay carries the top-level nav at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await page.goto("/de/guide/getting-started");
await waitForHydration(page);
await expect(page.locator(".VPNavBarMenu")).toBeHidden();
const hamburger = page.locator(".VPNavBarHamburger");
await expect(hamburger).toBeVisible();
await hamburger.click();
const screen = page.locator(".VPNavScreen");
await expect(screen).toBeVisible();
await expect(screen.locator(".VPNavScreenMenu")).toContainText("Anleitung");
await expect(screen.locator(".translations")).toBeVisible();
});
}
test("the desktop nav returns at the sidebar breakpoint", async ({ page }) => {
await page.setViewportSize({ width: 960, height: 900 });
await page.goto("/de/guide/getting-started");
await waitForHydration(page);
await expect(page.locator(".VPNavBarMenu")).toBeVisible();
await expect(page.locator(".VPNavBarHamburger")).toBeHidden();
});
});