1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Improve staging panel integration tests

This commit is contained in:
Jesse Duffield
2023-02-24 21:42:27 +11:00
parent 752526c880
commit db011d8e34
18 changed files with 417 additions and 116 deletions

View File

@ -7,7 +7,6 @@ import (
"github.com/atotto/clipboard"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/types"
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
)
@ -84,9 +83,7 @@ func (self *TestDriver) Shell() *Shell {
// in the current page and failing that, jump to the top of the view and iterate through all of it,
// looking for the item.
func (self *TestDriver) navigateToListItem(matcher *matcher) {
self.inListContext()
currentContext := self.gui.CurrentContext().(types.IListContext)
currentContext := self.gui.CurrentContext()
view := currentContext.GetView()
@ -133,14 +130,6 @@ func (self *TestDriver) navigateToListItem(matcher *matcher) {
}
}
func (self *TestDriver) inListContext() {
self.assertWithRetries(func() (bool, string) {
currentContext := self.gui.CurrentContext()
_, ok := currentContext.(types.IListContext)
return ok, fmt.Sprintf("Expected current context to be a list context, but got %s", currentContext.GetKey())
})
}
// for making assertions on lazygit views
func (self *TestDriver) Views() *Views {
return &Views{t: self}