Commit 89601690f2
Verified · cmc ci/build: success ci/test: success
Layout: unified · split
e2e/activity_test.go +4 −4
| @@ -49,7 +49,7 @@ func TestActivityGraph(t *testing.T) { | |||
| 49 | if _, _, code := inst.ssh(t, aliceKey, "", "issue", "create", "alice/app", "--title", "'x'"); code != 0 { | 49 | if _, _, code := inst.ssh(t, aliceKey, "", "issue", "create", "alice/app", "--title", "'x'"); code != 0 { |
| 50 | t.Fatal("issue create failed") | 50 | t.Fatal("issue create failed") |
| 51 | } | 51 | } |
| 52 | status, body := inst.get(t, "/alice") | 52 | status, body := inst.get(t, "/alice/-/activity") |
| 53 | if status != 200 || !strings.Contains(body, `class="actgraph"`) { | 53 | if status != 200 || !strings.Contains(body, `class="actgraph"`) { |
| 54 | t.Fatalf("graph missing: %d", status) | 54 | t.Fatalf("graph missing: %d", status) |
| 55 | } | 55 | } |
| @@ -61,14 +61,14 @@ func TestActivityGraph(t *testing.T) { | |||
| 61 | t.Fatalf("alice total = %d, want >= 2", total) | 61 | t.Fatalf("alice total = %d, want >= 2", total) |
| 62 | } | 62 | } |
| 63 | // bob authored a commit but his email is unverified: zero activity. | 63 | // bob authored a commit but his email is unverified: zero activity. |
| 64 | _, bobBody := inst.get(t, "/bob") | 64 | _, bobBody := inst.get(t, "/bob/-/activity") |
| 65 | if bt := activityTotal(t, bobBody); bt != 0 { | 65 | if bt := activityTotal(t, bobBody); bt != 0 { |
| 66 | t.Fatalf("unverified author got credit: total %d", bt) | 66 | t.Fatalf("unverified author got credit: total %d", bt) |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | // Re-pushing the same history (force) does not double-count. | 69 | // Re-pushing the same history (force) does not double-count. |
| 70 | mustGit(t, dir, env, "push", "-q", "--force", "origin", "main") | 70 | mustGit(t, dir, env, "push", "-q", "--force", "origin", "main") |
| 71 | _, body2 := inst.get(t, "/alice") | 71 | _, body2 := inst.get(t, "/alice/-/activity") |
| 72 | if body2 != body { | 72 | if body2 != body { |
| 73 | // Counts must be identical; compare just the graph cells. | 73 | // Counts must be identical; compare just the graph cells. |
| 74 | if excerpt(body, "actgraph") != excerpt(body2, "actgraph") { | 74 | if excerpt(body, "actgraph") != excerpt(body2, "actgraph") { |
| @@ -83,7 +83,7 @@ func TestActivityGraph(t *testing.T) { | |||
| 83 | if _, _, code := inst.ssh(t, aliceKey, "", "repo", "transfer", "alice/app", "theorg"); code != 0 { | 83 | if _, _, code := inst.ssh(t, aliceKey, "", "repo", "transfer", "alice/app", "theorg"); code != 0 { |
| 84 | t.Fatal("transfer failed") | 84 | t.Fatal("transfer failed") |
| 85 | } | 85 | } |
| 86 | _, orgBody := inst.get(t, "/theorg") | 86 | _, orgBody := inst.get(t, "/theorg/-/activity") |
| 87 | if !strings.Contains(orgBody, `class="actgraph"`) || strings.Contains(orgBody, "0 in the last year") { | 87 | if !strings.Contains(orgBody, `class="actgraph"`) || strings.Contains(orgBody, "0 in the last year") { |
| 88 | t.Fatalf("org graph empty:\n%s", excerpt(orgBody, "activity")) | 88 | t.Fatalf("org graph empty:\n%s", excerpt(orgBody, "activity")) |
| 89 | } | 89 | } |
e2e/orgweb_test.go +9 −6
| @@ -28,8 +28,11 @@ func TestOrgManagementWeb(t *testing.T) { | |||
| 28 | 28 | ||
| 29 | // The management sections are admin-only: bob is not even a member. | 29 | // The management sections are admin-only: bob is not even a member. |
| 30 | bob := loginBrowser(t, inst, bobKey) | 30 | bob := loginBrowser(t, inst, bobKey) |
| 31 | if _, body := browserGet(t, bob, inst.base()+"/acme"); strings.Contains(body, `value="member-add"`) { | 31 | // The people tab is the admin panel, so an outsider gets the 404 a |
| 32 | t.Fatal("a non-member sees organization controls") | 32 | // page nobody has rather than a page with the controls hidden. |
| 33 | if status, body := browserGet(t, bob, inst.base()+"/acme/-/people"); status != 404 || | ||
| 34 | strings.Contains(body, `value="member-add"`) { | ||
| 35 | t.Fatalf("a non-member reaches the organization controls: %d", status) | ||
| 33 | } | 36 | } |
| 34 | // And POSTing anyway is refused by the command, not by the template. | 37 | // And POSTing anyway is refused by the command, not by the template. |
| 35 | browserPost(t, bob, inst.base()+"/acme", url.Values{ | 38 | browserPost(t, bob, inst.base()+"/acme", url.Values{ |
| @@ -39,7 +42,7 @@ func TestOrgManagementWeb(t *testing.T) { | |||
| 39 | t.Fatalf("non-admin added themselves: %v", members) | 42 | t.Fatalf("non-admin added themselves: %v", members) |
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | status, body := browserGet(t, alice, inst.base()+"/acme") | 45 | status, body := browserGet(t, alice, inst.base()+"/acme/-/people") |
| 43 | if status != 200 || !strings.Contains(body, `value="member-add"`) { | 46 | if status != 200 || !strings.Contains(body, `value="member-add"`) { |
| 44 | t.Fatalf("admin sees no controls: %d", status) | 47 | t.Fatalf("admin sees no controls: %d", status) |
| 45 | } | 48 | } |
| @@ -73,8 +76,8 @@ func TestOrgManagementWeb(t *testing.T) { | |||
| 73 | t.Fatalf("team grant did not confer access: %s", errOut) | 76 | t.Fatalf("team grant did not confer access: %s", errOut) |
| 74 | } | 77 | } |
| 75 | 78 | ||
| 76 | // The page shows what was built. | 79 | // The people tab shows what was built. |
| 77 | _, body = browserGet(t, alice, inst.base()+"/acme") | 80 | _, body = browserGet(t, alice, inst.base()+"/acme/-/people") |
| 78 | for _, want := range []string{"builders", "acme/widget", "1 member"} { | 81 | for _, want := range []string{"builders", "acme/widget", "1 member"} { |
| 79 | if !strings.Contains(body, want) { | 82 | if !strings.Contains(body, want) { |
| 80 | t.Errorf("org page missing %q", want) | 83 | t.Errorf("org page missing %q", want) |
| @@ -180,7 +183,7 @@ func TestOrgLifecycleWeb(t *testing.T) { | |||
| 180 | } | 183 | } |
| 181 | 184 | ||
| 182 | // Rename is offered to its admin, and the org moves. | 185 | // Rename is offered to its admin, and the org moves. |
| 183 | _, body := browserGet(t, alice, inst.base()+"/acmeco") | 186 | _, body := browserGet(t, alice, inst.base()+"/acmeco/-/people") |
| 184 | if !strings.Contains(body, `value="org-rename"`) { | 187 | if !strings.Contains(body, `value="org-rename"`) { |
| 185 | t.Fatalf("no rename form for the org admin:\n%s", body) | 188 | t.Fatalf("no rename form for the org admin:\n%s", body) |
| 186 | } | 189 | } |
e2e/profile_test.go +15 −11
| @@ -157,7 +157,7 @@ func TestOwnerProfiles(t *testing.T) { | |||
| 157 | } | 157 | } |
| 158 | // Org emphasis parsed, not left as literal slashes the way the | 158 | // Org emphasis parsed, not left as literal slashes the way the |
| 159 | // markdown renderer would. | 159 | // markdown renderer would. |
| 160 | _, body = inst.get(t, "/alice") | 160 | _, body = inst.get(t, "/alice/-/about") |
| 161 | if !strings.Contains(body, "<em>small tools</em>") || strings.Contains(body, "/small tools/") { | 161 | if !strings.Contains(body, "<em>small tools</em>") || strings.Contains(body, "/small tools/") { |
| 162 | t.Fatalf("org about not rendered as org: %s", body) | 162 | t.Fatalf("org about not rendered as org: %s", body) |
| 163 | } | 163 | } |
| @@ -196,25 +196,29 @@ func TestOwnerProfiles(t *testing.T) { | |||
| 196 | t.Fatal("more than five links accepted") | 196 | t.Fatal("more than five links accepted") |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | // Owner pages render description and website link. | 199 | // The bare owner page is the repository list, with the description |
| 200 | // and the link chips in the header above the tabs (#242). | ||
| 200 | status, body = inst.get(t, "/alice") | 201 | status, body = inst.get(t, "/alice") |
| 201 | if status != 200 || !strings.Contains(body, "tinkerer") { | 202 | if status != 200 || !strings.Contains(body, "tinkerer") { |
| 202 | t.Fatalf("user page profile: %d", status) | 203 | t.Fatalf("user page profile: %d", status) |
| 203 | } | 204 | } |
| 204 | // About renders as markdown between the header and the activity graph; | ||
| 205 | // links render as chips. | ||
| 206 | if !strings.Contains(body, "<em>small tools</em>") { | ||
| 207 | t.Fatalf("about not rendered: %s", body) | ||
| 208 | } | ||
| 209 | if !strings.Contains(body, `href="https://fosstodon.example/@alice"`) || | 205 | if !strings.Contains(body, `href="https://fosstodon.example/@alice"`) || |
| 210 | !strings.Contains(body, ">Mastodon<") { | 206 | !strings.Contains(body, ">Mastodon<") { |
| 211 | t.Fatalf("links not rendered: %s", body) | 207 | t.Fatalf("links not rendered: %s", body) |
| 212 | } | 208 | } |
| 213 | if strings.Index(body, "<em>small tools</em>") > strings.Index(body, `class="activity"`) { | 209 | if !strings.Contains(body, `<ul class="repolist"`) { |
| 214 | t.Error("about renders below the activity graph") | 210 | t.Error("the owner page is not the repository list") |
| 211 | } | ||
| 212 | if strings.Contains(body, `class="activity"`) || strings.Contains(body, "<em>small tools</em>") { | ||
| 213 | t.Error("the about text or the activity graph still sits on the repository page") | ||
| 214 | } | ||
| 215 | // Each of them is one tab along, and the markdown renders there. | ||
| 216 | _, aboutBody := inst.get(t, "/alice/-/about") | ||
| 217 | if !strings.Contains(aboutBody, "<em>small tools</em>") { | ||
| 218 | t.Fatalf("about not rendered: %s", aboutBody) | ||
| 215 | } | 219 | } |
| 216 | if strings.Index(body, `<ul class="repolist"`) < strings.Index(body, `class="activity"`) { | 220 | if _, g := inst.get(t, "/alice/-/activity"); !strings.Contains(g, `class="activity"`) { |
| 217 | t.Error("repositories render above the activity graph") | 221 | t.Error("the activity tab has no graph") |
| 218 | } | 222 | } |
| 219 | 223 | ||
| 220 | // Clearing works the same way as the other fields. The about is not | 224 | // Clearing works the same way as the other fields. The about is not |
e2e/profileabout_test.go +2 −2
| @@ -39,7 +39,7 @@ func TestProfileAboutFromRepo(t *testing.T) { | |||
| 39 | t.Errorf("about_path missing: %s", out) | 39 | t.Errorf("about_path missing: %s", out) |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | _, body := inst.get(t, "/alice") | 42 | _, body := inst.get(t, "/alice/-/about") |
| 43 | if !strings.Contains(body, "hello from a file") { | 43 | if !strings.Contains(body, "hello from a file") { |
| 44 | t.Error("web profile does not render the about") | 44 | t.Error("web profile does not render the about") |
| 45 | } | 45 | } |
| @@ -53,7 +53,7 @@ func TestProfileAboutFromRepo(t *testing.T) { | |||
| 53 | "--ref", "main", "--file", "-"); code != 0 { | 53 | "--ref", "main", "--file", "-"); code != 0 { |
| 54 | t.Fatalf("committing bob's org about: %s", errOut) | 54 | t.Fatalf("committing bob's org about: %s", errOut) |
| 55 | } | 55 | } |
| 56 | if _, page := inst.get(t, "/bob"); !strings.Contains(page, "<em>note</em>") { | 56 | if _, page := inst.get(t, "/bob/-/about"); !strings.Contains(page, "<em>note</em>") { |
| 57 | t.Errorf("about did not render as org:\n%s", page) | 57 | t.Errorf("about did not render as org:\n%s", page) |
| 58 | } | 58 | } |
| 59 | } | 59 | } |