summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests
diff options
context:
space:
mode:
authorArnaud PERALTA <arnaud.peralta@gmail.com>2022-11-27 17:33:37 +0100
committerJesse Duffield <jessedduffield@gmail.com>2022-12-01 09:12:18 +1100
commit87e0f6b92d2d34e5707da633e428a92a93bbac15 (patch)
tree6f4f8a48bb37e08329b482c31cb3218462f2199c /pkg/integration/tests
parentd0499286e23780eecf07b51e4baab578de8693bf (diff)
integration tests for commit in staged files and unstaged files menus
Diffstat (limited to 'pkg/integration/tests')
-rw-r--r--pkg/integration/tests/commit/staged.go33
-rw-r--r--pkg/integration/tests/commit/unstaged.go32
-rw-r--r--pkg/integration/tests/tests.go2
3 files changed, 67 insertions, 0 deletions
diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go
new file mode 100644
index 000000000..80de2bca9
--- /dev/null
+++ b/pkg/integration/tests/commit/staged.go
@@ -0,0 +1,33 @@
+package commit
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var Staged = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Staging a couple files, going in the staged files menu and committing",
+ ExtraCmdArgs: "",
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.CreateFile("myfile", "myfile content")
+ shell.CreateFile("myfile2", "myfile2 content")
+ },
+ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
+ assert.CommitCount(0)
+
+ input.PrimaryAction()
+ input.NextItem()
+ input.PrimaryAction()
+ input.Confirm()
+ input.PressKeys(keys.Files.CommitChanges)
+
+ commitMessage := "my commit message"
+ input.Type(commitMessage)
+ input.Confirm()
+
+ assert.CommitCount(1)
+ assert.MatchHeadCommitMessage(Equals(commitMessage))
+ },
+})
diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go
new file mode 100644
index 000000000..5dd396eec
--- /dev/null
+++ b/pkg/integration/tests/commit/unstaged.go
@@ -0,0 +1,32 @@
+package commit
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Staging a couple files, going in the unstaged files menu and committing",
+ ExtraCmdArgs: "",
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.CreateFile("myfile", "myfile content")
+ shell.CreateFile("myfile2", "myfile2 content")
+ },
+ Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
+ assert.CommitCount(0)
+
+ input.PrimaryAction()
+ input.NextItem()
+ input.Confirm()
+ input.PressKeys(keys.Files.CommitChanges)
+
+ commitMessage := "my commit message"
+ input.Type(commitMessage)
+ input.Confirm()
+
+ assert.CommitCount(1)
+ assert.MatchHeadCommitMessage(Equals(commitMessage))
+ },
+})
diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go
index 6c074bb10..9b654ad80 100644
--- a/pkg/integration/tests/tests.go
+++ b/pkg/integration/tests/tests.go
@@ -36,6 +36,8 @@ var tests = []*components.IntegrationTest{
cherry_pick.CherryPickConflicts,
commit.Commit,
commit.NewBranch,
+ commit.Staged,
+ commit.Unstaged,
custom_commands.Basic,
custom_commands.FormPrompts,
custom_commands.MenuFromCommand,