mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: resolve 3 pre-existing issues found during test coverage expansion
1. passport-photo 404 vs 501: add base route at /api/v1/tools/passport-photo
that returns 501 FEATURE_NOT_INSTALLED when the AI bundle is missing,
matching other AI tools. The /generate sub-route is Sharp-only (no
sidecar) so it correctly skips the isToolInstalled guard.
2. AuthGuard analytics consent race: don't evaluate shouldShowConsent()
until analyticsConfig has been fetched (guard on analyticsConfig !== null).
Prevents redirect to /analytics-consent before config is loaded.
3. Fragile sidebar Settings selector: add openSettings(page) helper to
E2E helpers that checks sidebar visibility with fallback to button role.
Replace all 134 occurrences of page.locator("aside").getByText("Settings")
across 18 test files.
This commit is contained in:
+10
-10
@@ -1,15 +1,15 @@
|
||||
import { expect, test } from "./helpers";
|
||||
import { expect, openSettings, test } from "./helpers";
|
||||
|
||||
test.describe("Settings Dialog", () => {
|
||||
test("opens from sidebar", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Settings dialog should appear with sections
|
||||
await expect(page.getByText("General").first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("General section shows user info", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Should show username and version info
|
||||
await expect(page.getByText(/admin/i).first()).toBeVisible();
|
||||
@@ -17,14 +17,14 @@ test.describe("Settings Dialog", () => {
|
||||
});
|
||||
|
||||
test("General section has logout button", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
const logoutBtn = page.getByRole("button", { name: /logout|log out/i });
|
||||
await expect(logoutBtn).toBeVisible();
|
||||
});
|
||||
|
||||
test("Security section has change password form", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Navigate to Security section
|
||||
await page.getByText("Security").click();
|
||||
@@ -34,7 +34,7 @@ test.describe("Settings Dialog", () => {
|
||||
});
|
||||
|
||||
test("People section shows user list", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Navigate to People section
|
||||
await page.getByText("People").click();
|
||||
@@ -54,7 +54,7 @@ test.describe("Settings Dialog", () => {
|
||||
await page.goto("/");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const apiKeysBtn = page.getByRole("button", { name: /api keys/i });
|
||||
@@ -70,7 +70,7 @@ test.describe("Settings Dialog", () => {
|
||||
});
|
||||
|
||||
test("About section shows app info", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Navigate to About section
|
||||
await page.getByText("About").click();
|
||||
@@ -80,7 +80,7 @@ test.describe("Settings Dialog", () => {
|
||||
});
|
||||
|
||||
test("System Settings section has configuration", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
|
||||
// Navigate to System Settings section
|
||||
await page.getByText("System Settings").click();
|
||||
@@ -90,7 +90,7 @@ test.describe("Settings Dialog", () => {
|
||||
});
|
||||
|
||||
test("settings dialog can be closed", async ({ loggedInPage: page }) => {
|
||||
await page.locator("aside").getByText("Settings").click();
|
||||
await openSettings(page);
|
||||
await expect(page.getByText("General").first()).toBeVisible();
|
||||
|
||||
// Close by clicking X or outside
|
||||
|
||||
Reference in New Issue
Block a user