| @@ -238,6 +238,55 @@ func TestMRWebCreate(t *testing.T) { |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | // TestMRListRows checks that the merge request list shows each row's |
| 242 | // combined check state and comment count (#230). |
| 243 | func 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 | |
| 241 | 290 | // TestMRWebDiffThreads opens a review thread on a diff line and replies to |
| 242 | 291 | // it from the browser. The CLI's view of the threads afterwards is what |
| 243 | 292 | // proves the page dispatched mr diff-comment rather than writing its own |