mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
* 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: add @dnd-kit/core and @dnd-kit/sortable for pipeline drag-and-drop * feat(pipeline): add Zustand store for pipeline step management * feat(automate): add pipeline step settings summary utility with tests * feat(automate): add POST /api/v1/pipeline/batch for multi-file pipeline execution * feat(automate): add usePipelineProcessor hook for single and batch pipeline execution * fix(automate): pass settings prop to all pipeline step controls for state restoration * feat(automate): rewrite pipeline builder with dnd-kit drag-and-drop and compact step cards * feat(automate): rewrite page with two-panel layout, image preview, and batch support * test(automate): update e2e tests for new two-panel pipeline layout --------- Co-authored-by: Siddharth Kumar Sah <siddharth123sk@gmail.com>
228 lines
8.1 KiB
TypeScript
228 lines
8.1 KiB
TypeScript
import { expect, getTestImagePath, test } from "./helpers";
|
|
|
|
test.describe("Automate Page", () => {
|
|
// Retry flaky tests caused by dev server timing
|
|
test.describe.configure({ retries: 3 });
|
|
|
|
/**
|
|
* Navigate to /automate and wait for the page to fully render.
|
|
* Uses multiple retry strategies for blank-page flakes.
|
|
*/
|
|
async function gotoAutomate(page: import("@playwright/test").Page) {
|
|
const heading = page.getByRole("heading", {
|
|
name: /automate/i,
|
|
});
|
|
|
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
if (attempt === 0) {
|
|
await page.goto("/automate", { waitUntil: "networkidle" });
|
|
} else {
|
|
// On retry, wait then reload
|
|
await page.waitForTimeout(500);
|
|
await page.goto("/automate", { waitUntil: "networkidle" });
|
|
}
|
|
|
|
try {
|
|
await expect(heading).toBeVisible({ timeout: 8_000 });
|
|
return; // Page loaded successfully
|
|
} catch {
|
|
// Continue to next attempt
|
|
}
|
|
}
|
|
|
|
// Final attempt - let it throw if it fails
|
|
await page.goto("/automate", { waitUntil: "networkidle" });
|
|
await expect(heading).toBeVisible({ timeout: 10_000 });
|
|
}
|
|
|
|
/** Wait for pipeline steps to render. */
|
|
async function waitForSteps(page: import("@playwright/test").Page, count: number) {
|
|
await expect(page.getByTitle("Remove")).toHaveCount(count, {
|
|
timeout: 5_000,
|
|
});
|
|
}
|
|
|
|
/** Open the tool picker, search for a tool by name, and click it. */
|
|
async function addToolStep(
|
|
page: import("@playwright/test").Page,
|
|
name: string,
|
|
expectedCount: number,
|
|
) {
|
|
await page.getByRole("button", { name: /add step/i }).click();
|
|
await expect(page.getByText("Add a step")).toBeVisible();
|
|
await page.getByPlaceholder("Search tools...").fill(name);
|
|
await page
|
|
.getByRole("button", { name: new RegExp(name, "i") })
|
|
.first()
|
|
.click();
|
|
await waitForSteps(page, expectedCount);
|
|
}
|
|
|
|
const testImagePath = getTestImagePath();
|
|
|
|
/** Upload the test image via the Dropzone file chooser in the right panel. */
|
|
async function uploadTestFile(page: import("@playwright/test").Page) {
|
|
const fileChooserPromise = page.waitForEvent("filechooser");
|
|
// The Dropzone renders a button labelled "Upload from computer"
|
|
await page.getByRole("button", { name: /upload from computer/i }).click();
|
|
const fileChooser = await fileChooserPromise;
|
|
await fileChooser.setFiles(testImagePath);
|
|
await page.waitForTimeout(500);
|
|
}
|
|
|
|
// --- Page Rendering ---
|
|
|
|
test("automate page renders pipeline builder", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await expect(page.getByText(/chain tools into a pipeline/i).first()).toBeVisible();
|
|
});
|
|
|
|
test("shows empty state message when no steps", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await expect(page.getByText(/add steps to build your pipeline/i)).toBeVisible();
|
|
});
|
|
|
|
test("shows dropzone when no file uploaded", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
// The Dropzone section should be visible with its upload button
|
|
await expect(page.locator("section[aria-label='File drop zone']")).toBeVisible();
|
|
await expect(page.getByRole("button", { name: /upload from computer/i })).toBeVisible();
|
|
});
|
|
|
|
test("has Add Step button", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await expect(page.getByRole("button", { name: /add step/i })).toBeVisible();
|
|
});
|
|
|
|
test("has Process button (disabled when no steps or file)", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
const processBtn = page.getByRole("button", {
|
|
name: "Process",
|
|
exact: true,
|
|
});
|
|
await expect(processBtn).toBeVisible();
|
|
await expect(processBtn).toBeDisabled();
|
|
});
|
|
|
|
test("has Save Pipeline button (disabled when no steps)", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
// Save Pipeline button is only rendered when steps > 0, so it should not exist yet
|
|
await expect(page.getByRole("button", { name: "Save Pipeline" })).not.toBeVisible();
|
|
|
|
// Add a step so the button appears
|
|
await addToolStep(page, "Resize", 1);
|
|
await expect(page.getByRole("button", { name: "Save Pipeline" })).toBeVisible();
|
|
});
|
|
|
|
// --- Add Step ---
|
|
|
|
test("clicking Add Step opens tool picker", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await page.getByRole("button", { name: /add step/i }).click();
|
|
await expect(page.getByText("Add a step")).toBeVisible();
|
|
});
|
|
|
|
test("selecting a tool from picker adds a step", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
// Verify empty state is gone
|
|
await expect(page.getByText(/add steps to build your pipeline/i)).not.toBeVisible();
|
|
});
|
|
|
|
test("can add multiple steps", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
await addToolStep(page, "Convert", 2);
|
|
});
|
|
|
|
test("can add resize, remove-background, then compress without drops", async ({
|
|
loggedInPage: page,
|
|
}) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
await addToolStep(page, "Remove Background", 2);
|
|
await addToolStep(page, "Compress", 3);
|
|
});
|
|
|
|
// --- Step Controls ---
|
|
|
|
test("can remove a step", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
await addToolStep(page, "Compress", 2);
|
|
|
|
await page.getByTitle("Remove").first().click();
|
|
await waitForSteps(page, 1);
|
|
});
|
|
|
|
// --- File Upload ---
|
|
|
|
test("can upload a file via dropzone", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await uploadTestFile(page);
|
|
|
|
// File name should be visible in the left panel file info section
|
|
await expect(page.getByText("test-image.png")).toBeVisible();
|
|
});
|
|
|
|
// --- Save Pipeline ---
|
|
|
|
test("Save Pipeline button enables after adding steps", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
|
|
await expect(page.getByRole("button", { name: "Save Pipeline" })).toBeVisible();
|
|
});
|
|
|
|
test("clicking Save Pipeline shows name input form", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
|
|
await page.getByRole("button", { name: "Save Pipeline" }).click();
|
|
await expect(page.getByPlaceholder("Pipeline name")).toBeVisible();
|
|
});
|
|
|
|
test("can save a pipeline and see it as a chip", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Resize", 1);
|
|
await addToolStep(page, "Compress", 2);
|
|
|
|
const uniqueName = `E2E Pipeline ${Date.now()}`;
|
|
await page.getByRole("button", { name: "Save Pipeline" }).click();
|
|
await page.getByPlaceholder("Pipeline name").fill(uniqueName);
|
|
await page.getByRole("button", { name: "Save", exact: true }).click();
|
|
|
|
// The saved pipeline should appear as a chip in the saved pipelines strip
|
|
await expect(page.getByText(uniqueName).first()).toBeVisible({
|
|
timeout: 5_000,
|
|
});
|
|
});
|
|
|
|
// --- Pipeline Execution ---
|
|
|
|
test("Process button enables when steps and file are set", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Compress", 1);
|
|
await uploadTestFile(page);
|
|
|
|
await expect(page.getByRole("button", { name: "Process", exact: true })).toBeEnabled();
|
|
});
|
|
|
|
test("executing pipeline shows before/after result", async ({ loggedInPage: page }) => {
|
|
await gotoAutomate(page);
|
|
await addToolStep(page, "Strip Metadata", 1);
|
|
await addToolStep(page, "Compress", 2);
|
|
await uploadTestFile(page);
|
|
|
|
await page.getByRole("button", { name: "Process", exact: true }).click();
|
|
|
|
// Wait for the before/after slider to appear (indicates processing completed)
|
|
const slider = page.locator("[aria-label='Before/after comparison slider']");
|
|
await expect(slider).toBeVisible({ timeout: 30_000 });
|
|
|
|
// Should show Original and Processed labels inside the slider
|
|
await expect(page.getByText("Original").first()).toBeVisible();
|
|
await expect(page.getByText("Processed").first()).toBeVisible();
|
|
});
|
|
});
|