2023-02-12 09:53:57 +11:00
|
|
|
package submodule
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Add = NewIntegrationTest(NewIntegrationTestArgs{
|
|
|
|
Description: "Add a submodule",
|
2023-05-21 17:00:29 +10:00
|
|
|
ExtraCmdArgs: []string{},
|
2023-02-12 09:53:57 +11:00
|
|
|
Skip: false,
|
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.EmptyCommit("first commit")
|
2023-02-26 11:49:15 +11:00
|
|
|
shell.Clone("other_repo")
|
2023-02-12 09:53:57 +11:00
|
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
|
|
t.Views().Submodules().Focus().
|
|
|
|
Press(keys.Universal.New).
|
|
|
|
Tap(func() {
|
|
|
|
t.ExpectPopup().Prompt().
|
2023-05-25 21:11:51 +10:00
|
|
|
Title(Equals("New submodule URL:")).
|
2023-02-12 09:53:57 +11:00
|
|
|
Type("../other_repo").Confirm()
|
|
|
|
|
|
|
|
t.ExpectPopup().Prompt().
|
2023-05-25 21:11:51 +10:00
|
|
|
Title(Equals("New submodule name:")).
|
2023-02-12 09:53:57 +11:00
|
|
|
InitialText(Equals("other_repo")).
|
|
|
|
Clear().Type("my_submodule").Confirm()
|
|
|
|
|
|
|
|
t.ExpectPopup().Prompt().
|
2023-05-25 21:11:51 +10:00
|
|
|
Title(Equals("New submodule path:")).
|
2023-02-12 09:53:57 +11:00
|
|
|
InitialText(Equals("my_submodule")).
|
|
|
|
Clear().Type("my_submodule_path").Confirm()
|
|
|
|
}).
|
|
|
|
Lines(
|
|
|
|
Contains("my_submodule").IsSelected(),
|
|
|
|
)
|
|
|
|
|
|
|
|
t.Views().Main().TopLines(
|
|
|
|
Contains("Name: my_submodule"),
|
|
|
|
Contains("Path: my_submodule_path"),
|
|
|
|
Contains("Url: ../other_repo"),
|
|
|
|
)
|
|
|
|
|
|
|
|
t.Views().Files().Focus().
|
|
|
|
Lines(
|
|
|
|
Contains(".gitmodules").IsSelected(),
|
|
|
|
Contains("my_submodule_path (submodule)"),
|
|
|
|
).
|
|
|
|
Tap(func() {
|
|
|
|
t.Views().Main().Content(
|
|
|
|
Contains("[submodule \"my_submodule\"]").
|
|
|
|
Contains("path = my_submodule_path").
|
|
|
|
Contains("url = ../other_repo"),
|
|
|
|
)
|
|
|
|
}).
|
|
|
|
SelectNextItem().
|
|
|
|
Tap(func() {
|
|
|
|
t.Views().Main().Content(
|
|
|
|
Contains("Submodule my_submodule_path").
|
|
|
|
Contains("(new submodule)"),
|
|
|
|
)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|