mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Security: - Apply sanitizeSvg() to all file upload routes (files.ts, user-files.ts) preventing SSRF and script injection via SVG uploads to file library Functional: - Handle PaddleOCR-VL 1.5 markdown_texts output format in ocr.py - Add empty-text fallback in OCR tier chain (ocr.ts) so higher tiers that return empty text fall back to the next tier automatically - Fix SVG->PNG filename extension mismatch in tool-factory.ts so download endpoint serves correct Content-Type - Report original upload size (not decoded size) in API response Test infrastructure: - Move Playwright auth state from test-results/ to .playwright/ to prevent mid-run cleanup deleting auth files - Fix auth.setup.ts navigation race with waitForURL - Fix gui-batch.spec.ts regex matching "Presets" instead of "reset" - Fix pipeline-advanced.spec.ts crop bounds and resize assertions - Broaden pipeline cleanup to include all E2E-prefixed pipelines
74 lines
1.8 KiB
TypeScript
74 lines
1.8 KiB
TypeScript
import path from "node:path";
|
|
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
const authFile = path.join(__dirname, ".playwright", ".auth", "user.json");
|
|
const testDbPath = path.join(__dirname, "test-results", ".e2e-db", "snapotter.db");
|
|
|
|
const TEST_WEB_PORT = 2349;
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests/e2e",
|
|
timeout: 30_000,
|
|
expect: {
|
|
timeout: 10_000,
|
|
toHaveScreenshot: {
|
|
maxDiffPixelRatio: 0.01,
|
|
animations: "disabled",
|
|
caret: "hide",
|
|
},
|
|
},
|
|
snapshotPathTemplate: "{testDir}/__screenshots__/{testFilePath}/{arg}{ext}",
|
|
fullyParallel: false,
|
|
retries: 0,
|
|
workers: 1,
|
|
reporter: "html",
|
|
use: {
|
|
baseURL: `http://localhost:${TEST_WEB_PORT}`,
|
|
screenshot: "only-on-failure",
|
|
trace: "retain-on-failure",
|
|
},
|
|
projects: [
|
|
{
|
|
name: "setup",
|
|
testMatch: /auth\.setup\.ts/,
|
|
},
|
|
{
|
|
name: "chromium",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
storageState: authFile,
|
|
},
|
|
dependencies: ["setup"],
|
|
},
|
|
],
|
|
webServer: [
|
|
{
|
|
command: `rm -f "${testDbPath}" "${testDbPath}-shm" "${testDbPath}-wal" && mkdir -p "${path.dirname(testDbPath)}" && pnpm --filter @snapotter/api dev`,
|
|
port: 13490,
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
AUTH_ENABLED: "true",
|
|
DEFAULT_USERNAME: "admin",
|
|
DEFAULT_PASSWORD: "admin",
|
|
RATE_LIMIT_PER_MIN: "50000",
|
|
SKIP_MUST_CHANGE_PASSWORD: "true",
|
|
ANALYTICS_ENABLED: "false",
|
|
DB_PATH: testDbPath,
|
|
},
|
|
timeout: 30_000,
|
|
},
|
|
{
|
|
command: "pnpm --filter @snapotter/web dev",
|
|
port: TEST_WEB_PORT,
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
PORT: String(TEST_WEB_PORT),
|
|
VITE_API_URL: "http://localhost:13490",
|
|
},
|
|
timeout: 30_000,
|
|
},
|
|
],
|
|
});
|
|
|
|
export { authFile };
|