Files
SnapOtter/tests/e2e/blur-faces.spec.ts
T
ashim-hq ac5fdfb841 fix: update e2e tests for current UI, increase timeouts for CPU environments, and fix auth bypass bug
- Fix SKIP_MUST_CHANGE_PASSWORD not affecting login/session API responses,
  causing frontend redirect even when the env var was set after user creation
- Increase Docker Playwright timeouts (test: 600s, expect: 60s, AI processing: 300s)
  to support CPU-only self-hosted environments
- Increase default rate limit from 100 to 50000 req/min for self-hosted deployments
- Fix OCR tests: use filechooser pattern (Dropzone has no static file input),
  correct enhance checkbox default, rewrite for actual fixture behavior
- Fix remove-bg tests: update quality labels (Balanced→HD, Best→Max)
- Fix noise-removal skip guard: use waitFor() instead of instant isVisible()
- Fix automate pipeline save test: clean up stale E2E pipelines before assertion
2026-04-20 15:03:56 +08:00

49 lines
1.8 KiB
TypeScript

import path from "node:path";
import { expect, 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", () => {
test("page loads with correct UI controls", async ({ loggedInPage: page }) => {
await page.goto("/blur-faces");
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 page.goto("/blur-faces");
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 page.goto("/blur-faces");
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 });
});
});