Skip to content

Commit 161bb68

Browse files
committed
Make integration test more robust
If you ran this test enough times it would eventually fail; this happened whenever the resulting squashed commit had a sha that happened to start with "02". We test that "commit 02" does not appear in the diff window, but in that case it did, at the very top of the window. A better fix might be to change the commit message that we use in CreateNCommits to something other than "commit XY", but that would require touching tons of tests, so this is the easier fix.
1 parent f2aa7e7 commit 161bb68

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

pkg/integration/tests/interactive_rebase/fixup_second_commit.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
1212
SetupConfig: func(config *config.AppConfig) {},
1313
SetupRepo: func(shell *Shell) {
1414
shell.
15-
CreateNCommits(3)
15+
CreateFileAndAdd("file1.txt", "File1 Content\n").Commit("First Commit").
16+
CreateFileAndAdd("file2.txt", "Fixup Content\n").Commit("Fixup Commit Message").
17+
CreateFileAndAdd("file3.txt", "File3 Content\n").Commit("Third Commit")
1618
},
1719
Run: func(t *TestDriver, keys config.KeybindingConfig) {
1820
t.Views().Commits().
1921
Focus().
2022
Lines(
21-
Contains("commit 03"),
22-
Contains("commit 02"),
23-
Contains("commit 01"),
23+
Contains("Third Commit"),
24+
Contains("Fixup Commit Message"),
25+
Contains("First Commit"),
2426
).
25-
NavigateToLine(Contains("commit 02")).
27+
NavigateToLine(Contains("Fixup Commit Message")).
2628
Press(keys.Commits.MarkCommitAsFixup).
2729
Tap(func() {
2830
t.ExpectPopup().Confirmation().
@@ -31,14 +33,17 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
3133
Confirm()
3234
}).
3335
Lines(
34-
Contains("commit 03"),
35-
Contains("commit 01").IsSelected(),
36+
Contains("Third Commit"),
37+
Contains("First Commit").IsSelected(),
3638
)
3739

3840
t.Views().Main().
39-
Content(Contains("commit 01")).
40-
Content(DoesNotContain("commit 02")).
41-
Content(Contains("+file01 content")).
42-
Content(Contains("+file02 content"))
41+
// Make sure that the resulting commit message doesn't contain the
42+
// message of the fixup commit; compare this to
43+
// squash_down_second_commit.go, where it does.
44+
Content(Contains("First Commit")).
45+
Content(DoesNotContain("Fixup Commit Message")).
46+
Content(Contains("+File1 Content")).
47+
Content(Contains("+Fixup Content"))
4348
},
4449
})

0 commit comments

Comments
 (0)