summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/staging/diff_change_screen_mode.go
blob: b42439cc8c5599e95e448d7dd5d4db56d2644628 (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
package staging

import (
	"github.com/jesseduffield/lazygit/pkg/config"
	. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var DiffChangeScreenMode = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Change the staged changes screen mode",
	ExtraCmdArgs: []string{},
	Skip:         false,
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shell.CreateFile("file", "first line\nsecond line")
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Files().
			Focus().
			PressEnter()

		t.Views().Staging().
			IsFocused().
			PressPrimaryAction().
			Title(Equals("Unstaged changes")).
			Content(Contains("+second line").DoesNotContain("+first line")).
			PressTab()

		t.Views().StagingSecondary().
			IsFocused().
			Title(Equals("Staged changes")).
			Content(Contains("+first line").DoesNotContain("+second line")).
			Press(keys.Universal.NextScreenMode).
			Tap(func() {
				t.Views().AppStatus().
					IsInvisible()
				t.Views().Staging().
					IsVisible()
			}).
			Press(keys.Universal.NextScreenMode).
			Tap(func() {
				t.Views().AppStatus().
					IsInvisible()
				t.Views().Staging().
					IsInvisible()
			})
	},
})