test: expand coverage across all layers -- 1,268 new tests, fix replace-color div-by-zero

14-agent parallel test expansion covering integration, unit, E2E, E2E-Docker,
cross-format matrix, adversarial, GUI navigation/tools/settings/visual/a11y/perf.

- Integration: expand 23 tool test files with HEIC, stress, batch, edge cases
- Unit: close coverage gaps in image-engine, stores, lib (metadata, auto-enhance,
  connection-store, lazy-with-retry, collage/file-store HEIC preview)
- AI bridge: 141 new tests for dispatcher buffering, crash recovery, OOM/segfault
- Cross-format: 794 parameterized tests (16 formats x 12 tools + no-crash matrix)
- Adversarial: memory stress (50x large file), zero-byte, corrupted headers, unicode
- E2E-Docker: expand 8 spec files with dimension verification, pipeline chains
- GUI E2E: tool UI settings/interactions for all 47 tools, remove all test.skip,
  RBAC per-role verification, visual screenshot naming, cross-browser smoke tests,
  a11y ARIA/focus/contrast, performance budgets, 15-tool stability test
- Fix: replace-color.ts tolerance=0 caused division-by-zero producing NaN pixels

Total: 8,958 tests passing across 202 files. Zero failures, zero skips.
This commit is contained in:
SnapOtter
2026-05-09 18:02:58 +08:00
parent 7b1f09f5d0
commit a0556772e8
76 changed files with 13112 additions and 117 deletions
+67 -1
View File
@@ -1,5 +1,5 @@
import { test as base, expect } from "@playwright/test";
import { login, openSettings } from "./helpers";
import { getTestImagePath, login, openSettings } from "./helpers";
const API = process.env.API_URL || "http://localhost:13490";
@@ -312,6 +312,24 @@ base.describe("RBAC Settings Visibility - Editor", () => {
await expect(page.getByText(/\d+ tools? disabled/)).toBeVisible({ timeout: 5_000 });
});
base.test("editor can access Product Analytics tab", async ({ page }) => {
await login(page, EDITOR_USER, EDITOR_PASS);
await openSettings(page);
await page.getByRole("button", { name: /product analytics/i }).click();
await expect(page.getByText("Product Analytics").first()).toBeVisible();
await expect(page.getByText(/share anonymous usage data/i)).toBeVisible();
});
base.test("editor General tab shows correct username and role", async ({ page }) => {
await login(page, EDITOR_USER, EDITOR_PASS);
await openSettings(page);
// General is the default tab
await expect(page.getByText(EDITOR_USER)).toBeVisible({ timeout: 5_000 });
await expect(page.getByText("editor").first()).toBeVisible();
});
base.test("editor gets 403 on admin API endpoints", async ({ page }) => {
await login(page, EDITOR_USER, EDITOR_PASS);
@@ -494,4 +512,52 @@ base.describe("RBAC Settings Visibility - User", () => {
expect(dropzoneVisible || headingVisible).toBe(true);
});
base.test("user can upload an image to a tool page", async ({ page }) => {
await login(page, USER_USER, USER_PASS);
// Navigate to the resize tool
await page.goto("/resize");
await page.waitForLoadState("networkidle");
// Upload a test image via the file chooser
const dropzone = page.locator("[class*='border-dashed']").first();
const dropzoneVisible = await dropzone.isVisible().catch(() => false);
if (dropzoneVisible) {
const fileChooserPromise = page.waitForEvent("filechooser");
await dropzone.click();
const fileChooser = await fileChooserPromise;
const testImagePath = getTestImagePath();
await fileChooser.setFiles(testImagePath);
// Wait for the upload to register (the image preview should appear)
await page.waitForTimeout(1_000);
// Verify the image was accepted (a download or process button should appear,
// or the filename should show in the UI)
const hasProcessButton = await page
.getByRole("button", { name: /process|download|resize/i })
.first()
.isVisible()
.catch(() => false);
const hasImagePreview = await page
.locator("img")
.first()
.isVisible()
.catch(() => false);
expect(hasProcessButton || hasImagePreview).toBe(true);
}
});
base.test("user can access API Keys tab", async ({ page }) => {
await login(page, USER_USER, USER_PASS);
await openSettings(page);
await page.getByRole("button", { name: /api keys/i }).click();
await expect(page.locator("h3").filter({ hasText: "API Keys" })).toBeVisible();
await expect(page.getByRole("button", { name: /generate api key/i })).toBeVisible();
});
});