mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
cleanup integration test code
This commit is contained in:
@ -22,7 +22,7 @@ var AmendFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.AmendToCommit).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
|
@ -21,14 +21,14 @@ var EditFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
Contains("commit 02"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 01").IsSelected(),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Actions().ContinueRebase()
|
||||
t.Common().ContinueRebase()
|
||||
}).
|
||||
Lines(
|
||||
Contains("commit 02"),
|
||||
|
@ -21,7 +21,7 @@ var FixupFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.MarkCommitAsFixup).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Alert().
|
||||
|
@ -22,7 +22,7 @@ var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 02")).
|
||||
NavigateToLine(Contains("commit 02")).
|
||||
Press(keys.Commits.MarkCommitAsFixup).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
|
@ -22,7 +22,7 @@ var MoveInRebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
Contains("commit 04"),
|
||||
@ -84,7 +84,7 @@ var MoveInRebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("YOU ARE HERE").Contains("commit 01"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Actions().ContinueRebase()
|
||||
t.Common().ContinueRebase()
|
||||
}).
|
||||
Lines(
|
||||
Contains("commit 04"),
|
||||
|
@ -31,7 +31,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("first commit to edit"),
|
||||
Contains("initial commit"),
|
||||
).
|
||||
NavigateToListItem(Contains("first commit to edit")).
|
||||
NavigateToLine(Contains("first commit to edit")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
MatchesRegexp("pick.*commit to fixup"),
|
||||
@ -82,7 +82,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("initial commit"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Actions().ContinueRebase()
|
||||
t.Common().ContinueRebase()
|
||||
}).
|
||||
Lines(
|
||||
MatchesRegexp("fixup.*commit to fixup").IsSelected(),
|
||||
@ -92,7 +92,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("initial commit"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Actions().ContinueRebase()
|
||||
t.Common().ContinueRebase()
|
||||
}).
|
||||
Lines(
|
||||
Contains("second commit to edit").IsSelected(),
|
||||
|
@ -24,7 +24,7 @@ var RewordFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.RenameCommit).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Prompt().
|
||||
|
68
pkg/integration/tests/interactive_rebase/shared.go
Normal file
68
pkg/integration/tests/interactive_rebase/shared.go
Normal file
@ -0,0 +1,68 @@
|
||||
package interactive_rebase
|
||||
|
||||
import (
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
func handleConflictsFromSwap(t *TestDriver) {
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("UU myfile"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().MergeConflicts().
|
||||
IsFocused().
|
||||
TopLines(
|
||||
Contains("<<<<<<< HEAD"),
|
||||
Contains("one"),
|
||||
Contains("======="),
|
||||
Contains("three"),
|
||||
Contains(">>>>>>>"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // pick "three"
|
||||
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("UU myfile"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().MergeConflicts().
|
||||
IsFocused().
|
||||
TopLines(
|
||||
Contains("<<<<<<< HEAD"),
|
||||
Contains("three"),
|
||||
Contains("======="),
|
||||
Contains("two"),
|
||||
Contains(">>>>>>>"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // pick "two"
|
||||
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit two").IsSelected(),
|
||||
Contains("commit three"),
|
||||
Contains("commit one"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Views().Main().Content(Contains("-three").Contains("+two"))
|
||||
}).
|
||||
SelectNextItem().
|
||||
Tap(func() {
|
||||
t.Views().Main().Content(Contains("-one").Contains("+three"))
|
||||
})
|
||||
}
|
@ -21,7 +21,7 @@ var SquashDownFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.SquashDown).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Alert().
|
||||
|
@ -22,7 +22,7 @@ var SquashDownSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 02")).
|
||||
NavigateToLine(Contains("commit 02")).
|
||||
Press(keys.Commits.SquashDown).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
|
@ -22,7 +22,7 @@ var SquashFixupsAboveFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.CreateFixupCommit).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
@ -30,7 +30,7 @@ var SquashFixupsAboveFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Content(Contains("Are you sure you want to create a fixup! commit for commit")).
|
||||
Confirm()
|
||||
}).
|
||||
NavigateToListItem(Contains("commit 01")).
|
||||
NavigateToLine(Contains("commit 01")).
|
||||
Press(keys.Commits.SquashAboveCommits).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
|
@ -26,7 +26,7 @@ var SwapInRebaseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("commit two"),
|
||||
Contains("commit one"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit one")).
|
||||
NavigateToLine(Contains("commit one")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
Contains("commit three"),
|
||||
@ -41,72 +41,9 @@ var SwapInRebaseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("YOU ARE HERE").Contains("commit one"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Actions().ContinueRebase()
|
||||
t.Common().ContinueRebase()
|
||||
})
|
||||
|
||||
handleConflictsFromSwap(t)
|
||||
},
|
||||
})
|
||||
|
||||
func handleConflictsFromSwap(t *TestDriver) {
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("UU myfile"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().MergeConflicts().
|
||||
IsFocused().
|
||||
TopLines(
|
||||
Contains("<<<<<<< HEAD"),
|
||||
Contains("one"),
|
||||
Contains("======="),
|
||||
Contains("three"),
|
||||
Contains(">>>>>>>"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // pick "three"
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("UU myfile"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().MergeConflicts().
|
||||
IsFocused().
|
||||
TopLines(
|
||||
Contains("<<<<<<< HEAD"),
|
||||
Contains("three"),
|
||||
Contains("======="),
|
||||
Contains("two"),
|
||||
Contains(">>>>>>>"),
|
||||
).
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // pick "two"
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit two").IsSelected(),
|
||||
Contains("commit three"),
|
||||
Contains("commit one"),
|
||||
).
|
||||
Tap(func() {
|
||||
t.Views().Main().Content(Contains("-three").Contains("+two"))
|
||||
}).
|
||||
SelectNextItem().
|
||||
Tap(func() {
|
||||
t.Views().Main().Content(Contains("-one").Contains("+three"))
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user