diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-03-09 19:48:01 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-04-01 08:16:15 +0200 |
commit | 7513d7756773471147ce2f1aec23af744dd6a8dc (patch) | |
tree | 82a66d936a22b5e61b31e995b944ff6914fe8c01 | |
parent | c757063264d5386a67a22d88f6283dbbf1d09223 (diff) |
Add integration test for amending from the files panel
-rw-r--r-- | pkg/integration/tests/commit/amend.go | 41 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/pkg/integration/tests/commit/amend.go b/pkg/integration/tests/commit/amend.go new file mode 100644 index 000000000..55b690d27 --- /dev/null +++ b/pkg/integration/tests/commit/amend.go @@ -0,0 +1,41 @@ +package commit + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var Amend = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Amends the last commit from the files panel", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("myfile", "myfile content\n") + shell.Commit("first commit") + shell.UpdateFileAndAdd("myfile", "myfile content\nmore content\n") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Lines( + Contains("first commit"), + ) + + t.Views().Files(). + Focus(). + Press(keys.Commits.AmendToCommit) + + t.ExpectPopup().Confirmation().Title( + Equals("Amend Last Commit")). + Content(Contains("Are you sure you want to amend last commit?")). + Confirm() + + t.Views().Commits(). + Focus(). + Lines( + Contains("first commit"), + ) + + t.Views().Main().Content(Contains("+myfile content").Contains("+more content")) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index ec8860057..43affe57a 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -44,6 +44,7 @@ var tests = []*components.IntegrationTest{ branch.Suggestions, cherry_pick.CherryPick, cherry_pick.CherryPickConflicts, + commit.Amend, commit.Commit, commit.CommitMultiline, commit.CreateTag, |