summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/tag/crud_lightweight.go
blob: ce5ff9e42e4b8d37791ca128dd52d6c58e0d4412 (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 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: []string{},
	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().CommitMessagePanel().
					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()
	},
})