mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
The e2e specs predate the 2.0 section-route migration and navigated to
single-segment tool URLs (/resize) that now 404 (App.tsx only mounts
/:section/:toolId). This broke the whole e2e suite (Cross-Browser, Device
Matrix, E2E Full, Visual) - part of the known stale-spec backlog.
- Sweep 929 goto("/<tool>") -> goto("/<section>/<tool>") across 45 spec
files, using the authoritative TOOLS + toolSection() mapping. Two-segment
routes, top-level routes (/automate, /editor, ...), and intentional 404
tests (/nonexistent-*) are untouched.
- Implement the legacy redirects the specs already assert: the 1.x color
tools (brightness-contrast, saturation, color-channels, color-effects)
redirect to /image/adjust-colors (App.tsx). Good for old bookmarks too.
- Remove the analytics-consent page tests (gui-navigation + gui-visual);
#336 deleted that page.
Mechanical + biome-clean + web typecheck passes. Browser-specific behavior
can only be confirmed by the nightly e2e jobs.
100 lines
4.4 KiB
TypeScript
100 lines
4.4 KiB
TypeScript
import { expect, test, uploadTestImage, waitForProcessing } from "./helpers";
|
|
|
|
test.describe("Essential Tools", () => {
|
|
// ── Resize ────────────────────────────────────────────────────────────
|
|
test("resize tool page renders correctly", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/resize");
|
|
|
|
// Tool header
|
|
await expect(page.getByText("Resize").first()).toBeVisible();
|
|
|
|
// Should show dropzone when no file uploaded
|
|
await expect(page.getByText("Upload from computer")).toBeVisible();
|
|
});
|
|
|
|
test("resize tool shows settings after upload", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/resize");
|
|
await uploadTestImage(page);
|
|
|
|
// Should show settings panel with width/height inputs
|
|
await expect(page.getByText("Settings").first()).toBeVisible();
|
|
// Should show the image viewer instead of dropzone
|
|
await expect(page.getByText("Upload from computer")).not.toBeVisible();
|
|
});
|
|
|
|
test("resize tool processes an image", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/resize");
|
|
await uploadTestImage(page);
|
|
|
|
// Set width (required for resize)
|
|
await page.locator("input[placeholder='Auto']").first().fill("50");
|
|
|
|
await page.getByRole("button", { name: "Resize" }).click();
|
|
await waitForProcessing(page);
|
|
|
|
await expect(page.getByRole("link", { name: /download/i }).first()).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
// ── Crop ──────────────────────────────────────────────────────────────
|
|
test("crop tool page renders correctly", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/crop");
|
|
await expect(page.getByText("Crop").first()).toBeVisible();
|
|
await expect(page.getByText("Upload from computer")).toBeVisible();
|
|
});
|
|
|
|
test("crop tool shows settings after upload", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/crop");
|
|
await uploadTestImage(page);
|
|
await expect(page.getByText("Settings").first()).toBeVisible();
|
|
});
|
|
|
|
// ── Rotate & Flip ────────────────────────────────────────────────────
|
|
test("rotate tool page renders correctly", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/rotate");
|
|
await expect(page.getByText("Rotate").first()).toBeVisible();
|
|
await expect(page.getByText("Upload from computer")).toBeVisible();
|
|
});
|
|
|
|
test("rotate tool shows settings after upload", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/rotate");
|
|
await uploadTestImage(page);
|
|
await expect(page.getByText("Settings").first()).toBeVisible();
|
|
});
|
|
|
|
// ── Convert ───────────────────────────────────────────────────────────
|
|
test("convert tool page renders correctly", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/convert");
|
|
await expect(page.getByText("Convert").first()).toBeVisible();
|
|
await expect(page.getByText("Upload from computer")).toBeVisible();
|
|
});
|
|
|
|
test("convert tool shows format selector after upload", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/convert");
|
|
await uploadTestImage(page);
|
|
await expect(page.getByText("Settings").first()).toBeVisible();
|
|
});
|
|
|
|
// ── Compress ──────────────────────────────────────────────────────────
|
|
test("compress tool page renders correctly", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/compress");
|
|
await expect(page.getByText("Compress").first()).toBeVisible();
|
|
await expect(page.getByText("Upload from computer")).toBeVisible();
|
|
});
|
|
|
|
test("compress tool processes an image", async ({ loggedInPage: page }) => {
|
|
await page.goto("/image/compress");
|
|
await uploadTestImage(page);
|
|
|
|
// Use submit button to avoid matching "Processed:" text
|
|
await page.locator("button[type='submit']").click();
|
|
|
|
await waitForProcessing(page);
|
|
|
|
await expect(page.getByRole("link", { name: /download/i }).first()).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
});
|