Files
SnapOtter/tests/e2e/blur-faces.spec.ts
T
SnapOtter 03f82567d0 test: expand API and GUI test coverage across all tools
Add ~500 new E2E tests and ~300 new integration tests covering:

- 24 new GUI E2E specs: navigation, responsive layout, keyboard shortcuts,
  tool UI for all 35 non-AI tools, batch/pipeline workflows, settings/RBAC,
  visual regression, accessibility, and performance budgets
- 3 new E2E-Docker specs: batch workflows, advanced pipelines, cross-format
- 1 new adversarial integration test: memory pressure, corrupted files,
  unicode filenames, extreme dimensions, pipeline/batch edge cases
- 29 expanded integration test files: HEIC/HEIF input, large files, parameter
  boundaries, batch processing, format edge cases across all tools
- Cross-format matrix expanded: 641 tests covering every tool x 18 formats
- AI bridge unit tests expanded: lifecycle, tool modules, error propagation
- Unit test gaps filled: analytics, tool-registry, web stores

Also fixes:
- vitest.config.ts: exclude e2e-docs and e2e-landing from Vitest runner
- AI E2E specs: add sidecar health check to skip gracefully when Python
  AI backend is not running instead of timing out
2026-04-29 01:39:25 +08:00

61 lines
2.2 KiB
TypeScript

import path from "node:path";
import { expect, isAiSidecarRunning, test } from "./helpers";
function fixturePath(name: string): string {
return path.join(process.cwd(), "tests", "fixtures", name);
}
async function uploadFile(page: import("@playwright/test").Page, filePath: string) {
const fileChooserPromise = page.waitForEvent("filechooser");
const dropzone = page.locator("[class*='border-dashed']").first();
await dropzone.click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(filePath);
await page.waitForTimeout(1000);
}
test.describe("Blur Faces tool", () => {
async function skipIfFeatureNotInstalled(page: import("@playwright/test").Page) {
await page.goto("/blur-faces");
try {
await page.getByTestId("blur-faces-submit").waitFor({ state: "visible", timeout: 15_000 });
} catch {
test.skip(true, "face-detection feature bundle not installed");
}
if (!(await isAiSidecarRunning(page))) {
test.skip(true, "AI sidecar not running");
}
}
test("page loads with correct UI controls", async ({ loggedInPage: page }) => {
await skipIfFeatureNotInstalled(page);
await expect(page.getByText("Blur Radius")).toBeVisible();
await expect(page.getByText("Detection Sensitivity")).toBeVisible();
await expect(page.getByTestId("blur-faces-submit")).toBeVisible();
});
test("HEIC image processes without error", async ({ loggedInPage: page }) => {
await skipIfFeatureNotInstalled(page);
await uploadFile(page, fixturePath("test-portrait.heic"));
await page.getByTestId("blur-faces-submit").click();
// Should complete without the old "cannot identify image file" error
await expect(
page.getByTestId("blur-faces-download").or(page.getByText("No faces detected")).first(),
).toBeVisible({ timeout: 300_000 });
await expect(page.locator("text=cannot identify image")).not.toBeVisible();
});
test("no-face image shows warning message", async ({ loggedInPage: page }) => {
await skipIfFeatureNotInstalled(page);
await uploadFile(page, fixturePath("test-blank.png"));
await page.getByTestId("blur-faces-submit").click();
await expect(page.getByText("No faces detected")).toBeVisible({ timeout: 300_000 });
});
});