lazygit/pkg/integration/tests/patch_building/select_all_files.go
Stefan Haller 0b5504aa98 Cleanup: make integration test assertions for files panel more specific
Assert the entire lines using Equals instead of Contains. This makes the tests a
bit easier to read, and it makes it much easier to decide how they need to be
changed when we change the layout (like we do in the last commit of this
branch).

It is true that this requires changing all these tests for any future UI
changes, but I think this is a good price to pay; those adaptions are trivial
and can be done without thinking.
2025-03-20 11:58:50 +01:00

42 lines
1.1 KiB
Go

package patch_building
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add all files of a commit to a custom patch with the 'a' keybinding",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "file1 content")
shell.CreateFileAndAdd("file2", "file2 content")
shell.CreateFileAndAdd("file3", "file3 content")
shell.Commit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("first commit").IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("A file1").IsSelected(),
Equals("A file2"),
Equals("A file3"),
).
Press(keys.Files.ToggleStagedAll)
t.Views().Information().Content(Contains("Building patch"))
t.Views().Secondary().Content(
Contains("file1").Contains("file3").Contains("file3"),
)
},
})