mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Add integration test
This commit is contained in:
@ -31,6 +31,16 @@ func (self *CommitDescriptionPanelDriver) AddNewline() *CommitDescriptionPanelDr
|
|||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *CommitDescriptionPanelDriver) GoToBeginning() *CommitDescriptionPanelDriver {
|
||||||
|
numLines := len(self.getViewDriver().getView().BufferLines())
|
||||||
|
for i := 0; i < numLines; i++ {
|
||||||
|
self.t.pressFast("<up>")
|
||||||
|
}
|
||||||
|
|
||||||
|
self.t.pressFast("<c-a>")
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
func (self *CommitDescriptionPanelDriver) Title(expected *TextMatcher) *CommitDescriptionPanelDriver {
|
func (self *CommitDescriptionPanelDriver) Title(expected *TextMatcher) *CommitDescriptionPanelDriver {
|
||||||
self.getViewDriver().Title(expected)
|
self.getViewDriver().Title(expected)
|
||||||
|
|
||||||
|
59
pkg/integration/tests/commit/auto_wrap_message.go
Normal file
59
pkg/integration/tests/commit/auto_wrap_message.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package commit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var AutoWrapMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Commit, and test how the commit message body is auto-wrapped",
|
||||||
|
ExtraCmdArgs: []string{},
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
// Use a ridiculously small width so that we don't have to use so much test data
|
||||||
|
config.UserConfig.Git.Commit.AutoWrapWidth = 20
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateFile("file", "file content")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Commits().
|
||||||
|
IsEmpty()
|
||||||
|
|
||||||
|
t.Views().Files().
|
||||||
|
IsFocused().
|
||||||
|
PressPrimaryAction(). // stage file
|
||||||
|
Press(keys.Files.CommitChanges)
|
||||||
|
|
||||||
|
t.ExpectPopup().CommitMessagePanel().
|
||||||
|
Type("subject").
|
||||||
|
SwitchToDescription().
|
||||||
|
Type("Lorem ipsum dolor sit amet, consectetur adipiscing elit.").
|
||||||
|
// See how it automatically inserted line feeds to wrap the text:
|
||||||
|
Content(Equals("Lorem ipsum dolor \nsit amet, \nconsectetur \nadipiscing elit.")).
|
||||||
|
SwitchToSummary().
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.Views().Commits().
|
||||||
|
Lines(
|
||||||
|
Contains("subject"),
|
||||||
|
).
|
||||||
|
Focus().
|
||||||
|
Tap(func() {
|
||||||
|
t.Views().Main().Content(Contains(
|
||||||
|
"subject\n \n Lorem ipsum dolor\n sit amet,\n consectetur\n adipiscing elit."))
|
||||||
|
}).
|
||||||
|
Press(keys.Commits.RenameCommit)
|
||||||
|
|
||||||
|
// Test that when rewording, the hard line breaks are turned back into
|
||||||
|
// soft ones, so that we can insert text at the beginning and have the
|
||||||
|
// paragraph reflow nicely.
|
||||||
|
t.ExpectPopup().CommitMessagePanel().
|
||||||
|
InitialText(Equals("subject")).
|
||||||
|
SwitchToDescription().
|
||||||
|
Content(Equals("Lorem ipsum dolor \nsit amet, \nconsectetur \nadipiscing elit.")).
|
||||||
|
GoToBeginning().
|
||||||
|
Type("More text. ").
|
||||||
|
Content(Equals("More text. Lorem \nipsum dolor sit \namet, consectetur \nadipiscing elit."))
|
||||||
|
},
|
||||||
|
})
|
@ -65,6 +65,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
cherry_pick.CherryPickRange,
|
cherry_pick.CherryPickRange,
|
||||||
commit.AddCoAuthor,
|
commit.AddCoAuthor,
|
||||||
commit.Amend,
|
commit.Amend,
|
||||||
|
commit.AutoWrapMessage,
|
||||||
commit.Commit,
|
commit.Commit,
|
||||||
commit.CommitMultiline,
|
commit.CommitMultiline,
|
||||||
commit.CommitSwitchToEditor,
|
commit.CommitSwitchToEditor,
|
||||||
|
Reference in New Issue
Block a user