1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

test: add an integration test for creating tag on branches

This commit is contained in:
Ryooooooga
2023-02-08 23:11:40 +09:00
parent 67b08ac239
commit 36c2b00336
3 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a new tag on branch",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateNCommits(10).
NewBranch("new-branch").
EmptyCommit("new commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
MatchesRegexp(`\*\s*new-branch`).IsSelected(),
MatchesRegexp(`master`),
).
SelectNextItem().
Press(keys.Branches.CreateTag)
t.ExpectPopup().Menu().
Title(Equals("Create tag")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Tag name:")).
Type("new-tag").
Confirm()
t.Views().Tags().
Lines(
MatchesRegexp(`new-tag`).IsSelected(),
)
t.Git().
TagNamesAt("HEAD", []string{}).
TagNamesAt("master", []string{"new-tag"})
},
})