mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
add helper functions for popups in tests
This commit is contained in:
@ -20,24 +20,14 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert *Assert,
|
||||
keys config.KeybindingConfig,
|
||||
) {
|
||||
viewBisectOptions := func() {
|
||||
input.PressKeys(keys.Commits.ViewBisectOptions)
|
||||
assert.InMenu()
|
||||
}
|
||||
markCommitAsBad := func() {
|
||||
viewBisectOptions()
|
||||
assert.SelectedLine(Contains("bad"))
|
||||
|
||||
input.Confirm()
|
||||
input.Press(keys.Commits.ViewBisectOptions)
|
||||
input.Menu(Equals("Bisect"), MatchesRegexp(`mark .* as bad`))
|
||||
}
|
||||
|
||||
markCommitAsGood := func() {
|
||||
viewBisectOptions()
|
||||
assert.SelectedLine(Contains("bad"))
|
||||
input.NextItem()
|
||||
assert.SelectedLine(Contains("good"))
|
||||
|
||||
input.Confirm()
|
||||
input.Press(keys.Commits.ViewBisectOptions)
|
||||
input.Menu(Equals("Bisect"), MatchesRegexp(`mark .* as good`))
|
||||
}
|
||||
|
||||
assert.AtLeastOneCommit()
|
||||
@ -46,7 +36,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
assert.SelectedLine(Contains("commit 10"))
|
||||
|
||||
input.NavigateToListItemContainingText("commit 09")
|
||||
input.NavigateToListItem(Contains("commit 09"))
|
||||
|
||||
markCommitAsBad()
|
||||
|
||||
@ -55,11 +45,11 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert.CurrentViewName("commits")
|
||||
assert.SelectedLine(Contains("<-- bad"))
|
||||
|
||||
input.NavigateToListItemContainingText("commit 02")
|
||||
input.NavigateToListItem(Contains("commit 02"))
|
||||
|
||||
markCommitAsGood()
|
||||
|
||||
// lazygit will land us in the comit between our good and bad commits.
|
||||
// lazygit will land us in the commit between our good and bad commits.
|
||||
assert.CurrentViewName("commits")
|
||||
assert.SelectedLine(Contains("commit 05"))
|
||||
assert.SelectedLine(Contains("<-- current"))
|
||||
@ -72,12 +62,8 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
markCommitAsGood()
|
||||
|
||||
assert.InAlert()
|
||||
assert.CurrentViewContent(Contains("Bisect complete!"))
|
||||
// commit 5 is the culprit because we marked 4 as good and 5 as bad.
|
||||
assert.CurrentViewContent(Contains("commit 05"))
|
||||
assert.CurrentViewContent(Contains("Do you want to reset"))
|
||||
input.Confirm()
|
||||
input.Alert(Equals("Bisect complete"), MatchesRegexp("(?s)commit 05.*Do you want to reset"))
|
||||
|
||||
assert.CurrentViewName("commits")
|
||||
assert.CurrentViewContent(Contains("commit 04"))
|
||||
|
Reference in New Issue
Block a user