test: massive test coverage expansion (+1,437 tests, 22 new files)

Expand test coverage across all layers via 14 parallel agents:

Unit tests (3,378 total, +534):
- First-ever AI sidecar tests (157 tests covering bridge lifecycle, all 12 tool modules)
- API route infrastructure (auth, pipeline, batch, settings, teams, roles, audit, api-keys, files, docs)
- Lib coverage improvements (audit 7%->95%, worker-pool 33%->100%)
- Web store/lib gap fills (features-store, tool-registry)

Integration tests (4,403 total, +903):
- Expanded 19 tool test files with parameter variations, format edge cases, boundary values
- Cross-format matrix: 290 tests covering 14 tools x 17 formats
- Adversarial/edge cases: 63 tests for extreme inputs, concurrent requests, corrupted files

E2E-Docker (125 new tests):
- Expanded 8 spec files + 1 new file covering all 49 tools
- Added HEIC/format handling, auth failures, download verification

GUI E2E (expanded 28 spec files):
- Navigation, responsive layout, keyboard shortcuts
- All 51 tool UIs with settings, processing, display modes
- Batch/pipeline workflows, settings/RBAC, visual regression
- Resilience, accessibility (ARIA, contrast, focus), performance budgets
This commit is contained in:
SnapOtter
2026-05-09 09:02:29 +08:00
parent 4f0fbade6d
commit 649ad5db9e
138 changed files with 22105 additions and 327 deletions
+179 -6
View File
@@ -47,13 +47,30 @@ test.describe("Visual Tablet (768x1024)", () => {
test.describe("Login page", () => {
test.use({ storageState: { cookies: [], origins: [] } });
test("login page - light and dark", async ({ page }) => {
test("login page empty form - light and dark", async ({ page }) => {
await page.goto("/login");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "login-empty");
});
test("login page filled with error - light and dark", async ({ page }) => {
await page.goto("/login");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
// Fill in invalid credentials and submit
await page.getByLabel("Username").fill("wronguser");
await page.getByLabel("Password").fill("wrongpassword");
await page.getByRole("button", { name: /login/i }).click();
// Wait for the error message to appear
await page.waitForTimeout(1000);
await expect(page.getByText(/invalid|incorrect|failed/i).first()).toBeVisible();
await takeThemedScreenshots(page, "login-error");
});
});
// ---- Home page (empty, no file uploaded) ----
@@ -74,13 +91,30 @@ test.describe("Visual Tablet (768x1024)", () => {
await takeThemedScreenshots(page, "home-uploaded");
});
// ---- Fullscreen grid page ----
test("fullscreen grid - light and dark", async ({ loggedInPage: page }) => {
// ---- Fullscreen grid page (details shown - default) ----
test("fullscreen grid details shown - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/fullscreen");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "fullscreen-grid");
// Details are shown by default
await expect(page.getByText("Hide Details")).toBeVisible();
await takeThemedScreenshots(page, "fullscreen-details-shown");
});
// ---- Fullscreen grid page (details hidden) ----
test("fullscreen grid details hidden - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/fullscreen");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
// Toggle details off
await page.getByText("Hide Details").click();
await page.waitForTimeout(300);
await expect(page.getByText("Show Details")).toBeVisible();
await takeThemedScreenshots(page, "fullscreen-details-hidden");
});
// ---- Automate page (empty pipeline) ----
@@ -94,6 +128,40 @@ test.describe("Visual Tablet (768x1024)", () => {
await takeThemedScreenshots(page, "automate-empty");
});
// ---- Automate page (3 steps added + file uploaded) ----
test("automate page with 3 steps and file - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/automate");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
// Add 3 pipeline steps
const resizeBtn = page.getByRole("button", { name: /resize/i }).first();
const compressBtn = page.getByRole("button", { name: /compress/i }).first();
const convertBtn = page.getByRole("button", { name: /convert/i }).first();
await resizeBtn.click();
await page.waitForTimeout(300);
await compressBtn.click();
await page.waitForTimeout(300);
await convertBtn.click();
await page.waitForTimeout(300);
// Upload a file to the pipeline
await uploadTestImage(page);
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "automate-3steps-file");
});
// ---- Files page (empty) ----
test("files page empty - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/files");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "files-empty");
});
// ---- Settings dialog - General tab ----
test("settings dialog general tab - light and dark", async ({ loggedInPage: page }) => {
await openSettings(page);
@@ -102,6 +170,17 @@ test.describe("Visual Tablet (768x1024)", () => {
await takeThemedScreenshots(page, "settings-general");
});
// ---- Settings dialog - People tab ----
test("settings dialog people tab - light and dark", async ({ loggedInPage: page }) => {
await openSettings(page);
// Navigate to People tab
await page.getByRole("button", { name: "People" }).click();
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "settings-people");
});
// ---- Settings dialog - About tab ----
test("settings dialog about tab - light and dark", async ({ loggedInPage: page }) => {
await openSettings(page);
@@ -113,13 +192,32 @@ test.describe("Visual Tablet (768x1024)", () => {
await takeThemedScreenshots(page, "settings-about");
});
// ---- Help dialog ----
test("help dialog - light and dark", async ({ loggedInPage: page }) => {
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
// Open help dialog via sidebar or button
const sidebar = page.locator("aside");
if (await sidebar.isVisible({ timeout: 2000 }).catch(() => false)) {
await sidebar.getByText("Help").click();
} else {
await page.getByRole("button", { name: /help/i }).click();
}
await page.getByRole("dialog").waitFor({ state: "visible", timeout: 5000 });
await page.waitForTimeout(500);
// Verify dialog fits within tablet viewport
await takeThemedScreenshots(page, "help-dialog");
});
// ---- Tool page - resize (empty, no file) ----
test("resize tool empty - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/resize");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "resize-empty");
await takeThemedScreenshots(page, "tool-resize-empty");
});
// ---- Tool page - resize (file uploaded, settings visible) ----
@@ -128,6 +226,81 @@ test.describe("Visual Tablet (768x1024)", () => {
await uploadTestImage(page);
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "resize-uploaded");
// Verify settings panel layout at tablet width
await expect(page.getByText("Settings").first()).toBeVisible();
await takeThemedScreenshots(page, "tool-resize-settings");
});
// ---- Tool page - compress (before-after result) ----
test("compress tool before-after result - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/compress");
await page.waitForLoadState("networkidle");
await uploadTestImage(page);
await page.waitForTimeout(1000);
// Wait for the before-after slider to appear
const slider = page.locator("[class*='before-after'], [class*='BeforeAfter']").first();
await slider.waitFor({ state: "visible", timeout: 15000 }).catch(() => {});
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "tool-compress-result");
});
// ---- Tool page - crop (interactive canvas) ----
test("crop tool interactive canvas - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/crop");
await page.waitForLoadState("networkidle");
await uploadTestImage(page);
await page.waitForTimeout(1000);
const canvas = page.locator("canvas").first();
await canvas.waitFor({ state: "visible", timeout: 10000 }).catch(() => {});
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "tool-crop-canvas");
});
// ---- Tool page - qr-generate (no-dropzone, QR preview) ----
test("qr-generate tool with preview - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/qr-generate");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
// Enter text to generate a QR code
const textInput = page.locator("input[type='text'], textarea").first();
await textInput.fill("https://snapotter.com");
await page.waitForTimeout(1000);
// Wait for QR preview to render
const preview = page.locator("img, canvas, svg").first();
await preview.waitFor({ state: "visible", timeout: 10000 }).catch(() => {});
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "tool-qr-generate-preview");
});
// ---- Tool page - collage (template selection) ----
test("collage tool template selection - light and dark", async ({ loggedInPage: page }) => {
await page.goto("/collage");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "tool-collage-templates");
});
// ---- Analytics consent page ----
test.describe("Analytics consent page", () => {
test.use({ storageState: { cookies: [], origins: [] } });
test("analytics consent page - light and dark", async ({ page }) => {
await page.goto("/analytics-consent");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(500);
await takeThemedScreenshots(page, "analytics-consent");
});
});
});