diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 21:47:37 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 21:47:37 +1100 |
commit | c5050ecabd57702c7bfb02a38729ed8a4f23b2c5 (patch) | |
tree | 00407f650f067e09589f7175330912435ff21928 /pkg/integration/tests | |
parent | 78b495f50a080822121852dfdf27b481dbbd8879 (diff) |
move shell into test driver
Diffstat (limited to 'pkg/integration/tests')
34 files changed, 34 insertions, 66 deletions
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index cbb37aac7..8294f61a4 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -14,11 +14,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ CreateNCommits(10) }, SetupConfig: func(cfg *config.AppConfig) {}, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { markCommitAsBad := func() { t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 8759e28f3..13e7e8055 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -18,11 +18,7 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ RunCommand("git bisect start other~2 other~5") }, SetupConfig: func(cfg *config.AppConfig) {}, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Information().Content(Contains("bisecting")) t.Model().AtLeastOneCommit() diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index 7a8733d26..c786f8970 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -17,7 +17,7 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ Checkout("master"). EmptyCommit("blah") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 6410576e8..520923cd6 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -16,7 +16,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ NewBranch("branch-one"). NewBranch("branch-two") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index b90810b82..137bada27 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -14,7 +14,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("first change"), Contains("original"), diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 610bb1c19..dc1cfddea 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -17,7 +17,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ shell.EmptyCommit("to remove") shell.EmptyCommit("to keep") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index bfd1b950f..65a10e31b 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -20,7 +20,7 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ shell.Checkout("current-branch") shell.EmptyCommit("current-branch commit") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("current-branch commit"), Contains("root commit"), diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 438bbf9be..65c64fa6d 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -20,7 +20,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ NewBranch("other-new-branch-2"). NewBranch("other-new-branch-3") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Press(keys.Branches.CheckoutBranchByName) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 5fa2d47ac..a9d7dd9c7 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -23,7 +23,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ EmptyCommit("four"). Checkout("first-branch") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index 5de63baa6..5eef30b50 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -14,7 +14,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index 951529cea..5950545e7 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -14,7 +14,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("myfile", "myfile content") shell.CreateFile("myfile2", "myfile2 content") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index 823412f68..11876e09a 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -13,7 +13,7 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shell.CreateFile("myfile", "myfile content") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go index f2deecdc9..6f528ff4c 100644 --- a/pkg/integration/tests/commit/new_branch.go +++ b/pkg/integration/tests/commit/new_branch.go @@ -16,7 +16,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ EmptyCommit("commit 2"). EmptyCommit("commit 3") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(3) t.Views().Commits(). diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go index c2f3b9a52..bee657380 100644 --- a/pkg/integration/tests/commit/revert.go +++ b/pkg/integration/tests/commit/revert.go @@ -15,7 +15,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ shell.GitAddAll() shell.Commit("first commit") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(1) t.Views().Commits(). diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index 559231f53..d0698192a 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -15,7 +15,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go index be0d43904..8a6b0d3d0 100644 --- a/pkg/integration/tests/commit/staged_without_hooks.go +++ b/pkg/integration/tests/commit/staged_without_hooks.go @@ -15,7 +15,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) // stage the file diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index 69eb4e814..3e0d68617 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -17,7 +17,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/config/remote_named_star.go b/pkg/integration/tests/config/remote_named_star.go index 3cba2fd8a..0306427ca 100644 --- a/pkg/integration/tests/config/remote_named_star.go +++ b/pkg/integration/tests/config/remote_named_star.go @@ -15,11 +15,7 @@ var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{ CreateNCommits(2) }, SetupConfig: func(cfg *config.AppConfig) {}, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { // here we're just asserting that we haven't panicked upon starting lazygit t.Model().AtLeastOneCommit() }, diff --git a/pkg/integration/tests/custom_commands/basic.go b/pkg/integration/tests/custom_commands/basic.go index fd20f79e6..a73fab5a9 100644 --- a/pkg/integration/tests/custom_commands/basic.go +++ b/pkg/integration/tests/custom_commands/basic.go @@ -21,11 +21,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ }, } }, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().WorkingTreeFileCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go index 9ede837ce..b35455368 100644 --- a/pkg/integration/tests/custom_commands/form_prompts.go +++ b/pkg/integration/tests/custom_commands/form_prompts.go @@ -55,11 +55,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ }, } }, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().WorkingTreeFileCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/custom_commands/menu_from_command.go b/pkg/integration/tests/custom_commands/menu_from_command.go index 77d6621db..580022521 100644 --- a/pkg/integration/tests/custom_commands/menu_from_command.go +++ b/pkg/integration/tests/custom_commands/menu_from_command.go @@ -42,11 +42,7 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{ }, } }, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().WorkingTreeFileCount(0) t.Views().Branches(). Focus(). diff --git a/pkg/integration/tests/custom_commands/menu_from_commands_output.go b/pkg/integration/tests/custom_commands/menu_from_commands_output.go index c64b35e6e..a9a899341 100644 --- a/pkg/integration/tests/custom_commands/menu_from_commands_output.go +++ b/pkg/integration/tests/custom_commands/menu_from_commands_output.go @@ -41,11 +41,7 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ }, } }, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CurrentBranchName("feature/bar") t.Model().WorkingTreeFileCount(0) diff --git a/pkg/integration/tests/custom_commands/multiple_prompts.go b/pkg/integration/tests/custom_commands/multiple_prompts.go index 9bdcc2e11..fa69169aa 100644 --- a/pkg/integration/tests/custom_commands/multiple_prompts.go +++ b/pkg/integration/tests/custom_commands/multiple_prompts.go @@ -53,11 +53,7 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{ }, } }, - Run: func( - shell *Shell, - t *TestDriver, - keys config.KeybindingConfig, - ) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().WorkingTreeFileCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go index d8f679aa0..7d66cc49d 100644 --- a/pkg/integration/tests/diff/diff.go +++ b/pkg/integration/tests/diff/diff.go @@ -21,7 +21,7 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ shell.Checkout("branch-a") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). TopLines( diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go index 4777a92da..94cd29a6c 100644 --- a/pkg/integration/tests/diff/diff_and_apply_patch.go +++ b/pkg/integration/tests/diff/diff_and_apply_patch.go @@ -21,7 +21,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ shell.Checkout("branch-a") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go index d67dcf3a6..68d4e99fd 100644 --- a/pkg/integration/tests/diff/diff_commits.go +++ b/pkg/integration/tests/diff/diff_commits.go @@ -18,7 +18,7 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n") shell.Commit("third commit") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( diff --git a/pkg/integration/tests/file/dir_with_untracked_file.go b/pkg/integration/tests/file/dir_with_untracked_file.go index 56128aabb..e94d237d9 100644 --- a/pkg/integration/tests/file/dir_with_untracked_file.go +++ b/pkg/integration/tests/file/dir_with_untracked_file.go @@ -21,7 +21,7 @@ var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("dir/untracked", "bar") shell.UpdateFile("dir/file", "baz") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(1) t.Views().Main(). diff --git a/pkg/integration/tests/file/discard_changes.go b/pkg/integration/tests/file/discard_changes.go index 785d8558e..ab08ff9b9 100644 --- a/pkg/integration/tests/file/discard_changes.go +++ b/pkg/integration/tests/file/discard_changes.go @@ -71,7 +71,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ shell.RunShellCommand(`echo "renamed\nhaha" > renamed2.txt && git add renamed2.txt`) }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(3) type statusFile struct { diff --git a/pkg/integration/tests/interactive_rebase/amend_merge.go b/pkg/integration/tests/interactive_rebase/amend_merge.go index 76639ef46..1f09af0de 100644 --- a/pkg/integration/tests/interactive_rebase/amend_merge.go +++ b/pkg/integration/tests/interactive_rebase/amend_merge.go @@ -27,7 +27,7 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ Merge("feature-branch"). CreateFileAndAdd(postMergeFilename, postMergeFileContent) }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(3) mergeCommitMessage := "Merge branch 'feature-branch' into development-branch" diff --git a/pkg/integration/tests/interactive_rebase/one.go b/pkg/integration/tests/interactive_rebase/one.go index 909dd7a82..fdfc2db52 100644 --- a/pkg/integration/tests/interactive_rebase/one.go +++ b/pkg/integration/tests/interactive_rebase/one.go @@ -14,7 +14,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{ shell. CreateNCommits(5) // these will appears at commit 05, 04, 04, down to 01 }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( diff --git a/pkg/integration/tests/misc/confirm_on_quit.go b/pkg/integration/tests/misc/confirm_on_quit.go index 6699d2db3..109ece2c9 100644 --- a/pkg/integration/tests/misc/confirm_on_quit.go +++ b/pkg/integration/tests/misc/confirm_on_quit.go @@ -13,7 +13,7 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ config.UserConfig.ConfirmOnQuit = true }, SetupRepo: func(shell *Shell) {}, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().CommitCount(0) t.Views().Files(). diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go index 5f48c80a2..fded5041c 100644 --- a/pkg/integration/tests/stash/rename.go +++ b/pkg/integration/tests/stash/rename.go @@ -18,7 +18,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ CreateFileAndAdd("file-2", "change to stash2"). StashWithMessage("bar") }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). Focus(). Lines( diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index 16c51537a..4265e0c23 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -15,7 +15,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("file", "content") shell.GitAddAll() }, - Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Model().StashCount(0) t.Model().WorkingTreeFileCount(1) |