test: expand coverage across all layers -- 1,268 new tests, fix replace-color div-by-zero

14-agent parallel test expansion covering integration, unit, E2E, E2E-Docker,
cross-format matrix, adversarial, GUI navigation/tools/settings/visual/a11y/perf.

- Integration: expand 23 tool test files with HEIC, stress, batch, edge cases
- Unit: close coverage gaps in image-engine, stores, lib (metadata, auto-enhance,
  connection-store, lazy-with-retry, collage/file-store HEIC preview)
- AI bridge: 141 new tests for dispatcher buffering, crash recovery, OOM/segfault
- Cross-format: 794 parameterized tests (16 formats x 12 tools + no-crash matrix)
- Adversarial: memory stress (50x large file), zero-byte, corrupted headers, unicode
- E2E-Docker: expand 8 spec files with dimension verification, pipeline chains
- GUI E2E: tool UI settings/interactions for all 47 tools, remove all test.skip,
  RBAC per-role verification, visual screenshot naming, cross-browser smoke tests,
  a11y ARIA/focus/contrast, performance budgets, 15-tool stability test
- Fix: replace-color.ts tolerance=0 caused division-by-zero producing NaN pixels

Total: 8,958 tests passing across 202 files. Zero failures, zero skips.
This commit is contained in:
SnapOtter
2026-05-09 18:02:58 +08:00
parent 7b1f09f5d0
commit a0556772e8
76 changed files with 13112 additions and 117 deletions
+70
View File
@@ -129,6 +129,76 @@ test.describe("GUI Settings - Tools Tab (toggle visibility)", () => {
await page.waitForTimeout(500);
});
test("toggling a tool off and saving, then on again restores it", async ({
loggedInPage: page,
}) => {
await openSettings(page);
await page.getByRole("button", { name: /tools/i }).click();
await expect(page.getByText(/\d+ tools? disabled/)).toBeVisible({ timeout: 5_000 });
// Read the initial disabled count
const counterText = page.getByText(/\d+ tools? disabled/);
const initialText = await counterText.textContent();
const initialCount = parseInt(initialText?.match(/(\d+)/)?.[1] || "0", 10);
// Toggle the first tool off (if it is currently enabled)
const firstToggle = page.locator("button.w-11.h-6").first();
const wasEnabled = await firstToggle.evaluate((el) => el.classList.contains("bg-primary"));
if (wasEnabled) {
await firstToggle.click();
// Counter should increase by 1
const afterText = await counterText.textContent();
const afterCount = parseInt(afterText?.match(/(\d+)/)?.[1] || "0", 10);
expect(afterCount).toBe(initialCount + 1);
// Toggle it back on
await firstToggle.click();
const restoredText = await counterText.textContent();
const restoredCount = parseInt(restoredText?.match(/(\d+)/)?.[1] || "0", 10);
expect(restoredCount).toBe(initialCount);
}
});
test("tool toggle state persists after saving and re-opening dialog", async ({
loggedInPage: page,
}) => {
await openSettings(page);
await page.getByRole("button", { name: /tools/i }).click();
await expect(page.getByText(/\d+ tools? disabled/)).toBeVisible({ timeout: 5_000 });
// Read the initial disabled count
const counterText = page.getByText(/\d+ tools? disabled/);
const initialText = await counterText.textContent();
const initialCount = parseInt(initialText?.match(/(\d+)/)?.[1] || "0", 10);
// Toggle the first tool to change state
const firstToggle = page.locator("button.w-11.h-6").first();
await firstToggle.click();
// Save
await page.getByRole("button", { name: /save tool settings/i }).click();
await expect(page.getByText("Restart required for changes to take effect.")).toBeVisible({
timeout: 5_000,
});
// Close and re-open
await page.keyboard.press("Escape");
await openSettings(page);
await page.getByRole("button", { name: /tools/i }).click();
await expect(page.getByText(/\d+ tools? disabled/)).toBeVisible({ timeout: 5_000 });
// The count should reflect the saved change
const afterReopen = await page.getByText(/\d+ tools? disabled/).textContent();
const afterCount = parseInt(afterReopen?.match(/(\d+)/)?.[1] || "0", 10);
expect(Math.abs(afterCount - initialCount)).toBe(1);
// Revert: toggle the first tool back
await page.locator("button.w-11.h-6").first().click();
await page.getByRole("button", { name: /save tool settings/i }).click();
await page.waitForTimeout(500);
});
test("Enable All and Disable All buttons work", async ({ loggedInPage: page }) => {
await openSettings(page);
await page.getByRole("button", { name: /tools/i }).click();