From 9fef4447b67c499fe34d40bc5dadc5941ac39b7c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 28 Dec 2022 11:00:22 +1100 Subject: [PATCH] move popup assertions into a struct --- pkg/integration/components/actions.go | 2 +- pkg/integration/components/popup.go | 70 +++++++++++++++++++ pkg/integration/components/test_driver.go | 70 ++----------------- pkg/integration/tests/bisect/basic.go | 6 +- .../tests/bisect/from_other_branch.go | 4 +- .../tests/branch/checkout_by_name.go | 4 +- pkg/integration/tests/branch/delete.go | 4 +- pkg/integration/tests/branch/rebase.go | 6 +- .../tests/branch/rebase_and_drop.go | 6 +- pkg/integration/tests/branch/reset.go | 2 +- pkg/integration/tests/branch/suggestions.go | 2 +- .../tests/cherry_pick/cherry_pick.go | 2 +- .../cherry_pick/cherry_pick_conflicts.go | 6 +- pkg/integration/tests/commit/commit.go | 2 +- .../tests/commit/commit_multiline.go | 2 +- pkg/integration/tests/commit/new_branch.go | 2 +- pkg/integration/tests/commit/revert.go | 2 +- pkg/integration/tests/commit/staged.go | 2 +- .../tests/commit/staged_without_hooks.go | 2 +- pkg/integration/tests/commit/unstaged.go | 2 +- .../tests/custom_commands/form_prompts.go | 6 +- .../custom_commands/menu_from_command.go | 4 +- .../menu_from_commands_output.go | 4 +- .../tests/custom_commands/multiple_prompts.go | 6 +- pkg/integration/tests/diff/diff.go | 4 +- .../tests/diff/diff_and_apply_patch.go | 6 +- pkg/integration/tests/diff/diff_commits.go | 4 +- pkg/integration/tests/file/discard_changes.go | 4 +- .../tests/interactive_rebase/amend_merge.go | 2 +- pkg/integration/tests/misc/confirm_on_quit.go | 2 +- pkg/integration/tests/stash/rename.go | 2 +- pkg/integration/tests/stash/stash.go | 4 +- .../stash/stash_including_untracked_files.go | 4 +- 33 files changed, 130 insertions(+), 120 deletions(-) create mode 100644 pkg/integration/components/popup.go diff --git a/pkg/integration/components/actions.go b/pkg/integration/components/actions.go index 8489a52f8..fb4114890 100644 --- a/pkg/integration/components/actions.go +++ b/pkg/integration/components/actions.go @@ -8,7 +8,7 @@ type Actions struct { func (self *Actions) ContinueMerge() { self.t.Views().current().Press(self.t.keys.Universal.CreateRebaseOptionsMenu) - self.t.ExpectMenu(). + self.t.ExpectPopup().Menu(). Title(Equals("Rebase Options")). Select(Contains("continue")). Confirm() diff --git a/pkg/integration/components/popup.go b/pkg/integration/components/popup.go new file mode 100644 index 000000000..7cd2b2ffc --- /dev/null +++ b/pkg/integration/components/popup.go @@ -0,0 +1,70 @@ +package components + +type Popup struct { + t *TestDriver +} + +func (self *Popup) Confirmation() *ConfirmationAsserter { + self.inConfirm() + + return &ConfirmationAsserter{t: self.t} +} + +func (self *Popup) inConfirm() { + self.t.assertWithRetries(func() (bool, string) { + currentView := self.t.gui.CurrentContext().GetView() + return currentView.Name() == "confirmation" && !currentView.Editable, "Expected confirmation popup to be focused" + }) +} + +func (self *Popup) Prompt() *PromptAsserter { + self.inPrompt() + + return &PromptAsserter{t: self.t} +} + +func (self *Popup) inPrompt() { + self.t.assertWithRetries(func() (bool, string) { + currentView := self.t.gui.CurrentContext().GetView() + return currentView.Name() == "confirmation" && currentView.Editable, "Expected prompt popup to be focused" + }) +} + +func (self *Popup) Alert() *AlertAsserter { + self.inAlert() + + return &AlertAsserter{t: self.t} +} + +func (self *Popup) inAlert() { + // basically the same thing as a confirmation popup with the current implementation + self.t.assertWithRetries(func() (bool, string) { + currentView := self.t.gui.CurrentContext().GetView() + return currentView.Name() == "confirmation" && !currentView.Editable, "Expected alert popup to be focused" + }) +} + +func (self *Popup) Menu() *MenuAsserter { + self.inMenu() + + return &MenuAsserter{t: self.t} +} + +func (self *Popup) inMenu() { + self.t.assertWithRetries(func() (bool, string) { + return self.t.gui.CurrentContext().GetView().Name() == "menu", "Expected popup menu to be focused" + }) +} + +func (self *Popup) CommitMessagePanel() *CommitMessagePanelAsserter { + self.inCommitMessagePanel() + + return &CommitMessagePanelAsserter{t: self.t} +} + +func (self *Popup) inCommitMessagePanel() { + self.t.assertWithRetries(func() (bool, string) { + currentView := self.t.gui.CurrentContext().GetView() + return currentView.Name() == "commitMessage", "Expected commit message panel to be focused" + }) +} diff --git a/pkg/integration/components/test_driver.go b/pkg/integration/components/test_driver.go index d4ca76662..5f2e15435 100644 --- a/pkg/integration/components/test_driver.go +++ b/pkg/integration/components/test_driver.go @@ -133,76 +133,16 @@ func (self *TestDriver) inListContext() { }) } -func (self *TestDriver) ExpectConfirmation() *ConfirmationAsserter { - self.inConfirm() - - return &ConfirmationAsserter{t: self} -} - -func (self *TestDriver) inConfirm() { - self.assertWithRetries(func() (bool, string) { - currentView := self.gui.CurrentContext().GetView() - return currentView.Name() == "confirmation" && !currentView.Editable, "Expected confirmation popup to be focused" - }) -} - -func (self *TestDriver) ExpectPrompt() *PromptAsserter { - self.inPrompt() - - return &PromptAsserter{t: self} -} - -func (self *TestDriver) inPrompt() { - self.assertWithRetries(func() (bool, string) { - currentView := self.gui.CurrentContext().GetView() - return currentView.Name() == "confirmation" && currentView.Editable, "Expected prompt popup to be focused" - }) -} - -func (self *TestDriver) ExpectAlert() *AlertAsserter { - self.inAlert() - - return &AlertAsserter{t: self} -} - -func (self *TestDriver) inAlert() { - // basically the same thing as a confirmation popup with the current implementation - self.assertWithRetries(func() (bool, string) { - currentView := self.gui.CurrentContext().GetView() - return currentView.Name() == "confirmation" && !currentView.Editable, "Expected alert popup to be focused" - }) -} - -func (self *TestDriver) ExpectMenu() *MenuAsserter { - self.inMenu() - - return &MenuAsserter{t: self} -} - -func (self *TestDriver) inMenu() { - self.assertWithRetries(func() (bool, string) { - return self.gui.CurrentContext().GetView().Name() == "menu", "Expected popup menu to be focused" - }) -} - -func (self *TestDriver) ExpectCommitMessagePanel() *CommitMessagePanelAsserter { - self.inCommitMessagePanel() - - return &CommitMessagePanelAsserter{t: self} -} - -func (self *TestDriver) inCommitMessagePanel() { - self.assertWithRetries(func() (bool, string) { - currentView := self.gui.CurrentContext().GetView() - return currentView.Name() == "commitMessage", "Expected commit message panel to be focused" - }) -} - // for making assertions on lazygit views func (self *TestDriver) Views() *Views { return &Views{t: self} } +// for interacting with popups +func (self *TestDriver) ExpectPopup() *Popup { + return &Popup{t: self} +} + // for making assertions through git itself func (self *TestDriver) Git() *Git { return &Git{assertionHelper: self.assertionHelper, shell: self.shell} diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index 5092f2f0a..ca06d5fa5 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -19,14 +19,14 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) - t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm() + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm() } markCommitAsGood := func() { t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) - t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() } t.Views().Commits(). @@ -49,7 +49,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ markCommitAsGood() // commit 5 is the culprit because we marked 4 as good and 5 as bad. - t.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() + t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() }). IsFocused(). Content(Contains("commit 04")) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 7c2307bd6..ecac6ea3f 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -32,9 +32,9 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Commits.ViewBisectOptions). Tap(func() { - t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm() - t.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm() + t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm() t.Views().Information().Content(DoesNotContain("bisecting")) }). diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index c786f8970..070a3a433 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -27,9 +27,9 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.CheckoutBranchByName). Tap(func() { - t.ExpectPrompt().Title(Equals("Branch name:")).Type("new-branch").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Branch name:")).Type("new-branch").Confirm() - t.ExpectAlert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm() + t.ExpectPopup().Alert().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 520923cd6..7d93513dc 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -26,12 +26,12 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Universal.Remove). Tap(func() { - t.ExpectAlert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm() + t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm() }). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). 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 137bada27..e59aa8cb2 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -30,12 +30,12 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.RebaseBranch) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Rebasing")). Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")). Confirm() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() @@ -51,7 +51,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Information().Content(Contains("rebasing")) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 5996eb1fb..5f5341d66 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -36,14 +36,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.RebaseBranch) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Rebasing")). Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")). Confirm() t.Views().Information().Content(Contains("rebasing")) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() @@ -78,7 +78,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). PressPrimaryAction() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index 94288c718..0a46ad2a1 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -35,7 +35,7 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Commits.ViewResetOptions) - t.ExpectMenu(). + t.ExpectPopup().Menu(). Title(Contains("reset to other-branch")). Select(Contains("hard reset")). Confirm() diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index bac0fe83b..5b5b23403 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -27,7 +27,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in - t.ExpectPrompt(). + t.ExpectPopup().Prompt(). Title(Equals("Branch name:")). Type("branch-to"). SuggestionTopLines(Contains("branch-to-checkout")). diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index a9d7dd9c7..7aaaf36f1 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -60,7 +60,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.PasteCommits). Tap(func() { - t.ExpectAlert(). + t.ExpectPopup().Alert(). Title(Equals("Cherry-Pick")). Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")). Confirm() diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index c41de78b3..df9988c2a 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -47,9 +47,9 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.PasteCommits) - t.ExpectAlert().Title(Equals("Cherry-Pick")).Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).Confirm() + t.ExpectPopup().Alert().Title(Equals("Cherry-Pick")).Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).Confirm() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Auto-merge failed")). Content(Contains("Conflicts!")). Confirm() @@ -65,7 +65,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressPrimaryAction() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Confirm() diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index dc0615c87..6ed75a797 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -27,7 +27,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ commitMessage := "my commit message" - t.ExpectCommitMessagePanel().Type(commitMessage).Confirm() + t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index 1a5175146..4967ffb77 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -22,7 +22,7 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ PressPrimaryAction(). Press(keys.Files.CommitChanges) - t.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm() + t.ExpectPopup().CommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm() t.Views().Commits(). Lines( diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go index 16ae79b35..d3cd58f23 100644 --- a/pkg/integration/tests/commit/new_branch.go +++ b/pkg/integration/tests/commit/new_branch.go @@ -28,7 +28,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ Press(keys.Universal.New). Tap(func() { branchName := "my-branch-name" - t.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm() + t.ExpectPopup().Prompt().Title(Contains("New Branch Name")).Type(branchName).Confirm() t.Git().CurrentBranchName(branchName) }). diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go index 0f9c3fb9e..3b55aa65d 100644 --- a/pkg/integration/tests/commit/revert.go +++ b/pkg/integration/tests/commit/revert.go @@ -23,7 +23,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.RevertCommit). Tap(func() { - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Revert commit")). Content(MatchesRegexp(`Are you sure you want to revert \w+?`)). Confirm() diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index d5c5dc84e..09bcf2815 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -46,7 +46,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ Press(keys.Files.CommitChanges) commitMessage := "my commit message" - t.ExpectCommitMessagePanel().Type(commitMessage).Confirm() + t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go index 32cd8df06..620f712f9 100644 --- a/pkg/integration/tests/commit/staged_without_hooks.go +++ b/pkg/integration/tests/commit/staged_without_hooks.go @@ -46,7 +46,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ Press(keys.Files.CommitChangesWithoutHook) commitMessage := ": my commit message" - t.ExpectCommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm() + t.ExpectPopup().CommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm() t.Views().Commits(). Lines( diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index a3792e1b7..c0e26b281 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -40,7 +40,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ Press(keys.Files.CommitChanges) commitMessage := "my commit message" - t.ExpectCommitMessagePanel().Type(commitMessage).Confirm() + t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go index c843232ee..dcb41c83e 100644 --- a/pkg/integration/tests/custom_commands/form_prompts.go +++ b/pkg/integration/tests/custom_commands/form_prompts.go @@ -61,11 +61,11 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). Press("a") - t.ExpectPrompt().Title(Equals("Enter a file name")).Type("my file").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Enter a file name")).Type("my file").Confirm() - t.ExpectMenu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Are you sure?")). Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")). Confirm() diff --git a/pkg/integration/tests/custom_commands/menu_from_command.go b/pkg/integration/tests/custom_commands/menu_from_command.go index 71a6a5c15..db856c807 100644 --- a/pkg/integration/tests/custom_commands/menu_from_command.go +++ b/pkg/integration/tests/custom_commands/menu_from_command.go @@ -50,9 +50,9 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{ Focus(). Press("a") - t.ExpectMenu().Title(Equals("Choose commit message")).Select(Contains("bar")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Choose commit message")).Select(Contains("bar")).Confirm() - t.ExpectPrompt().Title(Equals("Description")).Type(" my branch").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Description")).Type(" my branch").Confirm() t.Views().Files(). 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 b4b649efd..123e27695 100644 --- a/pkg/integration/tests/custom_commands/menu_from_commands_output.go +++ b/pkg/integration/tests/custom_commands/menu_from_commands_output.go @@ -48,12 +48,12 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ Focus(). Press("a") - t.ExpectPrompt(). + t.ExpectPopup().Prompt(). Title(Equals("Which git command do you want to run?")). InitialText(Equals("branch")). Confirm() - t.ExpectMenu().Title(Equals("Branch:")).Select(Equals("master")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Branch:")).Select(Equals("master")).Confirm() t.Git().CurrentBranchName("master") }, diff --git a/pkg/integration/tests/custom_commands/multiple_prompts.go b/pkg/integration/tests/custom_commands/multiple_prompts.go index 519160b88..b1592d03b 100644 --- a/pkg/integration/tests/custom_commands/multiple_prompts.go +++ b/pkg/integration/tests/custom_commands/multiple_prompts.go @@ -59,11 +59,11 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). Press("a") - t.ExpectPrompt().Title(Equals("Enter a file name")).Type("myfile").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Enter a file name")).Type("myfile").Confirm() - t.ExpectMenu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm() - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Are you sure?")). Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")). Confirm() diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go index 7d66cc49d..8730fd881 100644 --- a/pkg/integration/tests/diff/diff.go +++ b/pkg/integration/tests/diff/diff.go @@ -30,7 +30,7 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Universal.DiffingMenu) - t.ExpectMenu().Title(Equals("Diffing")).Select(Contains(`diff branch-a`)).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains(`diff branch-a`)).Confirm() t.Views().Branches(). IsFocused(). @@ -66,7 +66,7 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). Press(keys.Universal.DiffingMenu) - t.ExpectMenu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() t.Views().Information().Content(Contains("showing output for: git diff branch-a branch-b -R")) t.Views().Main().Content(Contains("-second line")) }, diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go index 94cd29a6c..8988b0493 100644 --- a/pkg/integration/tests/diff/diff_and_apply_patch.go +++ b/pkg/integration/tests/diff/diff_and_apply_patch.go @@ -30,7 +30,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Universal.DiffingMenu) - t.ExpectMenu().Title(Equals("Diffing")).Select(Equals("diff branch-a")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Equals("diff branch-a")).Confirm() t.Views().Information().Content(Contains("showing output for: git diff branch-a branch-a")) @@ -60,14 +60,14 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ PressPrimaryAction(). // add the file to the patch Press(keys.Universal.DiffingMenu). Tap(func() { - t.ExpectMenu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm() t.Views().Information().Content(DoesNotContain("building patch")) }). Press(keys.Universal.CreatePatchOptionsMenu) // adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item - t.ExpectMenu().Title(Equals("Patch Options")).Select(MatchesRegexp("apply patch$")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Patch Options")).Select(MatchesRegexp("apply patch$")).Confirm() t.Views().Files(). Focus(). diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go index 68d4e99fd..6de643272 100644 --- a/pkg/integration/tests/diff/diff_commits.go +++ b/pkg/integration/tests/diff/diff_commits.go @@ -28,7 +28,7 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Universal.DiffingMenu). Tap(func() { - t.ExpectMenu().Title(Equals("Diffing")).Select(MatchesRegexp(`diff \w+`)).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(MatchesRegexp(`diff \w+`)).Confirm() t.Views().Information().Content(Contains("showing output for: git diff")) }). @@ -40,7 +40,7 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ }). Press(keys.Universal.DiffingMenu). Tap(func() { - t.ExpectMenu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm() t.Views().Main().Content(Contains("+second line\n+third line")) }). diff --git a/pkg/integration/tests/file/discard_changes.go b/pkg/integration/tests/file/discard_changes.go index e47695742..f3fc11a01 100644 --- a/pkg/integration/tests/file/discard_changes.go +++ b/pkg/integration/tests/file/discard_changes.go @@ -85,7 +85,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ SelectedLine(Contains(file.status + " " + file.label)). Press(keys.Universal.Remove) - t.ExpectMenu().Title(Equals(file.menuTitle)).Select(Contains("discard all changes")).Confirm() + t.ExpectPopup().Menu().Title(Equals(file.menuTitle)).Select(Contains("discard all changes")).Confirm() } } @@ -99,7 +99,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{ {status: "DU", label: "deleted-us.txt", menuTitle: "deleted-us.txt"}, }) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("continue")). Content(Contains("all merge conflicts resolved. Continue?")). Cancel() diff --git a/pkg/integration/tests/interactive_rebase/amend_merge.go b/pkg/integration/tests/interactive_rebase/amend_merge.go index 7301f1806..7e5e64746 100644 --- a/pkg/integration/tests/interactive_rebase/amend_merge.go +++ b/pkg/integration/tests/interactive_rebase/amend_merge.go @@ -41,7 +41,7 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{ Focus(). Press(keys.Commits.AmendToCommit) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("Amend Commit")). Content(Contains("Are you sure you want to amend this commit with your staged files?")). Confirm() diff --git a/pkg/integration/tests/misc/confirm_on_quit.go b/pkg/integration/tests/misc/confirm_on_quit.go index b4124c4fc..18b27a108 100644 --- a/pkg/integration/tests/misc/confirm_on_quit.go +++ b/pkg/integration/tests/misc/confirm_on_quit.go @@ -18,7 +18,7 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). Press(keys.Universal.Quit) - t.ExpectConfirmation(). + t.ExpectPopup().Confirmation(). Title(Equals("")). Content(Contains("Are you sure you want to quit?")). Confirm() diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go index fded5041c..0b47bcef3 100644 --- a/pkg/integration/tests/stash/rename.go +++ b/pkg/integration/tests/stash/rename.go @@ -28,7 +28,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Stash.RenameStash). Tap(func() { - t.ExpectPrompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() }). SelectedLine(Equals("On master: foo baz")) }, diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index c627faaf8..f88aac2d0 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -25,9 +25,9 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Files.ViewStashOptions) - t.ExpectMenu().Title(Equals("Stash options")).Select(MatchesRegexp("stash all changes$")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("stash all changes$")).Confirm() - t.ExpectPrompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go index 756f7948e..770c87b9c 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -27,9 +27,9 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Files.ViewStashOptions) - t.ExpectMenu().Title(Equals("Stash options")).Select(Contains("stash all changes including untracked files")).Confirm() + t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(Contains("stash all changes including untracked files")).Confirm() - t.ExpectPrompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() + t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines(