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

@ -16,17 +16,15 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesWindow()
assert.CurrentViewName("localBranches")
assert.CurrentView().Name("localBranches")
assert.ViewLines(
"localBranches",
assert.View("localBranches").Lines(
Contains("first-change-branch"),
Contains("second-change-branch"),
Contains("original-branch"),
)
assert.ViewTopLines(
"commits",
assert.View("commits").TopLines(
Contains("first change"),
Contains("original"),
)
@ -35,27 +33,24 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
input.Press(keys.Branches.RebaseBranch)
input.AcceptConfirmation(Equals("Rebasing"), Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
input.AcceptConfirmation(Equals("Auto-merge failed"), Contains("Conflicts!"))
assert.CurrentViewName("files")
assert.CurrentLine(Contains("file"))
assert.CurrentView().Name("files").SelectedLine(Contains("file"))
// not using Confirm() convenience method because I suspect we might change this
// keybinding to something more bespoke
input.Press(keys.Universal.Confirm)
assert.CurrentViewName("mergeConflicts")
assert.CurrentView().Name("mergeConflicts")
input.PrimaryAction()
assert.ViewContent("information", Contains("rebasing"))
assert.View("information").Content(Contains("rebasing"))
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("second-change-branch unrelated change"),
Contains("second change"),
Contains("original"),