mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-17 22:32:58 +02:00
Add integration test
This commit is contained in:
parent
a5eec48b4b
commit
2e5b570bb6
@ -134,6 +134,17 @@ func (self *Shell) UpdateFile(path string, content string) *Shell {
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Shell) Rename(path string, newPath string) *Shell {
|
||||
fullPath := filepath.Join(self.dir, path)
|
||||
newFullPath := filepath.Join(self.dir, newPath)
|
||||
err := os.Rename(fullPath, newFullPath)
|
||||
if err != nil {
|
||||
self.fail(fmt.Sprintf("error renaming %s to %s\n%s", fullPath, newFullPath, err))
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Shell) NewBranch(name string) *Shell {
|
||||
return self.RunCommand([]string{"git", "checkout", "-b", name})
|
||||
}
|
||||
|
43
pkg/integration/tests/file/stage_renamed_range_select.go
Normal file
43
pkg/integration/tests/file/stage_renamed_range_select.go
Normal file
@ -0,0 +1,43 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var StageRenamedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Stage a range of renamed files/folders using range select",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("dir1/file-a", "A's content")
|
||||
shell.CreateFileAndAdd("file-b", "B's content")
|
||||
shell.Commit("first commit")
|
||||
shell.Rename("dir1", "dir1_v2")
|
||||
shell.Rename("file-b", "file-b_v2")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("▼ dir1").IsSelected(),
|
||||
Contains(" D").Contains("file-a"),
|
||||
Contains("▼ dir1_v2"),
|
||||
Contains(" ??").Contains("file-a"),
|
||||
Contains(" D").Contains("file-b"),
|
||||
Contains("??").Contains("file-b_v2"),
|
||||
).
|
||||
// Select everything
|
||||
Press(keys.Universal.ToggleRangeSelect).
|
||||
NavigateToLine(Contains("file-b_v2")).
|
||||
// Stage
|
||||
PressPrimaryAction().
|
||||
Lines(
|
||||
Contains("▼ dir1_v2"),
|
||||
Contains(" R ").Contains("dir1/file-a → file-a"),
|
||||
Contains("R ").Contains("file-b → file-b_v2").IsSelected(),
|
||||
)
|
||||
},
|
||||
})
|
@ -161,6 +161,7 @@ var tests = []*components.IntegrationTest{
|
||||
file.Gitignore,
|
||||
file.RememberCommitMessageAfterFail,
|
||||
file.StageRangeSelect,
|
||||
file.StageRenamedRangeSelect,
|
||||
filter_and_search.FilterCommitFiles,
|
||||
filter_and_search.FilterFiles,
|
||||
filter_and_search.FilterFuzzy,
|
||||
|
Loading…
x
Reference in New Issue
Block a user