diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 21:35:36 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 21:35:36 +1100 |
commit | 78b495f50a080822121852dfdf27b481dbbd8879 (patch) | |
tree | 63c519494d4b1a3e3bbe266b8b87a869ba84edc9 /pkg/integration/tests | |
parent | 53e06b71aecd2ddaf80516627ba223ac2adc5420 (diff) |
rename input to t
Diffstat (limited to 'pkg/integration/tests')
34 files changed, 268 insertions, 268 deletions
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index ac4953095..cbb37aac7 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -16,33 +16,33 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(cfg *config.AppConfig) {}, Run: func( shell *Shell, - input *Input, + t *TestDriver, keys config.KeybindingConfig, ) { markCommitAsBad := func() { - input.Views().Commits(). + t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) - input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm() + t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm() } markCommitAsGood := func() { - input.Views().Commits(). + t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) - input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() + t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() } - input.Model().AtLeastOneCommit() + t.Model().AtLeastOneCommit() - input.Views().Commits(). + t.Views().Commits(). Focus(). SelectedLine(Contains("commit 10")). NavigateToListItem(Contains("commit 09")). Tap(func() { markCommitAsBad() - input.Views().Information().Content(Contains("bisecting")) + t.Views().Information().Content(Contains("bisecting")) }). SelectedLine(Contains("<-- bad")). NavigateToListItem(Contains("commit 02")). @@ -55,11 +55,11 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ markCommitAsGood() // commit 5 is the culprit because we marked 4 as good and 5 as bad. - input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() + t.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() }). IsFocused(). Content(Contains("commit 04")) - input.Views().Information().Content(DoesNotContain("bisecting")) + t.Views().Information().Content(DoesNotContain("bisecting")) }, }) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 20f0fb646..8759e28f3 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -20,14 +20,14 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(cfg *config.AppConfig) {}, Run: func( shell *Shell, - input *Input, + t *TestDriver, keys config.KeybindingConfig, ) { - input.Views().Information().Content(Contains("bisecting")) + t.Views().Information().Content(Contains("bisecting")) - input.Model().AtLeastOneCommit() + t.Model().AtLeastOneCommit() - input.Views().Commits(). + t.Views().Commits(). Focus(). TopLines( MatchesRegexp(`<-- bad.*commit 08`), @@ -38,11 +38,11 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Commits.ViewBisectOptions). Tap(func() { - input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() + t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() - input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm() + t.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm() - input.Views().Information().Content(DoesNotContain("bisecting")) + t.Views().Information().Content(DoesNotContain("bisecting")) }). // back in master branch which just had the one commit Lines( diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index 2d5e6e098..7a8733d26 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -17,8 +17,8 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ Checkout("master"). EmptyCommit("blah") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Lines( Contains("master").IsSelected(), @@ -27,9 +27,9 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.CheckoutBranchByName). Tap(func() { - input.ExpectPrompt().Title(Equals("Branch name:")).Type("new-branch").Confirm() + t.ExpectPrompt().Title(Equals("Branch name:")).Type("new-branch").Confirm() - input.ExpectAlert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm() + t.ExpectAlert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm() }). Lines( MatchesRegexp(`\*.*new-branch`).IsSelected(), diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index f0921a82e..6410576e8 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -16,8 +16,8 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ NewBranch("branch-one"). NewBranch("branch-two") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Lines( MatchesRegexp(`\*.*branch-two`).IsSelected(), @@ -26,12 +26,12 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Universal.Remove). Tap(func() { - input.ExpectAlert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm() + t.ExpectAlert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm() }). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Delete Branch")). Content(Contains("Are you sure you want to delete the branch 'branch-one'?")). Confirm() diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index 541493458..b90810b82 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -14,13 +14,13 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Commits().TopLines( + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits().TopLines( Contains("first change"), Contains("original"), ) - input.Views().Branches(). + t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), @@ -30,35 +30,35 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.RebaseBranch) - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Rebasing")). Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")). Confirm() - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() - input.Views().Files(). + t.Views().Files(). IsFocused(). SelectedLine(Contains("file")). PressEnter() - input.Views().MergeConflicts(). + t.Views().MergeConflicts(). IsFocused(). PressPrimaryAction() - input.Views().Information().Content(Contains("rebasing")) + t.Views().Information().Content(Contains("rebasing")) - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() - input.Views().Information().Content(DoesNotContain("rebasing")) + t.Views().Information().Content(DoesNotContain("rebasing")) - input.Views().Commits().TopLines( + t.Views().Commits().TopLines( Contains("second-change-branch unrelated change"), Contains("second change"), Contains("original"), diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 53a718618..610bb1c19 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -17,8 +17,8 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ shell.EmptyCommit("to remove") shell.EmptyCommit("to keep") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), @@ -26,7 +26,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ Contains("original-branch"), ) - input.Views().Commits(). + t.Views().Commits(). TopLines( Contains("to keep").IsSelected(), Contains("to remove"), @@ -36,22 +36,22 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.RebaseBranch) - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Rebasing")). Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")). Confirm() - input.Views().Information().Content(Contains("rebasing")) + t.Views().Information().Content(Contains("rebasing")) - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() - input.Views().Files().IsFocused(). + t.Views().Files().IsFocused(). SelectedLine(MatchesRegexp("UU.*file")) - input.Views().Commits(). + t.Views().Commits(). Focus(). TopLines( MatchesRegexp(`pick.*to keep`).IsSelected(), @@ -70,22 +70,22 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ MatchesRegexp("original"), ) - input.Views().Files(). + t.Views().Files(). Focus(). PressEnter() - input.Views().MergeConflicts(). + t.Views().MergeConflicts(). IsFocused(). PressPrimaryAction() - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() - input.Views().Information().Content(DoesNotContain("rebasing")) + t.Views().Information().Content(DoesNotContain("rebasing")) - input.Views().Commits().TopLines( + t.Views().Commits().TopLines( Contains("to keep"), Contains("second-change-branch unrelated change").IsSelected(), Contains("second change"), diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index f96a48b56..bfd1b950f 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -20,13 +20,13 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ shell.Checkout("current-branch") shell.EmptyCommit("current-branch commit") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Commits().Lines( + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits().Lines( Contains("current-branch commit"), Contains("root commit"), ) - input.Views().Branches(). + t.Views().Branches(). Focus(). Lines( Contains("current-branch"), @@ -35,10 +35,10 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Commits.ViewResetOptions) - input.ExpectMenu().Title(Contains("reset to other-branch")).Select(Contains("hard reset")).Confirm() + t.ExpectMenu().Title(Contains("reset to other-branch")).Select(Contains("hard reset")).Confirm() // assert that we now have the expected commits in the commit panel - input.Views().Commits(). + t.Views().Commits(). Lines( Contains("other-branch commit"), Contains("root commit"), diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 9999947d9..438bbf9be 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -20,20 +20,20 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ NewBranch("other-new-branch-2"). NewBranch("other-new-branch-3") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Press(keys.Branches.CheckoutBranchByName) // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in - input.ExpectPrompt(). + t.ExpectPrompt(). Title(Equals("Branch name:")). Type("branch-to"). SuggestionTopLines(Contains("branch-to-checkout")). SelectFirstSuggestion(). Confirm() - input.Model().CurrentBranchName("branch-to-checkout") + t.Model().CurrentBranchName("branch-to-checkout") }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index de9e0a645..5fa2d47ac 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -23,8 +23,8 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ EmptyCommit("four"). Checkout("first-branch") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Lines( Contains("first-branch"), @@ -34,7 +34,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressEnter() - input.Views().SubCommits(). + t.Views().SubCommits(). IsFocused(). Lines( Contains("four").IsSelected(), @@ -44,14 +44,14 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ // copy commits 'four' and 'three' Press(keys.Commits.CherryPickCopy). Tap(func() { - input.Views().Information().Content(Contains("1 commit copied")) + t.Views().Information().Content(Contains("1 commit copied")) }). SelectNextItem(). Press(keys.Commits.CherryPickCopy) - input.Views().Information().Content(Contains("2 commits copied")) + t.Views().Information().Content(Contains("2 commits copied")) - input.Views().Commits(). + t.Views().Commits(). Focus(). Lines( Contains("two").IsSelected(), @@ -60,7 +60,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.PasteCommits). Tap(func() { - input.ExpectAlert(). + t.ExpectAlert(). Title(Equals("Cherry-Pick")). Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")). Confirm() @@ -74,11 +74,11 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ ). Tap(func() { // we need to manually exit out of cherry pick mode - input.Views().Information().Content(Contains("2 commits copied")) + t.Views().Information().Content(Contains("2 commits copied")) }). PressEscape(). Tap(func() { - input.Views().Information().Content(DoesNotContain("commits copied")) + t.Views().Information().Content(DoesNotContain("commits copied")) }) }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index 9c02cc8d0..5de63baa6 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -14,8 +14,8 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Views().Branches(). + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), @@ -25,7 +25,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressEnter() - input.Views().SubCommits(). + t.Views().SubCommits(). IsFocused(). TopLines( Contains("second-change-branch unrelated change"), @@ -33,46 +33,46 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.CherryPickCopy). Tap(func() { - input.Views().Information().Content(Contains("1 commit copied")) + t.Views().Information().Content(Contains("1 commit copied")) }). SelectNextItem(). Press(keys.Commits.CherryPickCopy) - input.Views().Information().Content(Contains("2 commits copied")) + t.Views().Information().Content(Contains("2 commits copied")) - input.Views().Commits(). + t.Views().Commits(). Focus(). TopLines( Contains("first change"), ). Press(keys.Commits.PasteCommits) - input.ExpectAlert().Title(Equals("Cherry-Pick")).Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).Confirm() + t.ExpectAlert().Title(Equals("Cherry-Pick")).Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).Confirm() - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() - input.Views().Files(). + t.Views().Files(). IsFocused(). SelectedLine(Contains("file")). PressEnter() - input.Views().MergeConflicts(). + t.Views().MergeConflicts(). IsFocused(). // picking 'Second change' SelectNextItem(). PressPrimaryAction() - input.ExpectConfirmation(). + t.ExpectConfirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() - input.Model().WorkingTreeFileCount(0) + t.Model().WorkingTreeFileCount(0) - input.Views().Commits(). + t.Views().Commits(). Focus(). TopLines( Contains("second-change-branch unrelated change"), @@ -84,15 +84,15 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ // because we picked 'Second change' when resolving the conflict, // we now see this commit as having replaced First Change with Second Change, // as opposed to replacing 'Original' with 'Second change' - input.Views().Main(). + t.Views().Main(). Content(Contains("-First Change")). Content(Contains("+Second Change")) - input.Views().Information().Content(Contains("2 commits copied")) + t.Views().Information().Content(Contains("2 commits copied")) }). PressEscape(). Tap(func() { - input.Views().Information().Content(DoesNotContain("commits copied")) + t.Views().Information().Content(DoesNotContain("commits copied")) }) }, }) diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index c9bc91fdd..951529cea 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -14,10 +14,10 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("myfile", "myfile content") shell.CreateFile("myfile2", "myfile2 content") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Model().CommitCount(0) + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Model().CommitCount(0) - input.Views().Files(). + t.Views().Files(). IsFocused(). PressPrimaryAction(). // stage file SelectNextItem(). @@ -26,9 +26,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ commitMessage := "my commit message" - input.ExpectCommitMessagePanel().Type(commitMessage).Confirm() + t.ExpectCommitMessagePanel().Type(commitMessage).Confirm() - input.Model(). + t.Model(). CommitCount(1). HeadCommitMessage(Equals(commitMessage)) }, diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index 4f80adbe1..823412f68 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -13,20 +13,20 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) { shell.CreateFile("myfile", "myfile content") }, - Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { - input.Model().CommitCount(0) + Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) { + t.Model().CommitCount(0) - input.Views().Files(). + t.Views().Files(). IsFocused(). PressPrimaryAction(). Press(keys.Files.CommitChanges) - input.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm() + t.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm() - input.Model().CommitCount(1) - input.Model().HeadCommitMessage(Equals("first line")) + t.Model().CommitCount(1) + t.Model().HeadCommitMessage(Equals("first line")) - input.Views().Commits().Focus() - input.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line")) + t.Views().Commits().Focus() + t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line")) }, }) |