diff options
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/components/common.go | 6 | ||||
-rw-r--r-- | pkg/integration/tests/branch/rebase_abort_on_conflict.go | 49 | ||||
-rw-r--r-- | pkg/integration/tests/branch/rebase_cancel_on_conflict.go | 51 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 2 |
4 files changed, 105 insertions, 3 deletions
diff --git a/pkg/integration/components/common.go b/pkg/integration/components/common.go index 0f2e3b871..fe81438ee 100644 --- a/pkg/integration/components/common.go +++ b/pkg/integration/components/common.go @@ -19,9 +19,9 @@ func (self *Common) ContinueRebase() { } func (self *Common) AcknowledgeConflicts() { - self.t.ExpectPopup().Confirmation(). - Title(Equals("Auto-merge failed")). - Content(Contains("Conflicts!")). + self.t.ExpectPopup().Menu(). + Title(Equals("Conflicts!")). + Select(Contains("View conflicts")). Confirm() } diff --git a/pkg/integration/tests/branch/rebase_abort_on_conflict.go b/pkg/integration/tests/branch/rebase_abort_on_conflict.go new file mode 100644 index 000000000..4eba77627 --- /dev/null +++ b/pkg/integration/tests/branch/rebase_abort_on_conflict.go @@ -0,0 +1,49 @@ +package branch + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" + "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" +) + +var RebaseAbortOnConflict = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Rebase onto another branch, abort when there are conflicts.", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shared.MergeConflictsSetup(shell) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits().TopLines( + Contains("first change"), + Contains("original"), + ) + + t.Views().Branches(). + Focus(). + Lines( + Contains("first-change-branch"), + Contains("second-change-branch"), + Contains("original-branch"), + ). + SelectNextItem(). + Press(keys.Branches.RebaseBranch) + + t.ExpectPopup().Menu(). + Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")). + Select(Contains("Simple rebase")). + Confirm() + + t.ExpectPopup().Menu(). + Title(Equals("Conflicts!")). + Select(Contains("Abort the rebase")). + Confirm() + + t.Views().Branches(). + IsFocused() + + t.Views().Files(). + IsEmpty() + }, +}) diff --git a/pkg/integration/tests/branch/rebase_cancel_on_conflict.go b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go new file mode 100644 index 000000000..23b7661b2 --- /dev/null +++ b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go @@ -0,0 +1,51 @@ +package branch + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" + "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" +) + +var RebaseCancelOnConflict = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Rebase onto another branch, cancel when there are conflicts.", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shared.MergeConflictsSetup(shell) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits().TopLines( + Contains("first change"), + Contains("original"), + ) + + t.Views().Branches(). + Focus(). + Lines( + Contains("first-change-branch"), + Contains("second-change-branch"), + Contains("original-branch"), + ). + SelectNextItem(). + Press(keys.Branches.RebaseBranch) + + t.ExpectPopup().Menu(). + Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")). + Select(Contains("Simple rebase")). + Confirm() + + t.ExpectPopup().Menu(). + Title(Equals("Conflicts!")). + Select(Contains("Abort the rebase")). + Cancel() + + t.Views().Branches(). + IsFocused() + + t.Views().Files(). + Lines( + Contains("UU file"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 50377f101..2a16df041 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -36,7 +36,9 @@ var tests = []*components.IntegrationTest{ branch.DetachedHead, branch.OpenWithCliArg, branch.Rebase, + branch.RebaseAbortOnConflict, branch.RebaseAndDrop, + branch.RebaseCancelOnConflict, branch.RebaseDoesNotAutosquash, branch.Reset, branch.ResetUpstream, |