summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/branch/rebase_does_not_autosquash.go
blob: 66ad870c4038d57ff7f61cac25d3d3dc68d867b5 (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
52
53
54
package branch

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

var RebaseDoesNotAutosquash = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Rebase a branch that has fixups onto another branch, and verify that the fixups are not squashed even if rebase.autoSquash is enabled globally.",
	ExtraCmdArgs: []string{},
	Skip:         false,
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shell.SetConfig("rebase.autoSquash", "true")

		shell.
			EmptyCommit("base").
			NewBranch("my-branch").
			Checkout("master").
			EmptyCommit("master commit").
			Checkout("my-branch").
			EmptyCommit("branch commit").
			EmptyCommit("fixup! branch commit")
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Lines(
				Contains("fixup! branch commit"),
				Contains("branch commit"),
				Contains("base"),
			)

		t.Views().Branches().
			Focus().
			Lines(
				Contains("my-branch").IsSelected(),
				Contains("master"),
			).
			SelectNextItem().
			Press(keys.Branches.RebaseBranch)

		t.ExpectPopup().Menu().
			Title(Equals("Rebase 'my-branch' onto 'master'")).
			Select(Contains("Simple rebase")).
			Confirm()

		t.Views().Commits().Lines(
			Contains("fixup! branch commit"),
			Contains("branch commit"),
			Contains("master commit"),
			Contains("base"),
		)
	},
})