|
| 1 | +package bisect |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var Skip = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Start a git bisect and skip a few commits (selected or current)", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + SetupRepo: func(shell *Shell) { |
| 13 | + shell. |
| 14 | + CreateNCommits(10) |
| 15 | + }, |
| 16 | + SetupConfig: func(cfg *config.AppConfig) {}, |
| 17 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 18 | + t.Views().Commits(). |
| 19 | + Focus(). |
| 20 | + SelectedLine(Contains("commit 10")). |
| 21 | + Press(keys.Commits.ViewBisectOptions). |
| 22 | + Tap(func() { |
| 23 | + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as bad`)).Confirm() |
| 24 | + }). |
| 25 | + NavigateToLine(Contains("commit 01")). |
| 26 | + Press(keys.Commits.ViewBisectOptions). |
| 27 | + Tap(func() { |
| 28 | + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm() |
| 29 | + t.Views().Information().Content(Contains("Bisecting")) |
| 30 | + }). |
| 31 | + Lines( |
| 32 | + Contains("CI commit 10").Contains("<-- bad"), |
| 33 | + Contains("CI commit 09").DoesNotContain("<--"), |
| 34 | + Contains("CI commit 08").DoesNotContain("<--"), |
| 35 | + Contains("CI commit 07").DoesNotContain("<--"), |
| 36 | + Contains("CI commit 06").DoesNotContain("<--"), |
| 37 | + Contains("CI commit 05").Contains("<-- current").IsSelected(), |
| 38 | + Contains("CI commit 04").DoesNotContain("<--"), |
| 39 | + Contains("CI commit 03").DoesNotContain("<--"), |
| 40 | + Contains("CI commit 02").DoesNotContain("<--"), |
| 41 | + Contains("CI commit 01").Contains("<-- good"), |
| 42 | + ). |
| 43 | + Press(keys.Commits.ViewBisectOptions). |
| 44 | + Tap(func() { |
| 45 | + t.ExpectPopup().Menu().Title(Equals("Bisect")). |
| 46 | + // Does not show a "Skip selected commit" entry: |
| 47 | + Lines( |
| 48 | + Contains("b Mark current commit").Contains("as bad"), |
| 49 | + Contains("g Mark current commit").Contains("as good"), |
| 50 | + Contains("s Skip current commit"), |
| 51 | + Contains("r Reset bisect"), |
| 52 | + Contains("Cancel"), |
| 53 | + ). |
| 54 | + Select(Contains("Skip current commit")).Confirm() |
| 55 | + }). |
| 56 | + // Skipping the current commit selects the new current commit: |
| 57 | + Lines( |
| 58 | + Contains("CI commit 10").Contains("<-- bad"), |
| 59 | + Contains("CI commit 09").DoesNotContain("<--"), |
| 60 | + Contains("CI commit 08").DoesNotContain("<--"), |
| 61 | + Contains("CI commit 07").DoesNotContain("<--"), |
| 62 | + Contains("CI commit 06").Contains("<-- current").IsSelected(), |
| 63 | + Contains("CI commit 05").Contains("<-- skipped"), |
| 64 | + Contains("CI commit 04").DoesNotContain("<--"), |
| 65 | + Contains("CI commit 03").DoesNotContain("<--"), |
| 66 | + Contains("CI commit 02").DoesNotContain("<--"), |
| 67 | + Contains("CI commit 01").Contains("<-- good"), |
| 68 | + ). |
| 69 | + NavigateToLine(Contains("commit 07")). |
| 70 | + Press(keys.Commits.ViewBisectOptions). |
| 71 | + Tap(func() { |
| 72 | + t.ExpectPopup().Menu().Title(Equals("Bisect")). |
| 73 | + // Does show a "Skip selected commit" entry: |
| 74 | + Lines( |
| 75 | + Contains("b Mark current commit").Contains("as bad"), |
| 76 | + Contains("g Mark current commit").Contains("as good"), |
| 77 | + Contains("s Skip current commit"), |
| 78 | + Contains("S Skip selected commit"), |
| 79 | + Contains("r Reset bisect"), |
| 80 | + Contains("Cancel"), |
| 81 | + ). |
| 82 | + Select(Contains("Skip selected commit")).Confirm() |
| 83 | + }). |
| 84 | + // Skipping a selected, non-current commit keeps the selection |
| 85 | + // there: |
| 86 | + SelectedLine(Contains("CI commit 07").Contains("<-- skipped")) |
| 87 | + }, |
| 88 | +}) |
0 commit comments