WIP: Home deep-link landing test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+18
−0
internal/docs/home_connect_linked_test.go+18 −0
Intent
diff --git a/internal/docs/home_connect_linked_test.go b/internal/docs/home_connect_linked_test.go| index 871d328..f27f631 100644 |
| --- a/internal/docs/home_connect_linked_test.go |
| +++ b/internal/docs/home_connect_linked_test.go |
| @@ -2,6 +2,7 @@ package docs |
| import ( |
| "net/http/httptest" |
| + "net/url" |
| "strings" |
| "testing" |
| "time" |
| @@ -129,3 +130,20 @@ func TestHomeLinkActionsShareOneRow(t *testing.T) { |
| t.Fatalf("actions are not one row with primary first:\n%s", html) |
| } |
| } |
| + |
| +// With Home, a deep link opened signed out and finished by a local |
| +// sign-in still lands on the deep link (spec §9.4). connect lands a local |
| +// sign-in on "/"; Docs puts its own remembered page there. |
| +func TestHomeLocalSignInReturnsToTheDeepLink(t *testing.T) { |
| + f := newRouterHomeFixture(t) |
| + owner := f.browser() |
| + owner.localSignin(t, "alice@example.com") |
| + deep := routerRedirect(t, owner.do("POST", "/documents", "title=Minutes"), "") + "?view=1" |
| + b := f.browser() |
| + signin := routerRedirect(t, b.do("GET", deep, ""), "/signin?return_to="+url.QueryEscape(deep)) |
| + routerRedirect(t, b.do("GET", signin, ""), "/auth/start?return_to="+url.QueryEscape(deep)) |
| + if b.cookies[homeReturnCookie] == nil || b.cookies[connectReturnCookie] == nil { |
| + t.Fatal("the deep link was not remembered for both landings") |
| + } |
| + b.localSignin(t, "alice@example.com", deep) |
| +} |