diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/integration/components/view_driver.go | 28 | ||||
-rw-r--r-- | pkg/integration/tests/commit/highlight.go | 37 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
3 files changed, 66 insertions, 0 deletions
diff --git a/pkg/integration/components/view_driver.go b/pkg/integration/components/view_driver.go index eb9c0d7f7..1a5017b37 100644 --- a/pkg/integration/components/view_driver.go +++ b/pkg/integration/components/view_driver.go @@ -133,6 +133,34 @@ func (self *ViewDriver) ContainsLines(matchers ...*Matcher) *ViewDriver { return self } +func (self *ViewDriver) ContainsColoredText(fgColorStr string, text string) *ViewDriver { + self.t.assertWithRetries(func() (bool, string) { + view := self.getView() + ok := self.getView().ContainsColoredText(fgColorStr, text) + if !ok { + return false, fmt.Sprintf("expected view '%s' to contain colored text '%s' but it didn't", view.Name(), text) + } + + return true, "" + }) + + return self +} + +func (self *ViewDriver) DoesNotContainColoredText(fgColorStr string, text string) *ViewDriver { + self.t.assertWithRetries(func() (bool, string) { + view := self.getView() + ok := !self.getView().ContainsColoredText(fgColorStr, text) + if !ok { + return false, fmt.Sprintf("expected view '%s' to NOT contain colored text '%s' but it didn't", view.Name(), text) + } + + return true, "" + }) + + return self +} + // asserts on the lines that are selected in the view. Don't use the `IsSelected` matcher with this because it's redundant. func (self *ViewDriver) SelectedLines(matchers ...*Matcher) *ViewDriver { self.validateMatchersPassed(matchers) diff --git a/pkg/integration/tests/commit/highlight.go b/pkg/integration/tests/commit/highlight.go new file mode 100644 index 000000000..eaa77ccf1 --- /dev/null +++ b/pkg/integration/tests/commit/highlight.go @@ -0,0 +1,37 @@ +package commit + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var Highlight = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Verify that the commit view highlights the correct lines", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Git.Log.ShowGraph = "always" + config.GetUserConfig().Gui.AuthorColors = map[string]string{ + "CI": "red", + } + }, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("one") + shell.EmptyCommit("two") + shell.EmptyCommit("three") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + highlightedColor := "#ffffff" + + t.Views().Commits(). + DoesNotContainColoredText(highlightedColor, "◯"). + Focus(). + ContainsColoredText(highlightedColor, "◯") + + t.Views().Files(). + Focus() + + t.Views().Commits(). + DoesNotContainColoredText(highlightedColor, "◯") + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 2a16df041..222917b0f 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -53,6 +53,7 @@ var tests = []*components.IntegrationTest{ commit.CommitWithPrefix, commit.CreateTag, commit.DiscardOldFileChange, + commit.Highlight, commit.History, commit.HistoryComplex, commit.NewBranch, |