1
0
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:
Jesse Duffield
2022-12-24 17:48:57 +11:00
parent aedfce2845
commit b623ecf898
40 changed files with 380 additions and 402 deletions

View File

@ -26,11 +26,9 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
assert.CurrentViewName("localBranches")
assert.SelectedLine(Contains("branch-a"))
input.PressKeys(keys.Universal.DiffingMenu)
assert.InMenu()
assert.CurrentViewTitle(Equals("Diffing"))
assert.SelectedLine(Contains("diff branch-a"))
input.Confirm()
input.Press(keys.Universal.DiffingMenu)
input.Menu(Equals("Diffing"), Equals("diff branch-a"))
assert.CurrentViewName("localBranches")
@ -51,20 +49,14 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
// add the file to the patch
input.PrimaryAction()
input.PressKeys(keys.Universal.DiffingMenu)
assert.InMenu()
assert.CurrentViewTitle(Equals("Diffing"))
input.NavigateToListItemContainingText("exit diff mode")
input.Confirm()
input.Press(keys.Universal.DiffingMenu)
input.Menu(Equals("Diffing"), Contains("exit diff mode"))
assert.ViewContent("information", NotContains("building patch"))
input.PressKeys(keys.Universal.CreatePatchOptionsMenu)
assert.InMenu()
assert.CurrentViewTitle(Equals("Patch Options"))
// including the keybinding 'a' here to distinguish the menu item from the 'apply patch in reverse' item
input.NavigateToListItemContainingText("a apply patch")
input.Confirm()
input.Press(keys.Universal.CreatePatchOptionsMenu)
// adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item
input.Menu(Equals("Patch Options"), MatchesRegexp("apply patch$"))
input.SwitchToFilesWindow()