1
0
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:
Jesse Duffield
2023-02-20 18:41:17 +11:00
parent 39c56553b3
commit 082d342bf8
5 changed files with 107 additions and 1 deletions

View File

@@ -985,7 +985,7 @@ func EnglishTranslationSet() TranslationSet {
LcTagCommit: "tag commit",
TagMenuTitle: "Create tag",
TagNameTitle: "Tag name:",
TagMessageTitle: "Tag message: ",
TagMessageTitle: "Tag message:",
LcAnnotatedTag: "annotated tag",
LcLightweightTag: "lightweight tag",
LcDeleteTag: "delete tag",

View File

@@ -28,6 +28,7 @@ var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectPopup().Menu().
Title(Equals("Create tag")).
Select(Contains("lightweight")).
Confirm()
t.ExpectPopup().Prompt().

View 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()
},
})

View 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()
},
})

View File

@@ -20,6 +20,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
"github.com/jesseduffield/lazygit/pkg/integration/tests/tag"
"github.com/jesseduffield/lazygit/pkg/integration/tests/undo"
)
@@ -85,6 +86,8 @@ var tests = []*components.IntegrationTest{
sync.Pull,
sync.PullAndSetUpstream,
sync.RenameBranchAndPull,
tag.CrudAnnotated,
tag.CrudLightweight,
undo.UndoCheckoutAndDrop,
undo.UndoDrop,
}