lazygit/pkg/integration/tests/conflicts/resolve_multiple_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

54 lines
1.3 KiB
Go

package conflicts
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that upon resolving conflicts for one file, the next file is selected",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeConflictFiles(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Equals("UU file1").IsSelected(),
Equals("UU file2"),
).
PressEnter()
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Views().Files().
IsFocused().
Lines(
Equals("UU file2").IsSelected(),
).
PressEnter()
// coincidentally these files have the same conflict
t.Views().MergeConflicts().
IsFocused().
SelectedLines(
Contains("<<<<<<< HEAD"),
Contains("First Change"),
Contains("======="),
).
PressPrimaryAction()
t.Common().ContinueOnConflictsResolved()
},
})