1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reword = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Contains("myfile"),
Contains("myfile2"),
).
SelectNextItem().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Commits().
Lines(
Contains(commitMessage),
)
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
wipCommitMessage := "my commit message wip"
t.ExpectPopup().CommitMessagePanel().Type(wipCommitMessage).Close()
t.Views().Commits().Focus().
Lines(
Contains(commitMessage),
).Press(keys.Commits.RenameCommit)
t.ExpectPopup().CommitMessagePanel().
SwitchToDescription().
Type("some description").
SwitchToSummary().
Confirm()
t.Views().Main().Content(MatchesRegexp("my commit message\n\\s*some description"))
t.Views().Files().
Focus().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().Confirm()
t.Views().Commits().
Lines(
Contains(wipCommitMessage),
Contains(commitMessage),
)
},
})
|