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.
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
import path from "node:path";
|
|
import { expect, test, waitForProcessing } from "./helpers";
|
|
|
|
const PDF_FIXTURE = path.join(
|
|
process.cwd(),
|
|
"tests",
|
|
"fixtures",
|
|
"document",
|
|
"valid",
|
|
"test-3page.pdf",
|
|
);
|
|
|
|
test.describe("PDF to Image tool", () => {
|
|
test("shows page thumbnails after uploading a PDF", async ({ loggedInPage: page }) => {
|
|
await page.goto("/pdf/pdf-to-image");
|
|
|
|
// Upload PDF via file input
|
|
const fileInput = page.locator("input[type='file'][accept='application/pdf']");
|
|
await fileInput.setInputFiles(PDF_FIXTURE);
|
|
|
|
// Wait for page count to appear
|
|
await expect(page.locator(".bg-muted").getByText("3 pages")).toBeVisible({ timeout: 15_000 });
|
|
|
|
// Wait for thumbnails to appear in the results panel
|
|
await expect(page.locator("text=3 of 3 pages selected")).toBeVisible({ timeout: 15_000 });
|
|
});
|
|
|
|
test("converts a PDF page to an image and shows results", async ({ loggedInPage: page }) => {
|
|
await page.goto("/pdf/pdf-to-image");
|
|
|
|
// Upload PDF
|
|
const fileInput = page.locator("input[type='file'][accept='application/pdf']");
|
|
await fileInput.setInputFiles(PDF_FIXTURE);
|
|
await expect(page.locator(".bg-muted").getByText("3 pages")).toBeVisible({ timeout: 15_000 });
|
|
|
|
// Set pages to just page 1
|
|
await page.fill("#pdf-pages", "1");
|
|
|
|
// Click convert
|
|
await page.getByTestId("pdf-to-image-submit").click();
|
|
|
|
// Wait for processing
|
|
await waitForProcessing(page);
|
|
|
|
// Verify download link appears
|
|
await expect(page.getByTestId("pdf-to-image-download")).toBeVisible({ timeout: 15_000 });
|
|
await expect(page.getByTestId("pdf-to-image-download")).toContainText("Download All");
|
|
|
|
// Verify results panel shows converted page
|
|
await expect(page.locator("text=1 page converted")).toBeVisible();
|
|
});
|
|
|
|
test("can select and deselect pages via thumbnails", async ({ loggedInPage: page }) => {
|
|
await page.goto("/pdf/pdf-to-image");
|
|
|
|
// Upload PDF
|
|
const fileInput = page.locator("input[type='file'][accept='application/pdf']");
|
|
await fileInput.setInputFiles(PDF_FIXTURE);
|
|
await expect(page.locator("text=3 of 3 pages selected")).toBeVisible({ timeout: 15_000 });
|
|
|
|
// Click "Deselect All"
|
|
await page.locator("text=Deselect All").click();
|
|
await expect(page.locator("text=0 of 3 pages selected")).toBeVisible();
|
|
|
|
// Click "Select All"
|
|
await page.locator("text=Select All").click();
|
|
await expect(page.locator("text=3 of 3 pages selected")).toBeVisible();
|
|
});
|
|
});
|