diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-02-25 17:44:43 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-02-27 08:53:06 +0100 |
commit | 161bb684fa671f957abb1494085b11840d5b6864 (patch) | |
tree | e7b1123e5a6127cbcbf23cf59bcd8dce8a2ec57c /pkg/integration/tests | |
parent | f2aa7e7e284c0634d30fd0c80e5421fb1e0dd13c (diff) |
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.
Diffstat (limited to 'pkg/integration/tests')
-rw-r--r-- | pkg/integration/tests/interactive_rebase/fixup_second_commit.go | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/pkg/integration/tests/interactive_rebase/fixup_second_commit.go b/pkg/integration/tests/interactive_rebase/fixup_second_commit.go index 8dc97b096..d4a77bdb6 100644 --- a/pkg/integration/tests/interactive_rebase/fixup_second_commit.go +++ b/pkg/integration/tests/interactive_rebase/fixup_second_commit.go @@ -12,17 +12,19 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. - CreateNCommits(3) + CreateFileAndAdd("file1.txt", "File1 Content\n").Commit("First Commit"). + CreateFileAndAdd("file2.txt", "Fixup Content\n").Commit("Fixup Commit Message"). + CreateFileAndAdd("file3.txt", "File3 Content\n").Commit("Third Commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( - Contains("commit 03"), - Contains("commit 02"), - Contains("commit 01"), + Contains("Third Commit"), + Contains("Fixup Commit Message"), + Contains("First Commit"), ). - NavigateToLine(Contains("commit 02")). + NavigateToLine(Contains("Fixup Commit Message")). Press(keys.Commits.MarkCommitAsFixup). Tap(func() { t.ExpectPopup().Confirmation(). @@ -31,14 +33,17 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Lines( - Contains("commit 03"), - Contains("commit 01").IsSelected(), + Contains("Third Commit"), + Contains("First Commit").IsSelected(), ) t.Views().Main(). - Content(Contains("commit 01")). - Content(DoesNotContain("commit 02")). - Content(Contains("+file01 content")). - Content(Contains("+file02 content")) + // Make sure that the resulting commit message doesn't contain the + // message of the fixup commit; compare this to + // squash_down_second_commit.go, where it does. + Content(Contains("First Commit")). + Content(DoesNotContain("Fixup Commit Message")). + Content(Contains("+File1 Content")). + Content(Contains("+Fixup Content")) }, }) |