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:
@@ -1,4 +1,4 @@
|
||||
import { expect, test, uploadTestImage } from "./helpers";
|
||||
import { expect, openSettings, test, uploadTestImage } from "./helpers";
|
||||
|
||||
const isDocker = process.env.CI === "true" || process.env.DOCKER === "true";
|
||||
const MOD = process.platform === "darwin" ? "Meta" : "Control";
|
||||
@@ -96,19 +96,7 @@ test.describe("Visual Tablet (768x1024)", () => {
|
||||
|
||||
// ---- Settings dialog - General tab ----
|
||||
test("settings dialog general tab - light and dark", async ({ loggedInPage: page }) => {
|
||||
// On tablet, the sidebar may or may not be visible; try sidebar first, fallback to nav
|
||||
const sidebar = page.locator("aside");
|
||||
const sidebarVisible = await sidebar.isVisible().catch(() => false);
|
||||
|
||||
if (sidebarVisible) {
|
||||
await sidebar.getByText("Settings").click();
|
||||
} else {
|
||||
// Fallback: bottom nav bar
|
||||
const bottomNav = page.locator("nav.fixed");
|
||||
await bottomNav.getByText("Settings").click();
|
||||
}
|
||||
|
||||
await expect(page.getByRole("heading", { name: "General" })).toBeVisible();
|
||||
await openSettings(page);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await takeThemedScreenshots(page, "settings-general");
|
||||
@@ -116,17 +104,7 @@ test.describe("Visual Tablet (768x1024)", () => {
|
||||
|
||||
// ---- Settings dialog - About tab ----
|
||||
test("settings dialog about tab - light and dark", async ({ loggedInPage: page }) => {
|
||||
const sidebar = page.locator("aside");
|
||||
const sidebarVisible = await sidebar.isVisible().catch(() => false);
|
||||
|
||||
if (sidebarVisible) {
|
||||
await sidebar.getByText("Settings").click();
|
||||
} else {
|
||||
const bottomNav = page.locator("nav.fixed");
|
||||
await bottomNav.getByText("Settings").click();
|
||||
}
|
||||
|
||||
await expect(page.getByRole("heading", { name: "General" })).toBeVisible();
|
||||
await openSettings(page);
|
||||
|
||||
// Navigate to About tab
|
||||
await page.getByRole("button", { name: "About" }).click();
|
||||
|
||||
Reference in New Issue
Block a user