summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/interactive_rebase/edit_range_select_outside_rebase.go
blob: 4ff2a8c831a977dd8bbb8085771a07658db90e84 (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
49
50
51
package interactive_rebase

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

var EditRangeSelectOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Select a range of commits to edit outside of a rebase",
	ExtraCmdArgs: []string{},
	Skip:         false,
	GitVersion:   AtLeast("2.22.0"), // first version that supports the --rebase-merges option
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shared.CreateMergeCommit(shell)
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Focus().
			TopLines(
				Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
			).
			Press(keys.Universal.RangeSelectDown).
			Press(keys.Universal.RangeSelectDown).
			Press(keys.Universal.RangeSelectDown).
			Press(keys.Universal.RangeSelectDown).
			Press(keys.Universal.RangeSelectDown).
			Lines(
				Contains("CI ⏣─╮ Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
				Contains("CI │ ◯ * second-change-branch unrelated change").IsSelected(),
				Contains("CI │ ◯ second change").IsSelected(),
				Contains("CI ◯ │ first change").IsSelected(),
				Contains("CI ◯─╯ * original").IsSelected(),
				Contains("CI ◯ three").IsSelected(),
				Contains("CI ◯ two"),
				Contains("CI ◯ one"),
			).
			Press(keys.Universal.Edit).
			Lines(
				Contains("merge  CI Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
				Contains("edit   CI first change").IsSelected(),
				Contains("edit   CI * second-change-branch unrelated change").IsSelected(),
				Contains("edit   CI second change").IsSelected(),
				Contains("edit   CI * original").IsSelected(),
				Contains("       CI ◯ <-- YOU ARE HERE --- three").IsSelected(),
				Contains("       CI ◯ two"),
				Contains("       CI ◯ one"),
			)
	},
})