mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
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.
54 lines
1.3 KiB
Go
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()
|
|
},
|
|
})
|