mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24: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.
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package submodule
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var RemoveNested = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Remove a nested submodule",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
setupNestedSubmodules(shell)
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
gitDirSubmodulePath, _ := filepath.Abs(".git/modules/outerSubName/modules/innerSubName")
|
|
t.FileSystem().PathPresent(gitDirSubmodulePath)
|
|
|
|
t.Views().Submodules().Focus().
|
|
Lines(
|
|
Equals("outerSubName").IsSelected(),
|
|
Equals(" - innerSubName"),
|
|
).
|
|
SelectNextItem().
|
|
Press(keys.Universal.Remove).
|
|
Tap(func() {
|
|
t.ExpectPopup().Confirmation().
|
|
Title(Equals("Remove submodule")).
|
|
Content(Equals("Are you sure you want to remove submodule 'outerSubName/innerSubName' and its corresponding directory? This is irreversible.")).
|
|
Confirm()
|
|
}).
|
|
Lines(
|
|
Equals("outerSubName").IsSelected(),
|
|
).
|
|
Press(keys.Universal.GoInto)
|
|
|
|
t.Views().Files().IsFocused().
|
|
Lines(
|
|
Equals("▼ modules").IsSelected(),
|
|
Equals(" D innerSubPath"),
|
|
Equals("M .gitmodules"),
|
|
).
|
|
NavigateToLine(Contains(".gitmodules"))
|
|
|
|
t.Views().Main().Content(
|
|
Contains("-[submodule \"innerSubName\"]").
|
|
Contains("- path = modules/innerSubPath").
|
|
Contains("- url = ../innerSubmodule"),
|
|
)
|
|
|
|
t.FileSystem().PathNotPresent(gitDirSubmodulePath)
|
|
},
|
|
})
|