From 9f9fce0976dcd558d923b7737eaaef7a8a370d0c Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 12 Jun 2026 19:56:38 +0000 Subject: [PATCH] Tests: Update stale portal paths after frontend URI change --- .claude/rules/frontend-rules.md | 4 ++-- frontend/tests/vitest/common/instances.test.js | 4 ++-- internal/config/config_auth_test.go | 4 ++-- internal/config/config_site_test.go | 10 +++++----- internal/config/pwa/url_test.go | 4 ++-- pkg/http/proxy/rewrite_test.go | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.claude/rules/frontend-rules.md b/.claude/rules/frontend-rules.md index f2d339649..328015a1a 100644 --- a/.claude/rules/frontend-rules.md +++ b/.claude/rules/frontend-rules.md @@ -39,11 +39,11 @@ ## Frontend Test Gotchas -- Hidden-route UI checks under `/library/hidden` or `/portal/admin/hidden` require both `files.file_error` and `photos.photo_quality = -1`; `file_error` alone will not surface the row. +- Hidden-route UI checks under `/library/hidden` or `/portal/hidden` require both `files.file_error` and `photos.photo_quality = -1`; `file_error` alone will not surface the row. ## Playwright MCP Usage -- Endpoint `http://localhost:2342/`; logins at `/library/login` (CE/Plus/Pro) and `/portal/admin/login` (Portal). Use local compose admin credentials; if login fails, inspect the active compose env. +- Endpoint `http://localhost:2342/`; logins at `/library/login` (CE/Plus/Pro) and `/portal/login` (Portal). Use local compose admin credentials; if login fails, inspect the active compose env. - Viewports: desktop `1280x900`; mobile uses the mobile Playwright server at `375x667`. Close the browser tab after scripted interactions. - Prefer waits over sleeps; click only visible/enabled elements; use role/label/text selectors (not XPath). - Screenshots: small and reproducible — JPEG, visible viewport, deterministic `.local/screenshots//__.jpg` names, no large inline screenshots. diff --git a/frontend/tests/vitest/common/instances.test.js b/frontend/tests/vitest/common/instances.test.js index 6708bb0d3..3e8fa7b5f 100644 --- a/frontend/tests/vitest/common/instances.test.js +++ b/frontend/tests/vitest/common/instances.test.js @@ -150,9 +150,9 @@ describe("common/instances", () => { it("resolves a Portal route at the origin root", () => { const store = new StorageShim(); seedInstance(store, "ns-pro-1", { url: "https://app.example.com/i/pro-1/" }); - seedInstance(store, "ns-portal", { url: "https://app.example.com/", route: "/portal/admin" }); + seedInstance(store, "ns-portal", { url: "https://app.example.com/", route: "/portal" }); const result = listReachableInstances({ currentNamespace: "ns-pro-1", storage: store }); - expect(result[0].route).toBe("https://app.example.com/portal/admin"); + expect(result[0].route).toBe("https://app.example.com/portal"); }); it("defaults route to the SiteUrl when none is recorded", () => { const store = new StorageShim(); diff --git a/internal/config/config_auth_test.go b/internal/config/config_auth_test.go index 3198fea03..508b51725 100644 --- a/internal/config/config_auth_test.go +++ b/internal/config/config_auth_test.go @@ -118,8 +118,8 @@ func TestConfig_RegisterUri(t *testing.T) { func TestConfig_LoginUri(t *testing.T) { c := NewConfig(CliTestContext()) assert.Equal(t, "/library/login", c.LoginUri()) - c.options.FrontendUri = "/portal/admin/" - assert.Equal(t, "/portal/admin/login", c.LoginUri()) + c.options.FrontendUri = "/portal/" + assert.Equal(t, "/portal/login", c.LoginUri()) } func TestConfig_LoginInfo(t *testing.T) { diff --git a/internal/config/config_site_test.go b/internal/config/config_site_test.go index 777a7fb3f..7da579efb 100644 --- a/internal/config/config_site_test.go +++ b/internal/config/config_site_test.go @@ -68,10 +68,10 @@ func TestConfig_FrontendUri(t *testing.T) { assert.Equal(t, "/foo/library/", c.FrontendUri("/")) assert.Equal(t, "/foo/library/browse", c.FrontendUri("/browse")) - c.options.FrontendUri = "/portal/admin/" - assert.Equal(t, "/foo/portal/admin", c.FrontendUri("")) - assert.Equal(t, "/foo/portal/admin/", c.FrontendUri("/")) - assert.Equal(t, "/foo/portal/admin/browse", c.FrontendUri("/browse")) + c.options.FrontendUri = "/portal/" + assert.Equal(t, "/foo/portal", c.FrontendUri("")) + assert.Equal(t, "/foo/portal/", c.FrontendUri("/")) + assert.Equal(t, "/foo/portal/browse", c.FrontendUri("/browse")) c.options.FrontendUri = " " assert.Equal(t, "/foo/library", c.FrontendUri("")) @@ -81,7 +81,7 @@ func TestNormalizeFrontendPath(t *testing.T) { assert.Equal(t, "", normalizeFrontendPath("")) assert.Equal(t, "", normalizeFrontendPath(" ")) assert.Equal(t, "/library", normalizeFrontendPath("/library")) - assert.Equal(t, "/portal/admin", normalizeFrontendPath("portal/admin/")) + assert.Equal(t, "/portal", normalizeFrontendPath("portal/")) assert.Equal(t, "", normalizeFrontendPath("../admin")) } diff --git a/internal/config/pwa/url_test.go b/internal/config/pwa/url_test.go index 072aceefd..a8fd3c62b 100644 --- a/internal/config/pwa/url_test.go +++ b/internal/config/pwa/url_test.go @@ -16,11 +16,11 @@ func TestShortcutUrl(t *testing.T) { func TestStartUrl(t *testing.T) { t.Run("RootScope", func(t *testing.T) { assert.Equal(t, "./library", StartUrl("/", "/library")) - assert.Equal(t, "./portal/admin", StartUrl("/", "/portal/admin")) + assert.Equal(t, "./portal", StartUrl("/", "/portal")) }) t.Run("PathScope", func(t *testing.T) { assert.Equal(t, "./library", StartUrl("/instance/pro-1/", "/instance/pro-1/library")) - assert.Equal(t, "./portal/admin", StartUrl("/foo/", "/foo/portal/admin")) + assert.Equal(t, "./portal", StartUrl("/foo/", "/foo/portal")) }) t.Run("OutOfScopeFallback", func(t *testing.T) { assert.Equal(t, "/library", StartUrl("/instance/pro-1/", "/library")) diff --git a/pkg/http/proxy/rewrite_test.go b/pkg/http/proxy/rewrite_test.go index adc5d567f..7ed7637b6 100644 --- a/pkg/http/proxy/rewrite_test.go +++ b/pkg/http/proxy/rewrite_test.go @@ -50,7 +50,7 @@ func TestRewriteLocation(t *testing.T) { // under the instance path prefix. assert.Equal(t, "/api/v1/oauth/authorize", RewriteLocation("/api/v1/oauth/authorize", prefix, host)) assert.Equal(t, "/.well-known/openid-configuration", RewriteLocation("/.well-known/openid-configuration", prefix, host)) - assert.Equal(t, "/portal/admin/login", RewriteLocation("/portal/admin/login", prefix, host)) + assert.Equal(t, "/portal/login", RewriteLocation("/portal/login", prefix, host)) assert.Equal(t, "https://portal.example.com/api/v1/oauth/authorize?x=1", RewriteLocation("https://portal.example.com/api/v1/oauth/authorize?x=1", prefix, host)) // Instance-owned API paths (everything under /api/v1/ that is not the OP) @@ -63,7 +63,7 @@ func TestIsPortalRootPath(t *testing.T) { assert.True(t, isPortalRootPath("/api/v1/oauth/token")) assert.True(t, isPortalRootPath("/api/v1/oauth/userinfo")) assert.True(t, isPortalRootPath("/.well-known/openid-configuration")) - assert.True(t, isPortalRootPath("/portal/admin/login")) + assert.True(t, isPortalRootPath("/portal/login")) assert.True(t, isPortalRootPath("api/v1/oauth/authorize")) assert.False(t, isPortalRootPath("/oauth/authorize")) assert.False(t, isPortalRootPath("/library"))