mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
Tests: Update stale portal paths after frontend URI change
This commit is contained in:
parent
d594edd5de
commit
9f9fce0976
6 changed files with 15 additions and 15 deletions
|
|
@ -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/<case>/<step>__<viewport>.jpg` names, no large inline screenshots.
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue