1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

combine assert and input structs, clean up interface

This commit is contained in:
Jesse Duffield
2022-12-27 16:27:36 +11:00
parent c5c9f5bb94
commit b166b8f776
47 changed files with 1021 additions and 912 deletions

View File

@ -17,54 +17,55 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
Run: func(
shell *Shell,
input *Input,
assert *Assert,
keys config.KeybindingConfig,
) {
markCommitAsBad := func() {
input.Press(keys.Commits.ViewBisectOptions)
input.Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm()
input.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm()
}
markCommitAsGood := func() {
input.Press(keys.Commits.ViewBisectOptions)
input.Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
input.Views().Commits().
Press(keys.Commits.ViewBisectOptions)
input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
}
assert.Model().AtLeastOneCommit()
input.Model().AtLeastOneCommit()
input.SwitchToCommitsView()
assert.Views().Current().SelectedLine(Contains("commit 10"))
input.NavigateToListItem(Contains("commit 09"))
input.Views().Commits().
Focus().
SelectedLine(Contains("commit 10")).
NavigateToListItem(Contains("commit 09"))
markCommitAsBad()
assert.Views().ByName("information").Content(Contains("bisecting"))
input.Views().Information().Content(Contains("bisecting"))
assert.Views().Current().Name("commits").SelectedLine(Contains("<-- bad"))
input.NavigateToListItem(Contains("commit 02"))
input.Views().Commits().
IsFocused().
SelectedLine(Contains("<-- bad")).
NavigateToListItem(Contains("commit 02"))
markCommitAsGood()
// lazygit will land us in the commit between our good and bad commits.
assert.Views().Current().
Name("commits").
input.Views().Commits().IsFocused().
SelectedLine(Contains("commit 05").Contains("<-- current"))
markCommitAsBad()
assert.Views().Current().
Name("commits").
input.Views().Commits().IsFocused().
SelectedLine(Contains("commit 04").Contains("<-- current"))
markCommitAsGood()
// commit 5 is the culprit because we marked 4 as good and 5 as bad.
input.Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
assert.Views().Current().Name("commits").Content(Contains("commit 04"))
assert.Views().ByName("information").Content(DoesNotContain("bisecting"))
input.Views().Commits().IsFocused().Content(Contains("commit 04"))
input.Views().Information().Content(DoesNotContain("bisecting"))
},
})