bisect

package
v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Start a git bisect to find a bad commit",
	ExtraCmdArgs: "",
	Skip:         false,
	SetupRepo: func(shell *Shell) {
		shell.
			CreateNCommits(10)
	},
	SetupConfig: func(cfg *config.AppConfig) {},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		markCommitAsBad := func() {
			t.Views().Commits().
				Press(keys.Commits.ViewBisectOptions)

			t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as bad`)).Confirm()
		}

		markCommitAsGood := func() {
			t.Views().Commits().
				Press(keys.Commits.ViewBisectOptions)

			t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
		}

		t.Views().Commits().
			Focus().
			SelectedLine(Contains("commit 10")).
			NavigateToListItem(Contains("commit 09")).
			Tap(func() {
				markCommitAsBad()

				t.Views().Information().Content(Contains("bisecting"))
			}).
			SelectedLine(Contains("<-- bad")).
			NavigateToListItem(Contains("commit 02")).
			Tap(markCommitAsGood).
			SelectedLine(Contains("commit 05").Contains("<-- current")).
			Tap(markCommitAsBad).
			SelectedLine(Contains("commit 04").Contains("<-- current")).
			Tap(func() {
				markCommitAsGood()

				t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
			}).
			IsFocused().
			Content(Contains("commit 04"))

		t.Views().Information().Content(DoesNotContain("bisecting"))
	},
})
View Source
var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Opening lazygit when bisect has been started from another branch. There's an issue where we don't reselect the current branch if we mark the current branch as bad so this test side-steps that problem",
	ExtraCmdArgs: "",
	Skip:         false,
	SetupRepo: func(shell *Shell) {
		shell.
			EmptyCommit("only commit on master").
			NewBranch("other").
			CreateNCommits(10).
			Checkout("master").
			RunCommand("git bisect start other~2 other~5")
	},
	SetupConfig: func(cfg *config.AppConfig) {},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Information().Content(Contains("bisecting"))

		t.Views().Commits().
			Focus().
			TopLines(
				MatchesRegexp(`<-- bad.*commit 08`),
				MatchesRegexp(`<-- current.*commit 07`),
				MatchesRegexp(`\?.*commit 06`),
				MatchesRegexp(`<-- good.*commit 05`),
			).
			SelectNextItem().
			Press(keys.Commits.ViewBisectOptions).
			Tap(func() {
				t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()

				t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm()

				t.Views().Information().Content(DoesNotContain("bisecting"))
			}).
			Lines(
				Contains("only commit on master"),
			)
	},
})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL