Files
SnapOtter/tests/e2e/settings.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

94 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, openSettings, test } from "./helpers";
test.describe("Settings Dialog", () => {
test("opens from the avatar menu", async ({ loggedInPage: page }) => {
// 2.0 removed the desktop sidebar; openSettings drives the avatar dropdown.
await openSettings(page);
// Settings dialog should appear with sections
await expect(page.getByText("General").first()).toBeVisible();
});
test("General section shows user info", async ({ loggedInPage: page }) => {
await openSettings(page);
// Should show username and version info
await expect(page.getByText(/admin/i).first()).toBeVisible();
await expect(page.getByText(/2\.0\.0|version/i).first()).toBeVisible();
});
test("General section has logout button", async ({ loggedInPage: page }) => {
await openSettings(page);
const logoutBtn = page.getByRole("button", { name: /logout|log out/i });
await expect(logoutBtn).toBeVisible();
});
test("Security section has change password form", async ({ loggedInPage: page }) => {
await openSettings(page);
// Navigate to Security section via the dialog nav button (the section
// heading reuses the same label, so scope to the button to avoid strict-mode
// ambiguity).
await page.getByRole("button", { name: "Security", exact: true }).click();
// Should show password change fields
await expect(page.getByText(/change password|current password/i).first()).toBeVisible();
});
test("People section shows user list", async ({ loggedInPage: page }) => {
await openSettings(page);
// Navigate to People section via the dialog nav button
await page.getByRole("button", { name: "People", exact: true }).click();
// Should show admin user
await expect(page.getByText("admin").first()).toBeVisible();
});
test("API Keys section has generate button", async ({ loggedInPage: page }) => {
await openSettings(page);
await page.getByRole("button", { name: /api keys/i }).click();
await expect(page.getByRole("button", { name: /generate api key/i })).toBeVisible({
timeout: 5_000,
});
});
test("About section shows app info", async ({ loggedInPage: page }) => {
await openSettings(page);
// Navigate to About section via the dialog nav button
await page.getByRole("button", { name: "About", exact: true }).click();
// Should show app description
await expect(page.getByText(/snapotter|privacy|self-hosted/i).first()).toBeVisible();
});
test("System Settings section has configuration", async ({ loggedInPage: page }) => {
await openSettings(page);
// Navigate to System Settings section via the dialog nav button
await page.getByRole("button", { name: "System Settings", exact: true }).click();
// Should show system configuration options
await expect(page.getByText(/app name|upload limit|theme/i).first()).toBeVisible();
});
test("settings dialog can be closed", async ({ loggedInPage: page }) => {
await openSettings(page);
await expect(page.getByText("General").first()).toBeVisible();
// Close by clicking X or outside
const closeBtn = page.getByRole("button", { name: /close|×/i }).first();
if (await closeBtn.isVisible()) {
await closeBtn.click();
} else {
await page.keyboard.press("Escape");
}
// Dialog should be gone
await page.waitForTimeout(300);
});
});