From a3450dfdfc9ade90147eb6103d8c2ddb9d7c7b00 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 28 Dec 2022 10:41:42 +1100 Subject: [PATCH] fix suggestions test --- pkg/integration/components/prompt_asserter.go | 14 ++++++-------- pkg/integration/components/test_driver.go | 7 ------- pkg/integration/tests/branch/suggestions.go | 3 +-- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/pkg/integration/components/prompt_asserter.go b/pkg/integration/components/prompt_asserter.go index 9fea5bdf2..12b19bcd4 100644 --- a/pkg/integration/components/prompt_asserter.go +++ b/pkg/integration/components/prompt_asserter.go @@ -65,20 +65,18 @@ func (self *PromptAsserter) SuggestionTopLines(matchers ...*matcher) *PromptAsse return self } -func (self *PromptAsserter) SelectFirstSuggestion() *PromptAsserter { +func (self *PromptAsserter) ConfirmFirstSuggestion() { self.t.press(self.t.keys.Universal.TogglePanel) self.t.Views().Suggestions(). IsFocused(). - SelectedLineIdx(0) - - return self + SelectedLineIdx(0). + PressEnter() } -func (self *PromptAsserter) SelectSuggestion(matcher *matcher) *PromptAsserter { +func (self *PromptAsserter) ConfirmSuggestion(matcher *matcher) { self.t.press(self.t.keys.Universal.TogglePanel) self.t.Views().Suggestions(). IsFocused(). - NavigateToListItem(matcher) - - return self + NavigateToListItem(matcher). + PressEnter() } diff --git a/pkg/integration/components/test_driver.go b/pkg/integration/components/test_driver.go index a314c9fd3..dc6fd421f 100644 --- a/pkg/integration/components/test_driver.go +++ b/pkg/integration/components/test_driver.go @@ -207,13 +207,6 @@ func (self *TestDriver) inCommitMessagePanel() { }) } -func (self *TestDriver) currentWindowName(expectedWindowName string) { - self.assertWithRetries(func() (bool, string) { - actual := self.gui.CurrentContext().GetView().Name() - return actual == expectedWindowName, fmt.Sprintf("Expected current window name to be '%s', but got '%s'", expectedWindowName, actual) - }) -} - // for making assertions on lazygit views func (self *TestDriver) Views() *Views { return &Views{t: self} diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 0671578ed..bac0fe83b 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -31,8 +31,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ Title(Equals("Branch name:")). Type("branch-to"). SuggestionTopLines(Contains("branch-to-checkout")). - SelectFirstSuggestion(). - Confirm() + ConfirmFirstSuggestion() t.Git().CurrentBranchName("branch-to-checkout") },