Commit 4d2790c419

4d2790c4197f943ef7906c32af388d6b501b93f8

parent: f5294b9a1e

Verified · cmc ci/build: success ci/test: success

cmc <hello@cleberg.net> · 2026-09-19 01:52 UTC

e2e: cover the merge request list's check chip and comment count

Wiki: mention the list's check state and comment count under Merge
requests.

Closes #230
.gitbay/wiki/Users.org +4
@@ -420,6 +420,10 @@ its change forward: =mr close 4 --by 7= records it and both pages show
420420it, and =mr edit 4 --superseded-by 7|none= sets or clears it
421421afterwards, refused on anything but a closed merge request.
422422
423The web list shows each request's combined check state and comment
424count alongside its title, so open work needing attention stands out
425without opening it.
426
423427Semantics worth knowing:
424428
425429- the MR head lives in the *target* repository as
e2e/mrweb_test.go +49
@@ -238,6 +238,55 @@ func TestMRWebCreate(t *testing.T) {
238238 }
239239}
240240
241// TestMRListRows checks that the merge request list shows each row's
242// combined check state and comment count (#230).
243func TestMRListRows(t *testing.T) {
244 inst := startInstanceWith(t, "[web]\nmode = \"accounts\"\n")
245 aliceKey := inst.newKey(t, "alice")
246 inst.admin(t, "admin", "user", "create", "alice",
247 "--key", aliceKey+".pub", "--email", "alice@example.test", "--verified")
248 if _, errOut, code := inst.ssh(t, aliceKey, "", "repo", "create", "alice/lib"); code != 0 {
249 t.Fatalf("repo create: %s", errOut)
250 }
251 env := inst.gitEnv(aliceKey)
252 work := t.TempDir()
253 mustGit(t, work, env, "clone", inst.sshURL("alice/lib"), "w")
254 dir := filepath.Join(work, "w")
255 os.WriteFile(filepath.Join(dir, "a.txt"), []byte("a\n"), 0o644)
256 mustGit(t, dir, env, "checkout", "-q", "-b", "main")
257 mustGit(t, dir, env, "add", ".")
258 mustGit(t, dir, env, "commit", "-q", "-m", "base")
259 mustGit(t, dir, env, "push", "-q", "origin", "main")
260 mustGit(t, dir, env, "checkout", "-q", "-b", "topic")
261 os.WriteFile(filepath.Join(dir, "b.txt"), []byte("b\n"), 0o644)
262 mustGit(t, dir, env, "add", ".")
263 mustGit(t, dir, env, "commit", "-q", "-m", "topic work")
264 mustGit(t, dir, env, "push", "-q", "origin", "topic")
265 sha := strings.TrimSpace(mustGit(t, dir, env, "rev-parse", "topic"))
266
267 if _, errOut, code := inst.ssh(t, aliceKey, "", "mr", "create", "alice/lib",
268 "--source", "topic", "--target", "main", "--title", "feature"); code != 0 {
269 t.Fatalf("mr create: %s", errOut)
270 }
271 if _, errOut, code := inst.ssh(t, aliceKey, "", "status", "set", "alice/lib", sha,
272 "--context", "ci/test", "--state", "success"); code != 0 {
273 t.Fatalf("status set: %s", errOut)
274 }
275 if _, errOut, code := inst.ssh(t, aliceKey, "", "mr", "comment", "alice/lib", "1",
276 "--message", "hi"); code != 0 {
277 t.Fatalf("mr comment: %s", errOut)
278 }
279
280 alice := inst.login(t, aliceKey)
281 _, body := browserGet(t, alice, inst.base()+"/alice/lib/mrs")
282 if !strings.Contains(body, `class="chip check-success"`) {
283 t.Errorf("no check chip on the list:\n%s", body)
284 }
285 if !strings.Contains(body, `>1 <span class="vh">comments</span>`) {
286 t.Errorf("no comment count on the list:\n%s", body)
287 }
288}
289
241290// TestMRWebDiffThreads opens a review thread on a diff line and replies to
242291// it from the browser. The CLI's view of the threads afterwards is what
243292// proves the page dispatched mr diff-comment rather than writing its own