Files
SnapOtter/tests/e2e/home-page.spec.ts
T
Siddharth Kumar Sah ce03aad10f feat: production Docker, Playwright tests, settings API, and bug fixes
- Add user management endpoints (register, list, delete, change password)
- Add API key management (create, list, delete)
- Add settings persistence endpoints (get, put)
- Wire settings dialog to real backend (People, API Keys, System, Security)
- Fix login auth flow (window.location.href for full reload)
- Fix download URLs returning 401 (make public since UUIDs are unguessable)
- Fix border tool shadowColor validation (accept 6-8 hex digits)
- Fix remove-bg alpha matting fallback (retry without on failure)
- Fix AI tool silent fallbacks (report errors instead of no-ops)
- Add checkerboard background to before/after slider for transparency
- Add progress bars to all AI tool components
- Add Playwright E2E test suite (131 tests across 9 test files)
- Rewrite Dockerfile for production (tsx runtime, pre-baked AI models)
- Add .dockerignore for faster builds
- Add proper accessible labels to login form
2026-03-22 19:28:57 +08:00

110 lines
3.2 KiB
TypeScript

import { test, expect, uploadTestImage } from "./helpers";
test.describe("Home Page", () => {
test("shows Stirling Image branding in dropzone", async ({
loggedInPage: page,
}) => {
await expect(page.getByText("Stirling").first()).toBeVisible();
await expect(page.getByText("Image").first()).toBeVisible();
});
test("dropzone shows upload button", async ({ loggedInPage: page }) => {
await expect(page.getByText("Upload from computer")).toBeVisible();
});
test("tool panel is visible on home page", async ({
loggedInPage: page,
}) => {
// Search bar should be visible in tool panel
await expect(page.getByPlaceholder(/search/i).first()).toBeVisible();
// Tool categories should be visible
await expect(page.getByText("Essentials").first()).toBeVisible();
});
test("tool panel search filters tools", async ({ loggedInPage: page }) => {
const searchInput = page.getByPlaceholder(/search/i).first();
await searchInput.fill("compress");
// Should show Compress tool
await expect(page.getByText("Compress").first()).toBeVisible();
});
test("clicking a tool in panel navigates to tool page", async ({
loggedInPage: page,
}) => {
// Find and click a tool link
await page
.locator("a")
.filter({ hasText: "Resize" })
.first()
.click();
await expect(page).toHaveURL("/resize");
});
test("after upload shows quick actions and tool selector", async ({
loggedInPage: page,
}) => {
await uploadTestImage(page);
// Should show quick actions
await expect(page.getByText("Quick Actions").first()).toBeVisible();
// Should show quick action tools
await expect(
page.getByRole("button", { name: /resize/i }).first(),
).toBeVisible();
await expect(
page.getByRole("button", { name: /compress/i }).first(),
).toBeVisible();
// Should show all tools section
await expect(page.getByText("All Tools").first()).toBeVisible();
});
test("after upload shows image preview", async ({
loggedInPage: page,
}) => {
await uploadTestImage(page);
// Should show the image preview (file info)
await expect(page.getByText(/test-image/i).first()).toBeVisible();
});
test("change file button resets upload", async ({
loggedInPage: page,
}) => {
await uploadTestImage(page);
// Click change file
await page.getByText("Change file").click();
// Should go back to dropzone
await expect(page.getByText("Upload from computer")).toBeVisible();
});
test("clicking quick action tool navigates with file", async ({
loggedInPage: page,
}) => {
await uploadTestImage(page);
// Click resize quick action
await page
.getByRole("button", { name: /resize/i })
.first()
.click();
await expect(page).toHaveURL("/resize");
// File should still be loaded (no dropzone)
await expect(page.getByText("Upload from computer")).not.toBeVisible();
});
test("footer has theme toggle", async ({ loggedInPage: page }) => {
// Footer should have theme toggle
const footer = page.locator("[class*='fixed'][class*='bottom']").last();
await expect(footer).toBeVisible();
});
});