Files
SnapOtter/tests/e2e/tools-all.spec.ts
T
a1e11dff74 feat(gif-tools): SOTA upgrade with 6 processing modes (#52)
* feat(find-duplicates): upgrade to 128-bit dHash with metadata and thumbnails

* feat(find-duplicates): add custom-results display mode and duplicate store

* feat(find-duplicates): add results overview grid and detail comparison view

* feat(find-duplicates): overhaul settings with sensitivity presets and download actions

* feat(find-duplicates): update i18n description

* chore: replace jsqr with zxing-wasm for barcode reading

* feat(barcode-read): rewrite backend with zxing-wasm for all barcode types

* feat(barcode-read): rewrite frontend with multi-file, results table, progress, export

- Multi-file sequential processing with per-file progress
- Structured results table with type badges and copy per-result
- Copy All and Export CSV functionality
- Thorough scan toggle (maps to tryHarder in zxing-wasm)
- Before/after view shows annotated image with bounding boxes
- Updated tool description in constants and i18n

* feat(stitch): update tool name and description for redesign

* feat(stitch): add grid layout, alignment, border, radius, quality, and new resize modes

* feat(stitch): redesign settings UI with grid, alignment, border, radius, quality

* test(stitch): add stitch to e2e tool navigation suite

* feat(vectorize): redesign with dual-engine backend and preset-driven UI

- Backend: potrace for B&W, VTracer (@neplex/vectorizer) for full-color vectorization
- Frontend: 5 presets (logo, illustration, photo, sketch, custom)
- Settings: color precision, gradient step, detail, smoothing, corner threshold, invert
- Updated OpenAPI spec and i18n description

* feat(border): redesign with presets, shadow, padding color, swatches

- Add 8 one-click presets (Clean White, Gallery Black, Shadow, Rounded, Polaroid, Vintage, Minimal, Cinematic)
- Implement proper shadow rendering with blur, offset X/Y, color, opacity
- Add padding color control (was hardcoded white)
- Add color swatches for quick color selection
- Wrap in form for Enter key submission
- Add smart validation (requires at least one effect active)
- Align frontend/backend slider ranges
- Organize UI with sections and collapsible shadow toggle

* feat(split): overhaul image splitting with live grid overlay and tile preview

- Add interactive-split display mode with SplitCanvas component
- Live SVG grid overlay on uploaded image showing split boundaries
- Two split modes: Grid (NxM) and Tile Size (px dimensions)
- 9 grid presets (2x1, 1x2, 2x2, 3x1, 1x3, 3x3, 2x3, 3x2, 4x4)
- Output format selection (original/PNG/JPG/WebP) with quality slider
- Post-split tile preview thumbnails with individual download
- Download All as ZIP button
- HEIC/HEIF preview with loading spinner
- Backend: tile-size mode, output format conversion, quality control
- Zustand store for split state management

* feat(split): rewrite backend and frontend settings

Backend: tile-size mode, output format conversion, quality control.
Frontend: split modes, presets, format selector, tile preview grid.

* feat(border): add live CSS preview and remove before/after slider

- Add imageWrapperStyle prop to ImageViewer for live border preview
- Add onImageStyle callback through tool-page to settings components
- Change border displayMode to no-comparison (no slider)
- BorderControls sends live CSS styles (border, padding, radius, shadow)
- Preview updates instantly as user adjusts sliders or clicks presets

* fix: repair i18n file corrupted by formatter during merge conflict resolution

* feat(border): enable live CSS preview in right pane as settings change

* fix(border): keep CSS preview visible after processing for WYSIWYG consistency

* chore(gif-tools): scaffold for SOTA upgrade

- Add animated GIF test fixture (3 frames, 100x100)
- Update tool description to reflect new capabilities
- Add fflate dependency to API for ZIP creation

* feat(gif-tools): rewrite backend with 6 processing modes

Modes: resize (with percentage), optimize (colors/dither/effort),
speed (delay manipulation), reverse (frame reorder), extract
(single/range/all with ZIP), rotate (90/180/270 + flip).

Adds /api/v1/tools/gif-tools/info metadata endpoint.

* test(gif-tools): add integration tests for all 6 modes

Tests metadata endpoint, resize (pixel + percentage), optimize,
speed, reverse, extract (single/range/all), and rotate (angle + flip).

Fix animated.gif fixture to be a real 3-frame animation (was a single
100x300 frame). Fix reverse and rotate modes to process frames
individually and reassemble via GIF binary concatenation, since
Sharp 0.33.x loses page-height metadata when reconstructing from raw
pixel data.

* feat(gif-tools): rewrite frontend with tabbed 6-mode UI

- useGifInfo hook for metadata (frame count, dimensions, duration)
- Info bar showing GIF properties
- 3x2 mode grid: Resize, Optimize, Speed, Reverse, Extract, Rotate
- Animation modes disabled for static images
- Loop control (infinite/once/custom)
- Batch processing support

* test(gif-tools): add to representative tools in e2e suite

---------

Co-authored-by: Siddharth Kumar Sah <siddharth123sk@gmail.com>
2026-04-13 16:23:07 +08:00

116 lines
4.1 KiB
TypeScript

import { expect, test, uploadTestImage } from "./helpers";
// ---------------------------------------------------------------------------
// Test that EVERY tool page loads, shows correct name, and has the right UI.
// This covers the full 37-tool catalog from the PRD.
// ---------------------------------------------------------------------------
const TOOLS_WITH_DROPZONE = [
{ id: "resize", name: "Resize" },
{ id: "crop", name: "Crop" },
{ id: "rotate", name: "Rotate" },
{ id: "convert", name: "Convert" },
{ id: "compress", name: "Compress" },
{ id: "strip-metadata", name: "Strip Metadata" },
{ id: "edit-metadata", name: "Edit Metadata" },
{ id: "bulk-rename", name: "Bulk Rename" },
{ id: "image-to-pdf", name: "Image to PDF" },
{ id: "favicon", name: "Favicon" },
{ id: "adjust-colors", name: "Adjust Colors" },
{ id: "replace-color", name: "Replace" },
{ id: "remove-background", name: "Remove Background" },
{ id: "upscale", name: "Upscal" },
{ id: "erase-object", name: "Object Eraser" },
{ id: "ocr", name: "OCR" },
{ id: "blur-faces", name: "Face" },
{ id: "smart-crop", name: "Smart Crop" },
{ id: "watermark-text", name: "Text Watermark" },
{ id: "watermark-image", name: "Image Watermark" },
{ id: "text-overlay", name: "Text Overlay" },
{ id: "compose", name: "Image Composition" },
{ id: "info", name: "Image Info" },
{ id: "compare", name: "Image Compare" },
{ id: "find-duplicates", name: "Find Duplicates" },
{ id: "color-palette", name: "Color Palette" },
{ id: "barcode-read", name: "Barcode" },
{ id: "collage", name: "Collage" },
{ id: "stitch", name: "Stitch" },
{ id: "split", name: "Image Splitting" },
{ id: "border", name: "Border" },
{ id: "svg-to-raster", name: "SVG to Raster" },
{ id: "vectorize", name: "Image to SVG" },
{ id: "gif-tools", name: "GIF" },
];
const TOOLS_WITHOUT_DROPZONE = [{ id: "qr-generate", name: "QR Code" }];
test.describe("All tool pages render", () => {
for (const tool of TOOLS_WITH_DROPZONE) {
test(`${tool.name} (/${tool.id}) loads with dropzone`, async ({ loggedInPage: page }) => {
await page.goto(`/${tool.id}`);
// Tool name should be visible
await expect(page.getByText(tool.name, { exact: false }).first()).toBeVisible();
// Should show dropzone
await expect(page.getByText("Upload from computer")).toBeVisible();
// Should show Files section
await expect(page.getByText("Files").first()).toBeVisible();
// Should show Settings section
await expect(page.getByText("Settings").first()).toBeVisible();
});
}
for (const tool of TOOLS_WITHOUT_DROPZONE) {
test(`${tool.name} (/${tool.id}) loads without dropzone`, async ({ loggedInPage: page }) => {
await page.goto(`/${tool.id}`);
// Tool name should be visible
await expect(page.getByText(tool.name, { exact: false }).first()).toBeVisible();
// Should show settings
await expect(page.getByText("Settings").first()).toBeVisible();
// Should NOT show the file upload dropzone
await expect(page.getByText("Upload from computer")).not.toBeVisible();
});
}
});
test.describe("Tool pages accept file upload", () => {
// Test a representative subset (testing all 35 would be very slow)
const REPRESENTATIVE_TOOLS = [
"resize",
"compress",
"convert",
"strip-metadata",
"adjust-colors",
"watermark-text",
"info",
"border",
"vectorize",
"gif-tools",
];
for (const toolId of REPRESENTATIVE_TOOLS) {
test(`${toolId} accepts file upload`, async ({ loggedInPage: page }) => {
await page.goto(`/${toolId}`);
await uploadTestImage(page);
// After upload, dropzone should be replaced with image viewer
await expect(page.getByText("Upload from computer")).not.toBeVisible();
// Should show file info (Selected: or the filename)
await expect(page.getByText(/selected|test-image/i).first()).toBeVisible();
});
}
});
test.describe("Tool not found", () => {
test("nonexistent tool shows error", async ({ loggedInPage: page }) => {
await page.goto("/nonexistent-tool-xyz");
await expect(page.getByText(/not found/i)).toBeVisible();
});
});