test: expand test coverage across unit, integration, e2e, and e2e-docker suites

Add ~210 new tests filling gaps identified by a comprehensive 14-agent
coverage audit. Unit+integration tests go from 9,388 to 9,484 (all passing).

Unit tests (+36):
- AI bridge: OOM fallback path, custom tier option
- Web lib: api-errors, format date/datetime, tool-i18n coverage

Integration tests (+19):
- Format matrix: ai-canvas-expand and find-duplicates added to cross-format matrix
- Adversarial: SVG XXE attacks, SQL injection in settings, request body size
  limits, race conditions with identical filenames

E2E Docker (+3):
- ai-canvas-expand tool coverage with HEIC input and edge cases

E2E GUI (~150+):
- Navigation: login rate limiting, ai-canvas-expand in parameterized list
- Responsive: dropzone visibility, text readability, dialog bounds at all viewports
- Keyboard: shortcuts verified from automate, files, tool, and fullscreen pages
- Tool UI: undo/state-reset for 16 tools, crop canvas drag handles, rotate/border
  live preview, linked aspect-ratio inputs for resize
- Batch: per-image undo isolation, batch compress/convert/rotate (not just resize)
- Pipeline: tool palette search, step collapse/expand visibility
- Settings: audit log entry verification, system settings persistence, teams CRUD,
  role permission toggling
- RBAC: user/editor 403 on roles/teams endpoints, privilege escalation prevention,
  cross-role tab parity documented as intentional
- Accessibility: skip-to-content link (WCAG 2.4.1), comprehensive color contrast
  for all headings/body/buttons in both themes with DOM-walking background detection
- Resilience: auth expiry 401 redirect, rate limit 429 handling
- Performance: JS heap memory stability for tool navigation, dialog cycling,
  upload/clear cycles, rapid page navigation
This commit is contained in:
SnapOtter
2026-05-15 21:35:02 +08:00
parent d38621d7b9
commit 3b181dd1ac
24 changed files with 3398 additions and 0 deletions
+54
View File
@@ -147,6 +147,31 @@ test.describe("Responsive - Desktop (1280x720)", () => {
expect(scrollWidth).toBeLessThanOrEqual(clientWidth);
});
test("dropzone is visible and clickable on desktop", async ({ loggedInPage: page }) => {
const dropzone = page.locator("section[aria-label='File drop zone']");
await expect(dropzone).toBeVisible();
await expect(page.getByText("Upload from computer")).toBeVisible();
});
test("all text on desktop home page is readable (font-size >= 12px)", async ({
loggedInPage: page,
}) => {
const smallText = await page.evaluate(() => {
const elements = document.querySelectorAll("p, span, a, button, label, h1, h2, h3, h4, h5");
let count = 0;
for (const el of elements) {
const style = window.getComputedStyle(el);
const fontSize = Number.parseFloat(style.fontSize);
if (fontSize < 12 && el.textContent && el.textContent.trim().length > 0) {
count++;
}
}
return count;
});
// Allow a small number of decorative/badge elements with smaller text
expect(smallText).toBeLessThanOrEqual(5);
});
test("fullscreen grid interactive elements are reachable", async ({ loggedInPage: page }) => {
await page.goto("/fullscreen");
@@ -285,6 +310,35 @@ test.describe("Responsive - Tablet (768x1024)", () => {
await context.close();
});
test("dropzone is visible on tablet home page", async ({ loggedInPage: page }) => {
const dropzone = page.locator("section[aria-label='File drop zone']");
await expect(dropzone).toBeVisible();
await expect(page.getByText("Upload from computer")).toBeVisible();
});
test("tool page dropzone is visible on tablet", async ({ loggedInPage: page }) => {
await page.goto("/resize");
const dropzone = page.locator("[class*='border-dashed']").first();
await expect(dropzone).toBeVisible();
await expect(page.getByText("Upload from computer")).toBeVisible();
});
test("settings dialog bounding box stays within tablet viewport", async ({
loggedInPage: page,
}) => {
await openSettings(page);
const dialogBox = page.locator("[class*='max-w']").filter({ hasText: "General" }).first();
const box = await dialogBox.boundingBox();
if (box) {
expect(box.x).toBeGreaterThanOrEqual(0);
expect(box.y).toBeGreaterThanOrEqual(0);
expect(box.x + box.width).toBeLessThanOrEqual(TABLET.width + 1);
expect(box.y + box.height).toBeLessThanOrEqual(TABLET.height + 1);
}
});
test("fullscreen grid interactive elements are reachable at tablet", async ({
loggedInPage: page,
}) => {