mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-27 22:38:09 +02:00
add tag tests
This commit is contained in:
@@ -985,7 +985,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
LcTagCommit: "tag commit",
|
LcTagCommit: "tag commit",
|
||||||
TagMenuTitle: "Create tag",
|
TagMenuTitle: "Create tag",
|
||||||
TagNameTitle: "Tag name:",
|
TagNameTitle: "Tag name:",
|
||||||
TagMessageTitle: "Tag message: ",
|
TagMessageTitle: "Tag message:",
|
||||||
LcAnnotatedTag: "annotated tag",
|
LcAnnotatedTag: "annotated tag",
|
||||||
LcLightweightTag: "lightweight tag",
|
LcLightweightTag: "lightweight tag",
|
||||||
LcDeleteTag: "delete tag",
|
LcDeleteTag: "delete tag",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
|
|
||||||
t.ExpectPopup().Menu().
|
t.ExpectPopup().Menu().
|
||||||
Title(Equals("Create tag")).
|
Title(Equals("Create tag")).
|
||||||
|
Select(Contains("lightweight")).
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
|
|||||||
49
pkg/integration/tests/tag/crud_annotated.go
Normal file
49
pkg/integration/tests/tag/crud_annotated.go
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package tag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var CrudAnnotated = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Create and delete an annotated tag in the tags panel",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.EmptyCommit("initial commit")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Tags().
|
||||||
|
Focus().
|
||||||
|
IsEmpty().
|
||||||
|
Press(keys.Universal.New).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Create tag")).
|
||||||
|
Select(Contains("annotated")).
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("Tag name:")).
|
||||||
|
Type("new-tag").
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("Tag message:")).
|
||||||
|
Type("message").
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
Lines(
|
||||||
|
MatchesRegexp(`new-tag.*message`).IsSelected(),
|
||||||
|
).
|
||||||
|
Press(keys.Universal.Remove).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("Delete tag")).
|
||||||
|
Content(Equals("Are you sure you want to delete tag 'new-tag'?")).
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
IsEmpty()
|
||||||
|
},
|
||||||
|
})
|
||||||
53
pkg/integration/tests/tag/crud_lightweight.go
Normal file
53
pkg/integration/tests/tag/crud_lightweight.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package tag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var CrudLightweight = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Create and delete a lightweight tag in the tags panel",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.EmptyCommit("initial commit")
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Tags().
|
||||||
|
Focus().
|
||||||
|
IsEmpty().
|
||||||
|
Press(keys.Universal.New).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Menu().
|
||||||
|
Title(Equals("Create tag")).
|
||||||
|
Select(Contains("lightweight")).
|
||||||
|
Confirm()
|
||||||
|
|
||||||
|
t.ExpectPopup().Prompt().
|
||||||
|
Title(Equals("Tag name:")).
|
||||||
|
Type("new-tag").
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
Lines(
|
||||||
|
MatchesRegexp(`new-tag.*initial commit`).IsSelected(),
|
||||||
|
).
|
||||||
|
PressEnter().
|
||||||
|
Tap(func() {
|
||||||
|
// view the commits of the tag
|
||||||
|
t.Views().SubCommits().IsFocused().
|
||||||
|
Lines(
|
||||||
|
Contains("initial commit"),
|
||||||
|
).
|
||||||
|
PressEscape()
|
||||||
|
}).
|
||||||
|
Press(keys.Universal.Remove).
|
||||||
|
Tap(func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("Delete tag")).
|
||||||
|
Content(Equals("Are you sure you want to delete tag 'new-tag'?")).
|
||||||
|
Confirm()
|
||||||
|
}).
|
||||||
|
IsEmpty()
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
|
||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
|
||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/tag"
|
||||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/undo"
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/undo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -85,6 +86,8 @@ var tests = []*components.IntegrationTest{
|
|||||||
sync.Pull,
|
sync.Pull,
|
||||||
sync.PullAndSetUpstream,
|
sync.PullAndSetUpstream,
|
||||||
sync.RenameBranchAndPull,
|
sync.RenameBranchAndPull,
|
||||||
|
tag.CrudAnnotated,
|
||||||
|
tag.CrudLightweight,
|
||||||
undo.UndoCheckoutAndDrop,
|
undo.UndoCheckoutAndDrop,
|
||||||
undo.UndoDrop,
|
undo.UndoDrop,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user