mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-23 00:39:13 +02:00
refactor to not have Match at the start of assert method names, because it reads better that way
This commit is contained in:
@ -21,19 +21,19 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("master"))
|
||||
assert.SelectedLine(Contains("master"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("@"))
|
||||
assert.SelectedLine(Contains("@"))
|
||||
input.PressKeys(keys.Branches.CheckoutBranchByName)
|
||||
assert.InPrompt()
|
||||
assert.MatchCurrentViewTitle(Equals("Branch name:"))
|
||||
assert.CurrentViewTitle(Equals("Branch name:"))
|
||||
input.Type("new-branch")
|
||||
input.Confirm()
|
||||
assert.InAlert()
|
||||
assert.MatchCurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?"))
|
||||
assert.CurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?"))
|
||||
input.Confirm()
|
||||
|
||||
assert.CurrentViewName("localBranches")
|
||||
assert.MatchSelectedLine(Contains("new-branch"))
|
||||
assert.SelectedLine(Contains("new-branch"))
|
||||
},
|
||||
})
|
||||
|
@ -20,21 +20,21 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("branch-two"))
|
||||
assert.SelectedLine(Contains("branch-two"))
|
||||
input.PressKeys(keys.Universal.Remove)
|
||||
assert.InAlert()
|
||||
assert.MatchCurrentViewContent(Contains("You cannot delete the checked out branch!"))
|
||||
assert.CurrentViewContent(Contains("You cannot delete the checked out branch!"))
|
||||
|
||||
input.Confirm()
|
||||
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("branch-one"))
|
||||
assert.SelectedLine(Contains("branch-one"))
|
||||
input.PressKeys(keys.Universal.Remove)
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?"))
|
||||
assert.CurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?"))
|
||||
input.Confirm()
|
||||
assert.CurrentViewName("localBranches")
|
||||
assert.MatchSelectedLine(Contains("master"))
|
||||
assert.MatchCurrentViewContent(NotContains("branch-one"))
|
||||
assert.SelectedLine(Contains("master"))
|
||||
assert.CurrentViewContent(NotContains("branch-one"))
|
||||
},
|
||||
})
|
||||
|
@ -18,21 +18,21 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("first-change-branch"))
|
||||
assert.SelectedLine(Contains("first-change-branch"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("second-change-branch"))
|
||||
assert.SelectedLine(Contains("second-change-branch"))
|
||||
input.PressKeys(keys.Branches.RebaseBranch)
|
||||
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
|
||||
assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
|
||||
input.Confirm()
|
||||
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Conflicts!"))
|
||||
assert.CurrentViewContent(Contains("Conflicts!"))
|
||||
input.Confirm()
|
||||
|
||||
assert.CurrentViewName("files")
|
||||
assert.MatchSelectedLine(Contains("file"))
|
||||
assert.SelectedLine(Contains("file"))
|
||||
|
||||
// not using Confirm() convenience method because I suspect we might change this
|
||||
// keybinding to something more bespoke
|
||||
@ -41,13 +41,13 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert.CurrentViewName("mergeConflicts")
|
||||
input.PrimaryAction()
|
||||
|
||||
assert.MatchViewContent("information", Contains("rebasing"))
|
||||
assert.ViewContent("information", Contains("rebasing"))
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?"))
|
||||
assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?"))
|
||||
input.Confirm()
|
||||
assert.MatchViewContent("information", NotContains("rebasing"))
|
||||
assert.ViewContent("information", NotContains("rebasing"))
|
||||
|
||||
// this proves we actually have integrated the changes from second-change-branch
|
||||
assert.MatchViewContent("commits", Contains("second-change-branch unrelated change"))
|
||||
assert.ViewContent("commits", Contains("second-change-branch unrelated change"))
|
||||
},
|
||||
})
|
||||
|
@ -21,30 +21,30 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("first-change-branch"))
|
||||
assert.SelectedLine(Contains("first-change-branch"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("second-change-branch"))
|
||||
assert.SelectedLine(Contains("second-change-branch"))
|
||||
input.PressKeys(keys.Branches.RebaseBranch)
|
||||
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
|
||||
assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?"))
|
||||
input.Confirm()
|
||||
|
||||
assert.MatchViewContent("information", Contains("rebasing"))
|
||||
assert.ViewContent("information", Contains("rebasing"))
|
||||
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Conflicts!"))
|
||||
assert.CurrentViewContent(Contains("Conflicts!"))
|
||||
input.Confirm()
|
||||
|
||||
assert.CurrentViewName("files")
|
||||
assert.MatchSelectedLine(Contains("file"))
|
||||
assert.SelectedLine(Contains("file"))
|
||||
|
||||
input.SwitchToCommitsWindow()
|
||||
assert.MatchSelectedLine(Contains("pick")) // this means it's a rebasing commit
|
||||
assert.SelectedLine(Contains("pick")) // this means it's a rebasing commit
|
||||
input.NextItem()
|
||||
input.PressKeys(keys.Universal.Remove)
|
||||
assert.MatchSelectedLine(Contains("to remove"))
|
||||
assert.MatchSelectedLine(Contains("drop"))
|
||||
assert.SelectedLine(Contains("to remove"))
|
||||
assert.SelectedLine(Contains("drop"))
|
||||
|
||||
input.SwitchToFilesWindow()
|
||||
|
||||
@ -56,14 +56,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.PrimaryAction()
|
||||
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?"))
|
||||
assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?"))
|
||||
input.Confirm()
|
||||
|
||||
assert.MatchViewContent("information", NotContains("rebasing"))
|
||||
assert.ViewContent("information", NotContains("rebasing"))
|
||||
|
||||
// this proves we actually have integrated the changes from second-change-branch
|
||||
assert.MatchViewContent("commits", Contains("second-change-branch unrelated change"))
|
||||
assert.MatchViewContent("commits", Contains("to keep"))
|
||||
assert.MatchViewContent("commits", NotContains("to remove"))
|
||||
assert.ViewContent("commits", Contains("second-change-branch unrelated change"))
|
||||
assert.ViewContent("commits", Contains("to keep"))
|
||||
assert.ViewContent("commits", NotContains("to remove"))
|
||||
},
|
||||
})
|
||||
|
@ -24,19 +24,19 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("current-branch"))
|
||||
assert.SelectedLine(Contains("current-branch"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("other-branch"))
|
||||
assert.SelectedLine(Contains("other-branch"))
|
||||
|
||||
input.PressKeys(keys.Commits.ViewResetOptions)
|
||||
assert.InMenu()
|
||||
assert.MatchCurrentViewTitle(Contains("reset to other-branch"))
|
||||
assert.CurrentViewTitle(Contains("reset to other-branch"))
|
||||
|
||||
assert.MatchSelectedLine(Contains("soft reset"))
|
||||
assert.SelectedLine(Contains("soft reset"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("mixed reset"))
|
||||
assert.SelectedLine(Contains("mixed reset"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("hard reset"))
|
||||
assert.SelectedLine(Contains("hard reset"))
|
||||
|
||||
input.Confirm()
|
||||
|
||||
@ -47,8 +47,8 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToCommitsWindow()
|
||||
assert.CurrentViewName("commits")
|
||||
assert.CommitCount(2)
|
||||
assert.MatchSelectedLine(Contains("other-branch commit"))
|
||||
assert.SelectedLine(Contains("other-branch commit"))
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("root commit"))
|
||||
assert.SelectedLine(Contains("root commit"))
|
||||
},
|
||||
})
|
||||
|
@ -34,7 +34,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
// we expect the first suggestion to be the branch we want because it most
|
||||
// closely matches what we typed in
|
||||
assert.MatchSelectedLine(Contains("branch-to-checkout"))
|
||||
assert.SelectedLine(Contains("branch-to-checkout"))
|
||||
input.Confirm()
|
||||
|
||||
assert.CurrentBranchName("branch-to-checkout")
|
||||
|
Reference in New Issue
Block a user