Skip to content

Commit

Permalink
Simplify integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
brandondong authored and jesseduffield committed Jul 6, 2024
1 parent 2e5b570 commit 38aa5b8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 55 deletions.
11 changes: 0 additions & 11 deletions pkg/integration/components/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,6 @@ 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})
}
Expand Down
45 changes: 45 additions & 0 deletions pkg/integration/tests/file/stage_children_range_select.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package file

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var StageChildrenRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage a range of files/folders and their children using range select",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("foo", "")
shell.CreateFile("foobar", "")
shell.CreateFile("baz/file", "")
shell.CreateFile("bazbam/file", "")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("▼ baz").IsSelected(),
Contains(" ??").Contains("file"),
Contains("▼ bazbam"),
Contains(" ??").Contains("file"),
Contains("??").Contains("foo"),
Contains("??").Contains("foobar"),
).
// Select everything
Press(keys.Universal.ToggleRangeSelect).
NavigateToLine(Contains("foobar")).
// Stage
PressPrimaryAction().
Lines(
Contains("▼ baz").IsSelected(),
Contains(" A ").Contains("file").IsSelected(),
Contains("▼ bazbam").IsSelected(),
Contains(" A ").Contains("file").IsSelected(),
Contains("A ").Contains("foo").IsSelected(),
Contains("A ").Contains("foobar").IsSelected(),
)
},
})
43 changes: 0 additions & 43 deletions pkg/integration/tests/file/stage_renamed_range_select.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/integration/tests/test_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ var tests = []*components.IntegrationTest{
file.DiscardVariousChangesRangeSelect,
file.Gitignore,
file.RememberCommitMessageAfterFail,
file.StageChildrenRangeSelect,
file.StageRangeSelect,
file.StageRenamedRangeSelect,
filter_and_search.FilterCommitFiles,
filter_and_search.FilterFiles,
filter_and_search.FilterFuzzy,
Expand Down

0 comments on commit 38aa5b8

Please sign in to comment.