mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-08 22:36:49 +02:00
Extract helper function for integration test
We are going to reuse it in two other tests that we are going to add in the next commit.
This commit is contained in:
@ -15,26 +15,10 @@ var KeepSameCommitSelectedOnExit = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
commonSetup(shell)
|
commonSetup(shell)
|
||||||
},
|
},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
t.Views().Commits().
|
filterByFilterFile(t, keys)
|
||||||
Focus().
|
|
||||||
Lines(
|
|
||||||
Contains(`none of the two`).IsSelected(),
|
|
||||||
Contains(`both files`),
|
|
||||||
Contains(`only otherFile`),
|
|
||||||
Contains(`only filterFile`),
|
|
||||||
).Press(keys.Universal.FilteringMenu).
|
|
||||||
Tap(func() {
|
|
||||||
t.ExpectPopup().Menu().
|
|
||||||
Title(Equals("Filtering")).
|
|
||||||
Select(Contains("Enter path to filter by")).
|
|
||||||
Confirm()
|
|
||||||
|
|
||||||
t.ExpectPopup().Prompt().
|
t.Views().Commits().
|
||||||
Title(Equals("Enter path:")).
|
IsFocused().
|
||||||
Type("filterF").
|
|
||||||
SuggestionLines(Equals("filterFile")).
|
|
||||||
ConfirmFirstSuggestion()
|
|
||||||
}).
|
|
||||||
Lines(
|
Lines(
|
||||||
Contains(`both files`).IsSelected(),
|
Contains(`both files`).IsSelected(),
|
||||||
Contains(`only filterFile`),
|
Contains(`only filterFile`),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package filter_by_path
|
package filter_by_path
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,6 +18,28 @@ func commonSetup(shell *Shell) {
|
|||||||
shell.EmptyCommit("none of the two")
|
shell.EmptyCommit("none of the two")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func filterByFilterFile(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Commits().
|
||||||
|
Focus().
|
||||||
|
Lines(
|
||||||
|
Contains(`none of the two`).IsSelected(),
|
||||||
|
Contains(`both files`),
|
||||||
|
Contains(`only otherFile`),
|
||||||
|
Contains(`only filterFile`),
|
||||||
|
).
|
||||||
|
Press(keys.Universal.FilteringMenu)
|
||||||
|
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Filtering")).
|
||||||
|
Select(Contains("Enter path to filter by")).
|
||||||
|
Confirm()
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("Enter path:")).
|
||||||
|
Type("filterF").
|
||||||
|
SuggestionLines(Equals("filterFile")).
|
||||||
|
ConfirmFirstSuggestion()
|
||||||
|
}
|
||||||
|
|
||||||
func postFilterTest(t *TestDriver) {
|
func postFilterTest(t *TestDriver) {
|
||||||
t.Views().Information().Content(Contains("Filtering by 'filterFile'"))
|
t.Views().Information().Content(Contains("Filtering by 'filterFile'"))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user