mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
- Add 55 unit tests for feature-status.ts (installed.json CRUD, cache behavior, install lock, model verification, crash recovery, composite state) using real temp directories - Add 36 integration tests for full install/uninstall lifecycle against Docker containers (face-detection bundle, SSE progress, tool gates, shared model protection, concurrent install prevention, auth guards, container restart recovery) - Fix noise-removal CPU timeout by adding megapixel-based timeout calculation (120s/MP, min 5 minutes) - Fix Playwright auth storage state race condition (mkdirSync before saving analytics-user.json) - Fix 2 skipped tests in fixes-verification.spec.ts by replacing external ~/Downloads/sample dependency with existing test fixtures - Enable skipped analytics-consent settings toggle test - Restructure features.spec.ts to manage bundle state (uninstall/ reinstall OCR) so 501 guard tests run instead of skipping - Update noise-removal test mock to include sharp metadata() method
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { mkdirSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { expect, test as setup } from "@playwright/test";
|
|
|
|
const authFile = path.join(__dirname, "..", "..", "test-results", ".auth", "analytics-user.json");
|
|
|
|
setup("authenticate", async ({ page }) => {
|
|
await page.goto("/login");
|
|
await page.getByLabel("Username").fill("admin");
|
|
await page.getByLabel("Password").fill("admin");
|
|
await page.getByRole("button", { name: /login/i }).click();
|
|
|
|
// Wait for login to complete — page leaves "/login"
|
|
await page.waitForURL((url) => !url.pathname.startsWith("/login"), {
|
|
timeout: 30_000,
|
|
});
|
|
|
|
// If we landed on the consent page, accept or decline it
|
|
if (page.url().includes("/analytics-consent")) {
|
|
const acceptBtn = page.getByRole("button", { name: /sure, sounds good/i });
|
|
await acceptBtn.waitFor({ state: "visible", timeout: 15_000 });
|
|
await acceptBtn.click();
|
|
// Consent page does window.location.href = "/" (full reload)
|
|
await page.waitForURL("/", { timeout: 30_000 });
|
|
}
|
|
|
|
// At this point we should be on the home page
|
|
await expect(page).toHaveURL("/");
|
|
mkdirSync(path.dirname(authFile), { recursive: true });
|
|
await page.context().storageState({ path: authFile });
|
|
});
|