diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-01-20 17:55:25 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-03-11 09:19:11 +0100 |
commit | 1ec87364fea40a90440dd5df28e405899c41f49b (patch) | |
tree | 850b6e18a1b59016bba7dc2fa1777157be5d668d /pkg/integration | |
parent | 7c687938a5882654bddb64e61b2c8d41b99f9b8c (diff) |
Add integration test
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/components/commit_description_panel_driver.go | 11 | ||||
-rw-r--r-- | pkg/integration/tests/commit/add_co_author_while_committing.go | 51 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
3 files changed, 63 insertions, 0 deletions
diff --git a/pkg/integration/components/commit_description_panel_driver.go b/pkg/integration/components/commit_description_panel_driver.go index eddc53533..253dc6f87 100644 --- a/pkg/integration/components/commit_description_panel_driver.go +++ b/pkg/integration/components/commit_description_panel_driver.go @@ -41,6 +41,17 @@ func (self *CommitDescriptionPanelDriver) GoToBeginning() *CommitDescriptionPane return self } +func (self *CommitDescriptionPanelDriver) AddCoAuthor(author string) *CommitDescriptionPanelDriver { + self.t.press(self.t.keys.CommitMessage.CommitMenu) + self.t.ExpectPopup().Menu().Title(Equals("Commit Menu")). + Select(Contains("Add co-author")). + Confirm() + self.t.ExpectPopup().Prompt().Title(Contains("Add co-author")). + Type(author). + Confirm() + return self +} + func (self *CommitDescriptionPanelDriver) Title(expected *TextMatcher) *CommitDescriptionPanelDriver { self.getViewDriver().Title(expected) diff --git a/pkg/integration/tests/commit/add_co_author_while_committing.go b/pkg/integration/tests/commit/add_co_author_while_committing.go new file mode 100644 index 000000000..d817f00f0 --- /dev/null +++ b/pkg/integration/tests/commit/add_co_author_while_committing.go @@ -0,0 +1,51 @@ +package commit + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var AddCoAuthorWhileCommitting = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Add co-author while typing the commit message", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) { + }, + SetupRepo: func(shell *Shell) { + shell.CreateFile("file", "file content") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + PressPrimaryAction(). // stage file + Press(keys.Files.CommitChanges) + + t.ExpectPopup().CommitMessagePanel(). + Type("Subject"). + SwitchToDescription(). + Type("Here's my message."). + AddCoAuthor("John Doe <john@doe.com>"). + Content(Equals("Here's my message.\n\nCo-authored-by: John Doe <john@doe.com>")). + AddCoAuthor("Jane Smith <jane@smith.com>"). + // Second co-author doesn't add a blank line: + Content(Equals("Here's my message.\n\nCo-authored-by: John Doe <john@doe.com>\nCo-authored-by: Jane Smith <jane@smith.com>")). + SwitchToSummary(). + Confirm() + + t.Views().Commits(). + Lines( + Contains("Subject"), + ). + Focus(). + Tap(func() { + t.Views().Main().ContainsLines( + Equals(" Subject"), + Equals(" "), + Equals(" Here's my message."), + Equals(" "), + Equals(" Co-authored-by: John Doe <john@doe.com>"), + Equals(" Co-authored-by: Jane Smith <jane@smith.com>"), + ) + }) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 8c2891d47..e5a540e8b 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -64,6 +64,7 @@ var tests = []*components.IntegrationTest{ cherry_pick.CherryPickDuringRebase, cherry_pick.CherryPickRange, commit.AddCoAuthor, + commit.AddCoAuthorWhileCommitting, commit.Amend, commit.AutoWrapMessage, commit.Commit, |