Files
SnapOtter/tests/e2e/gui-settings-tools.spec.ts
T
SnapOtter 03f82567d0 test: expand API and GUI test coverage across all tools
Add ~500 new E2E tests and ~300 new integration tests covering:

- 24 new GUI E2E specs: navigation, responsive layout, keyboard shortcuts,
  tool UI for all 35 non-AI tools, batch/pipeline workflows, settings/RBAC,
  visual regression, accessibility, and performance budgets
- 3 new E2E-Docker specs: batch workflows, advanced pipelines, cross-format
- 1 new adversarial integration test: memory pressure, corrupted files,
  unicode filenames, extreme dimensions, pipeline/batch edge cases
- 29 expanded integration test files: HEIC/HEIF input, large files, parameter
  boundaries, batch processing, format edge cases across all tools
- Cross-format matrix expanded: 641 tests covering every tool x 18 formats
- AI bridge unit tests expanded: lifecycle, tool modules, error propagation
- Unit test gaps filled: analytics, tool-registry, web stores

Also fixes:
- vitest.config.ts: exclude e2e-docs and e2e-landing from Vitest runner
- AI E2E specs: add sidecar health check to skip gracefully when Python
  AI backend is not running instead of timing out
2026-04-29 01:39:25 +08:00

73 lines
3.1 KiB
TypeScript

import { expect, test } from "./helpers";
// ---------------------------------------------------------------------------
// Settings Dialog -- Tools tab (enable/disable) and Product Analytics
// ---------------------------------------------------------------------------
test.describe("GUI Settings - Tools Tab", () => {
test("displays tools list with category headings", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /tools/i }).click();
await expect(page.locator("h3").filter({ hasText: "Tools" }).first()).toBeVisible();
await expect(page.getByText("Enable or disable individual tools")).toBeVisible();
// At least one category heading should be visible (uppercase text)
const categoryHeadings = page.locator("h4");
await expect(categoryHeadings.first()).toBeVisible();
});
test("Save Tool Settings button and disabled tools counter", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /tools/i }).click();
await expect(page.getByRole("button", { name: /save tool settings/i })).toBeVisible();
// The disabled tools counter text
await expect(page.getByText(/\d+ tools? disabled/)).toBeVisible();
});
test("saving tool settings shows restart banner", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /tools/i }).click();
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,
});
});
});
test.describe("GUI Settings - Product Analytics Tab", () => {
test("displays analytics consent section", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /product analytics/i }).click();
await expect(page.getByText("Product Analytics").first()).toBeVisible();
await expect(page.getByText(/share anonymous usage data/i)).toBeVisible();
});
test("analytics toggle is present", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /product analytics/i }).click();
// Either the toggle button is present, or the admin-disabled message is shown
const toggle = page.locator("button.rounded-full");
const disabledMsg = page.getByText(/has been disabled by the server administrator/i);
const toggleVisible = await toggle.isVisible().catch(() => false);
const disabledVisible = await disabledMsg.isVisible().catch(() => false);
// One of the two states must be true
expect(toggleVisible || disabledVisible).toBe(true);
});
test("privacy policy link is present", async ({ loggedInPage: page }) => {
await page.locator("aside").getByText("Settings").click();
await page.getByRole("button", { name: /product analytics/i }).click();
await expect(page.getByRole("link", { name: /learn more/i })).toBeVisible();
});
});