|
| 1 | +package interactive_rebase |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var RewordMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Rewords a merge commit which is not the current head commit", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + SetupConfig: func(config *config.AppConfig) {}, |
| 13 | + SetupRepo: func(shell *Shell) { |
| 14 | + shell. |
| 15 | + EmptyCommit("base"). |
| 16 | + NewBranch("first-branch"). |
| 17 | + CreateFileAndAdd("file1.txt", "content"). |
| 18 | + Commit("one"). |
| 19 | + Checkout("master"). |
| 20 | + Merge("first-branch"). |
| 21 | + NewBranch("second-branch"). |
| 22 | + EmptyCommit("two") |
| 23 | + }, |
| 24 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 25 | + t.Views().Commits(). |
| 26 | + Focus(). |
| 27 | + Lines( |
| 28 | + Contains("CI ◯ two").IsSelected(), |
| 29 | + Contains("CI ⏣─╮ Merge branch 'first-branch'"), |
| 30 | + Contains("CI │ ◯ one"), |
| 31 | + Contains("CI ◯─╯ base"), |
| 32 | + ). |
| 33 | + SelectNextItem(). |
| 34 | + Press(keys.Commits.RenameCommit). |
| 35 | + Tap(func() { |
| 36 | + t.ExpectPopup().CommitMessagePanel(). |
| 37 | + Title(Equals("Reword commit")). |
| 38 | + InitialText(Equals("Merge branch 'first-branch'")). |
| 39 | + Clear(). |
| 40 | + Type("renamed merge"). |
| 41 | + Confirm() |
| 42 | + }). |
| 43 | + /* EXPECTED: |
| 44 | + Lines( |
| 45 | + Contains("CI ◯ two"), |
| 46 | + Contains("CI ⏣─╮ renamed merge").IsSelected(), |
| 47 | + Contains("CI │ ◯ one"), |
| 48 | + Contains("CI ◯ ╯ base"), |
| 49 | + ) |
| 50 | + ACTUAL: */ |
| 51 | + Tap(func() { |
| 52 | + t.ExpectPopup().Alert().Title(Equals("Error")). |
| 53 | + Content(Contains("error: 'edit' does not accept merge commits")) |
| 54 | + }) |
| 55 | + }, |
| 56 | +}) |
0 commit comments