diff options
author | AzraelSec <federicogerardi94@gmail.com> | 2023-04-02 20:45:21 +0200 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-04-15 17:26:08 +1000 |
commit | b82b6a2992b56f8cacc9e9ec9a886e6af51ce99e (patch) | |
tree | d0c661dd8aefa209411f6e496034bc0e186d9ebe /pkg/integration | |
parent | ddcd6be2458763c252c10e3c45342b274a6bf668 (diff) |
test: add integration test to verify the interactive rebase correctly work
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go | 66 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 67 insertions, 0 deletions
diff --git a/pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go b/pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go new file mode 100644 index 000000000..e4788973c --- /dev/null +++ b/pkg/integration/tests/interactive_rebase/advanced_interactive_rebase.go @@ -0,0 +1,66 @@ +package interactive_rebase + +import ( + "fmt" + + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +const ( + BASE_BRANCH = "base-branch" + TOP_BRANCH = "top-branch" + BASE_COMMIT = "base-commit" + TOP_COMMIT = "top-commit" +) + +var AdvancedInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "It begins an interactive rebase and verifies to have the possibility of editing the commits of the branch before proceeding with the actual rebase", + ExtraCmdArgs: "", + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell. + NewBranch(BASE_BRANCH). + EmptyCommit(BASE_COMMIT). + NewBranch(TOP_BRANCH). + EmptyCommit(TOP_COMMIT) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains(TOP_COMMIT), + Contains(BASE_COMMIT), + ) + + t.Views().Branches(). + Focus(). + NavigateToLine(Contains(BASE_BRANCH)). + Press(keys.Branches.RebaseBranch) + + t.ExpectPopup().Menu(). + Title(Equals(fmt.Sprintf("Rebase '%s' onto '%s'", TOP_BRANCH, BASE_BRANCH))). + Select(Contains("Interactive rebase")). + Confirm() + + t.Views().Commits(). + Focus(). + Lines( + Contains(TOP_COMMIT), + Contains(BASE_COMMIT).Contains("YOU ARE HERE"), + ). + NavigateToLine(Contains(TOP_COMMIT)). + Press(keys.Universal.Edit). + Lines( + Contains(TOP_COMMIT).Contains("edit"), + Contains(BASE_COMMIT).Contains("YOU ARE HERE"), + ). + Tap(func() { + t.Common().ContinueRebase() + }). + Lines( + Contains(TOP_COMMIT).Contains("YOU ARE HERE"), + Contains(BASE_COMMIT), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index a8959ee24..d4da79732 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -83,6 +83,7 @@ var tests = []*components.IntegrationTest{ filter_by_path.CliArg, filter_by_path.SelectFile, filter_by_path.TypeFile, + interactive_rebase.AdvancedInteractiveRebase, interactive_rebase.AmendFirstCommit, interactive_rebase.AmendHeadCommitDuringRebase, interactive_rebase.AmendMerge, |