Repository: jesseduffield/lazygit
File: pkg/integration/tests/interactive_rebase/fixup_keep_message_rebase.go (Go)

Code before:
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Focus().
			Lines(
				Contains("Third Commit"),
				Contains("Second Commit"),
				Contains("First Commit"),
			).
			// Start interactive rebase from the first commit
			NavigateToLine(Contains("First Commit")).
			Press(keys.Universal.Edit).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick").Contains("Third Commit"),
				Contains("pick").Contains("Second Commit"),
				Contains("--- Commits ---"),
				Contains("First Commit").IsSelected(),
			).
			// Mark second commit as fixup
			NavigateToLine(Contains("Second Commit")).
			Press(keys.Commits.MarkCommitAsFixup).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick").Contains("Third Commit"),
				Contains("fixup").Contains("Second Commit").IsSelected(),
				Contains("--- Commits ---"),
				Contains("First Commit"),
			).
			// Now set the -C flag using the SetFixupMessage keybinding
			Press(keys.Commits.SetFixupMessage).
			Tap(func() {
				t.ExpectPopup().Menu().
					Title(Equals("Set fixup message")).
					Select(Contains("use this commit's message")).
					Confirm()
			}).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick").Contains("Third Commit"),
				Contains("fixup -C").Contains("Second Commit").IsSelected(),
				Contains("--- Commits ---"),
				Contains("First Commit"),
			).
			// Continue the rebase
			Tap(func() {
				t.Common().ContinueRebase()
			}).
			Lines(
				Contains("Third Commit"),
				Contains("Second Commit").IsSelected(),

Review comment (suggestion):
I usually prefer matching larger parts of a line instead of multiple Contains, mainly because it's more robust (you'd need a `DoesNotContain("-C")` in your version), but also because I find it easier to read.

Fixed in 897e01b6046f.

Code after:
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Focus().
			Lines(
				Contains("Third Commit"),
				Contains("Second Commit"),
				Contains("First Commit"),
			).
			// Start interactive rebase from the first commit
			NavigateToLine(Contains("First Commit")).
			Press(keys.Universal.Edit).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick CI Third Commit"),
				Contains("pick CI Second Commit"),
				Contains("--- Commits ---"),
				Contains("First Commit").IsSelected(),
			).
			// Mark second commit as fixup
			NavigateToLine(Contains("Second Commit")).
			Press(keys.Commits.MarkCommitAsFixup).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick  CI Third Commit"),
				Contains("fixup CI Second Commit").IsSelected(),
				Contains("--- Commits ---"),
				Contains("First Commit"),
			).
			// Now set the -C flag using the SetFixupMessage keybinding
			Press(keys.Commits.SetFixupMessage).
			Tap(func() {
				t.ExpectPopup().Menu().
					Title(Equals("Set fixup message")).
					Select(Contains("use this commit's message")).
					Confirm()
			}).
			Lines(
				Contains("--- Pending rebase todos ---"),
				Contains("pick     CI Third Commit"),
				Contains("fixup -C CI Second Commit").IsSelected(),
				Contains("--- Commits ---"),
				Contains("First Commit"),
			).
			// Continue the rebase
			Tap(func() {
				t.Common().ContinueRebase()
			}).
			Lines(
				Contains("Third Commit"),
				Contains("Second Commit").IsSelected(),