summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/branch/create_tag.go
blob: 68f91ec1b1cf304fa6a850ec25ebdb1d72b0054a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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: []string{},
	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")).
			Select(Contains("Lightweight")).
			Confirm()

		t.ExpectPopup().Prompt().
			Title(Equals("Tag name:")).
			Type("new-tag").
			Confirm()

		t.Views().Tags().Focus().
			Lines(
				MatchesRegexp(`new-tag`).IsSelected(),
			)

		t.Git().
			TagNamesAt("HEAD", []string{}).
			TagNamesAt("master", []string{"new-tag"})
	},
})