mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: massive test coverage expansion (+1,437 tests, 22 new files)
Expand test coverage across all layers via 14 parallel agents: Unit tests (3,378 total, +534): - First-ever AI sidecar tests (157 tests covering bridge lifecycle, all 12 tool modules) - API route infrastructure (auth, pipeline, batch, settings, teams, roles, audit, api-keys, files, docs) - Lib coverage improvements (audit 7%->95%, worker-pool 33%->100%) - Web store/lib gap fills (features-store, tool-registry) Integration tests (4,403 total, +903): - Expanded 19 tool test files with parameter variations, format edge cases, boundary values - Cross-format matrix: 290 tests covering 14 tools x 17 formats - Adversarial/edge cases: 63 tests for extreme inputs, concurrent requests, corrupted files E2E-Docker (125 new tests): - Expanded 8 spec files + 1 new file covering all 49 tools - Added HEIC/format handling, auth failures, download verification GUI E2E (expanded 28 spec files): - Navigation, responsive layout, keyboard shortcuts - All 51 tool UIs with settings, processing, display modes - Batch/pipeline workflows, settings/RBAC, visual regression - Resilience, accessibility (ARIA, contrast, focus), performance budgets
This commit is contained in:
@@ -617,4 +617,132 @@ test.describe("Pipeline with various tools", () => {
|
||||
const body = await res.json();
|
||||
expect(body.downloadUrl).toBeTruthy();
|
||||
});
|
||||
|
||||
test("color-blindness then resize pipeline", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/execute", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
multipart: {
|
||||
file: { name: "test.png", mimeType: "image/png", buffer: PNG_200x150 },
|
||||
pipeline: JSON.stringify({
|
||||
steps: [
|
||||
{
|
||||
toolId: "color-blindness",
|
||||
settings: { simulationType: "deuteranopia" },
|
||||
},
|
||||
{ toolId: "resize", settings: { width: 100, fit: "contain" } },
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
expect(res.ok()).toBe(true);
|
||||
const body = await res.json();
|
||||
expect(body.downloadUrl).toBeTruthy();
|
||||
});
|
||||
|
||||
test("meme-generator then compress pipeline", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/execute", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
multipart: {
|
||||
file: { name: "test.jpg", mimeType: "image/jpeg", buffer: JPG_100x100 },
|
||||
pipeline: JSON.stringify({
|
||||
steps: [
|
||||
{
|
||||
toolId: "meme-generator",
|
||||
settings: {
|
||||
textLayout: "top-bottom",
|
||||
textBoxes: [
|
||||
{ id: "top", text: "PIPELINE" },
|
||||
{ id: "bottom", text: "MEMES" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{ toolId: "compress", settings: { quality: 70 } },
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
expect(res.ok()).toBe(true);
|
||||
const body = await res.json();
|
||||
expect(body.downloadUrl).toBeTruthy();
|
||||
});
|
||||
|
||||
test("beautify then convert pipeline", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/execute", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
multipart: {
|
||||
file: { name: "test.png", mimeType: "image/png", buffer: PNG_200x150 },
|
||||
pipeline: JSON.stringify({
|
||||
steps: [
|
||||
{
|
||||
toolId: "beautify",
|
||||
settings: {
|
||||
backgroundType: "solid",
|
||||
backgroundColor: "#1a1a2e",
|
||||
padding: 32,
|
||||
borderRadius: 8,
|
||||
shadowPreset: "none",
|
||||
frame: "none",
|
||||
},
|
||||
},
|
||||
{ toolId: "convert", settings: { format: "webp" } },
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
expect(res.ok()).toBe(true);
|
||||
const body = await res.json();
|
||||
expect(body.downloadUrl).toBeTruthy();
|
||||
});
|
||||
|
||||
test("four-step pipeline: resize, adjust-colors, border, compress", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/execute", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
multipart: {
|
||||
file: { name: "sample.jpg", mimeType: "image/jpeg", buffer: JPG_SAMPLE },
|
||||
pipeline: JSON.stringify({
|
||||
steps: [
|
||||
{ toolId: "resize", settings: { width: 500, fit: "contain" } },
|
||||
{ toolId: "adjust-colors", settings: { brightness: 5, contrast: 10 } },
|
||||
{ toolId: "border", settings: { size: 5, color: "#333333" } },
|
||||
{ toolId: "compress", settings: { quality: 75 } },
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
expect(res.ok()).toBe(true);
|
||||
const body = await res.json();
|
||||
expect(body.downloadUrl).toBeTruthy();
|
||||
expect(body.processedSize).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Pipeline Auth Failure ──────────────────────────────────────
|
||||
|
||||
test.describe("Pipeline auth failure", () => {
|
||||
test("pipeline execution without token returns 401", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/execute", {
|
||||
multipart: {
|
||||
file: { name: "test.png", mimeType: "image/png", buffer: PNG_200x150 },
|
||||
pipeline: JSON.stringify({
|
||||
steps: [{ toolId: "resize", settings: { width: 100 } }],
|
||||
}),
|
||||
},
|
||||
});
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
|
||||
test("pipeline save without token returns 401", async ({ request }) => {
|
||||
const res = await request.post("/api/v1/pipeline/save", {
|
||||
data: {
|
||||
name: "Unauthorized Pipeline",
|
||||
steps: [{ toolId: "resize", settings: { width: 100 } }],
|
||||
},
|
||||
});
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
|
||||
test("pipeline list without token returns 401", async ({ request }) => {
|
||||
const res = await request.get("/api/v1/pipeline/list");
|
||||
expect(res.status()).toBe(401);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user