1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 11:02:41 +03:00

migrate revert merge test

This commit is contained in:
Jesse Duffield
2023-02-19 14:47:07 +11:00
parent 88c76868ba
commit b5e325b0a4
43 changed files with 68 additions and 98 deletions

View File

@@ -0,0 +1,43 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var RevertMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a merge commit and chooses to revert to the parent commit",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus().
TopLines(
Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
).
Press(keys.Commits.RevertCommit)
t.ExpectPopup().Menu().
Title(Equals("Select parent commit for merge")).
Lines(
Contains("first change"),
Contains("second-change-branch unrelated change"),
Contains("cancel"),
).
Select(Contains("first change")).
Confirm()
t.Views().Commits().IsFocused().
TopLines(
Contains("Revert \"Merge branch 'second-change-branch' into first-change-branch\""),
Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
).
SelectPreviousItem()
t.Views().Main().Content(Contains("-Second Change").Contains("+First Change"))
},
})