1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

cleaner test assertions

This commit is contained in:
Jesse Duffield
2022-12-26 11:12:56 +11:00
parent fa0414777f
commit 9a6f21ce42
34 changed files with 442 additions and 378 deletions

View File

@ -19,17 +19,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesWindow()
assert.CurrentViewName("localBranches")
assert.ViewLines(
"localBranches",
assert.CurrentView().Name("localBranches").Lines(
Contains("first-change-branch"),
Contains("second-change-branch"),
Contains("original-branch"),
)
assert.ViewTopLines(
"commits",
assert.View("commits").TopLines(
Contains("to keep"),
Contains("to remove"),
Contains("first change"),
@ -41,26 +38,29 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
input.AcceptConfirmation(Equals("Rebasing"), Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
assert.ViewContent("information", Contains("rebasing"))
assert.View("information").Content(Contains("rebasing"))
input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!"))
assert.CurrentViewName("files")
assert.CurrentLine(Contains("file"))
assert.CurrentView().
Name("files").
SelectedLine(Contains("file"))
input.SwitchToCommitsWindow()
assert.ViewTopLines(
"commits",
MatchesRegexp(`pick.*to keep`),
MatchesRegexp(`pick.*to remove`),
MatchesRegexp("YOU ARE HERE.*second-change-branch unrelated change"),
MatchesRegexp("second change"),
MatchesRegexp("original"),
)
assert.CurrentLineIdx(0)
assert.CurrentView().
Name("commits").
TopLines(
MatchesRegexp(`pick.*to keep`),
MatchesRegexp(`pick.*to remove`),
MatchesRegexp("YOU ARE HERE.*second-change-branch unrelated change"),
MatchesRegexp("second change"),
MatchesRegexp("original"),
).
SelectedLineIdx(0)
input.NextItem()
input.Press(keys.Universal.Remove)
assert.CurrentLine(MatchesRegexp(`drop.*to remove`))
assert.CurrentView().SelectedLine(MatchesRegexp(`drop.*to remove`))
input.SwitchToFilesWindow()
@ -68,15 +68,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
// keybinding to something more bespoke
input.Press(keys.Universal.Confirm)
assert.CurrentViewName("mergeConflicts")
assert.CurrentView().Name("mergeConflicts")
input.PrimaryAction()
input.AcceptConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?"))
assert.ViewContent("information", NotContains("rebasing"))
assert.View("information").Content(NotContains("rebasing"))
assert.ViewTopLines(
"commits",
assert.View("commits").TopLines(
Contains("to keep"),
Contains("second-change-branch unrelated change"),
Contains("second change"),