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

add view asserter getter struct

This commit is contained in:
Jesse Duffield
2022-12-27 15:07:11 +11:00
parent b64f55518b
commit be30cbb375
35 changed files with 184 additions and 174 deletions

View File

@ -23,7 +23,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
input.SwitchToBranchesView()
assert.CurrentView().Lines(
assert.Views().Current().Lines(
Contains("branch-a"),
Contains("branch-b"),
)
@ -32,21 +32,21 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
input.Menu().Title(Equals("Diffing")).Select(Equals("diff branch-a")).Confirm()
assert.CurrentView().Name("localBranches")
assert.Views().Current().Name("localBranches")
assert.View("information").Content(Contains("showing output for: git diff branch-a branch-a"))
assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-a"))
input.NextItem()
assert.View("information").Content(Contains("showing output for: git diff branch-a branch-b"))
assert.MainView().Content(Contains("+second line"))
assert.Views().ByName("information").Content(Contains("showing output for: git diff branch-a branch-b"))
assert.Views().Main().Content(Contains("+second line"))
input.Enter()
assert.CurrentView().Name("subCommits")
assert.MainView().Content(Contains("+second line"))
assert.CurrentView().SelectedLine(Contains("update"))
assert.Views().Current().Name("subCommits")
assert.Views().Main().Content(Contains("+second line"))
assert.Views().Current().SelectedLine(Contains("update"))
input.Enter()
assert.CurrentView().Name("commitFiles")
assert.CurrentView().SelectedLine(Contains("file1"))
assert.MainView().Content(Contains("+second line"))
assert.Views().Current().Name("commitFiles")
assert.Views().Current().SelectedLine(Contains("file1"))
assert.Views().Main().Content(Contains("+second line"))
// add the file to the patch
input.PrimaryAction()
@ -54,7 +54,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
input.Press(keys.Universal.DiffingMenu)
input.Menu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm()
assert.View("information").Content(DoesNotContain("building patch"))
assert.Views().ByName("information").Content(DoesNotContain("building patch"))
input.Press(keys.Universal.CreatePatchOptionsMenu)
// adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item
@ -62,7 +62,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
input.SwitchToFilesView()
assert.CurrentView().SelectedLine(Contains("file1"))
assert.MainView().Content(Contains("+second line"))
assert.Views().Current().SelectedLine(Contains("file1"))
assert.Views().Main().Content(Contains("+second line"))
},
})