summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-02-26 11:49:15 +1100
committerJesse Duffield <jessedduffield@gmail.com>2023-02-26 12:54:13 +1100
commitf7e8b2dd7194ef32f6644481c974602bd8059c9c (patch)
tree492a01ffb1367311bec75099cb21e5383e6ced0f /pkg/integration/tests
parent8b5d59c2380c9d4c78d148d8ee0cecdfa556f1f5 (diff)
cleanup integration test code
Diffstat (limited to 'pkg/integration/tests')
-rw-r--r--pkg/integration/tests/bisect/basic.go4
-rw-r--r--pkg/integration/tests/branch/rebase.go4
-rw-r--r--pkg/integration/tests/branch/rebase_and_drop.go4
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go4
-rw-r--r--pkg/integration/tests/conflicts/resolve_externally.go2
-rw-r--r--pkg/integration/tests/conflicts/resolve_multiple_files.go2
-rw-r--r--pkg/integration/tests/file/discard_changes.go2
-rw-r--r--pkg/integration/tests/filter_by_path/select_file.go37
-rw-r--r--pkg/integration/tests/filter_by_path/shared.go42
-rw-r--r--pkg/integration/tests/interactive_rebase/amend_first_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/edit_first_commit.go4
-rw-r--r--pkg/integration/tests/interactive_rebase/fixup_first_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/fixup_second_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/move_in_rebase.go4
-rw-r--r--pkg/integration/tests/interactive_rebase/rebase.go6
-rw-r--r--pkg/integration/tests/interactive_rebase/reword_first_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/shared.go68
-rw-r--r--pkg/integration/tests/interactive_rebase/squash_down_first_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/squash_down_second_commit.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/squash_fixups_above_first_commit.go4
-rw-r--r--pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict.go67
-rw-r--r--pkg/integration/tests/patch_building/apply.go2
-rw-r--r--pkg/integration/tests/patch_building/apply_in_reverse.go2
-rw-r--r--pkg/integration/tests/patch_building/copy_patch_to_clipboard.go2
-rw-r--r--pkg/integration/tests/patch_building/move_to_index.go2
-rw-r--r--pkg/integration/tests/patch_building/move_to_index_partial.go4
-rw-r--r--pkg/integration/tests/patch_building/move_to_index_with_conflict.go6
-rw-r--r--pkg/integration/tests/patch_building/move_to_new_commit.go2
-rw-r--r--pkg/integration/tests/patch_building/remove_from_commit.go2
-rw-r--r--pkg/integration/tests/patch_building/specific_selection.go10
-rw-r--r--pkg/integration/tests/patch_building/start_new_patch.go2
-rw-r--r--pkg/integration/tests/staging/discard_all_changes.go4
-rw-r--r--pkg/integration/tests/staging/stage_hunks.go2
-rw-r--r--pkg/integration/tests/staging/stage_ranges.go6
-rw-r--r--pkg/integration/tests/submodule/add.go2
-rw-r--r--pkg/integration/tests/submodule/enter.go3
-rw-r--r--pkg/integration/tests/submodule/remove.go3
-rw-r--r--pkg/integration/tests/submodule/reset.go3
-rw-r--r--pkg/integration/tests/sync/force_push_multiple_upstream.go19
-rw-r--r--pkg/integration/tests/sync/pull_merge_conflict.go4
-rw-r--r--pkg/integration/tests/sync/pull_rebase_conflict.go4
-rw-r--r--pkg/integration/tests/sync/pull_rebase_interactive_conflict.go4
-rw-r--r--pkg/integration/tests/sync/pull_rebase_interactive_conflict_drop.go4
-rw-r--r--pkg/integration/tests/sync/push.go25
-rw-r--r--pkg/integration/tests/sync/push_with_credential_prompt.go3
-rw-r--r--pkg/integration/tests/sync/shared.go49
-rw-r--r--pkg/integration/tests/test_list.go (renamed from pkg/integration/tests/tests_gen.go)0
-rw-r--r--pkg/integration/tests/test_list_generator.go (renamed from pkg/integration/tests/tests_generator.go)6
-rw-r--r--pkg/integration/tests/tests.go15
49 files changed, 236 insertions, 220 deletions
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go
index ca06d5fa5..68009ca98 100644
--- a/pkg/integration/tests/bisect/basic.go
+++ b/pkg/integration/tests/bisect/basic.go
@@ -32,14 +32,14 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Commits().
Focus().
SelectedLine(Contains("commit 10")).
- NavigateToListItem(Contains("commit 09")).
+ NavigateToLine(Contains("commit 09")).
Tap(func() {
markCommitAsBad()
t.Views().Information().Content(Contains("bisecting"))
}).
SelectedLine(Contains("<-- bad")).
- NavigateToListItem(Contains("commit 02")).
+ NavigateToLine(Contains("commit 02")).
Tap(markCommitAsGood).
// lazygit will land us in the commit between our good and bad commits.
SelectedLine(Contains("commit 05").Contains("<-- current")).
diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go
index 211dca839..07b9037a3 100644
--- a/pkg/integration/tests/branch/rebase.go
+++ b/pkg/integration/tests/branch/rebase.go
@@ -35,7 +35,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")).
Confirm()
- t.Actions().AcknowledgeConflicts()
+ t.Common().AcknowledgeConflicts()
t.Views().Files().
IsFocused().
@@ -48,7 +48,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Information().Content(Contains("rebasing"))
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
t.Views().Information().Content(DoesNotContain("rebasing"))
diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go
index 04c2246ab..298636c59 100644
--- a/pkg/integration/tests/branch/rebase_and_drop.go
+++ b/pkg/integration/tests/branch/rebase_and_drop.go
@@ -43,7 +43,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Information().Content(Contains("rebasing"))
- t.Actions().AcknowledgeConflicts()
+ t.Common().AcknowledgeConflicts()
t.Views().Files().IsFocused().
SelectedLine(MatchesRegexp("UU.*file"))
@@ -75,7 +75,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
IsFocused().
PressPrimaryAction()
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
t.Views().Information().Content(DoesNotContain("rebasing"))
diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
index 3e82de065..a0030c2f9 100644
--- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
+++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
@@ -52,7 +52,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
Confirm()
- t.Actions().AcknowledgeConflicts()
+ t.Common().AcknowledgeConflicts()
t.Views().Files().
IsFocused().
@@ -65,7 +65,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
SelectNextItem().
PressPrimaryAction()
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
t.Views().Files().IsEmpty()
diff --git a/pkg/integration/tests/conflicts/resolve_externally.go b/pkg/integration/tests/conflicts/resolve_externally.go
index 385e9ce4a..dec4ab7e2 100644
--- a/pkg/integration/tests/conflicts/resolve_externally.go
+++ b/pkg/integration/tests/conflicts/resolve_externally.go
@@ -25,7 +25,7 @@ var ResolveExternally = NewIntegrationTest(NewIntegrationTestArgs{
}).
Press(keys.Universal.Refresh)
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
t.Views().Files().
IsEmpty()
diff --git a/pkg/integration/tests/conflicts/resolve_multiple_files.go b/pkg/integration/tests/conflicts/resolve_multiple_files.go
index 2be35148e..f32743bef 100644
--- a/pkg/integration/tests/conflicts/resolve_multiple_files.go
+++ b/pkg/integration/tests/conflicts/resolve_multiple_files.go
@@ -49,6 +49,6 @@ var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{
).
PressPrimaryAction()
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
},
})
diff --git a/pkg/integration/tests/file/discard_changes.go b/pkg/integration/tests/file/discard_changes.go
index 7a05f4466..2c5d2b2ea 100644
--- a/pkg/integration/tests/file/discard_changes.go
+++ b/pkg/integration/tests/file/discard_changes.go
@@ -99,7 +99,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
{status: "DU", label: "deleted-us.txt", menuTitle: "deleted-us.txt"},
})
- t.Actions().ContinueOnConflictsResolved()
+ t.Common().ContinueOnConflictsResolved()
discardOneByOne([]statusFile{
{status: "MD", label: "change-delete.txt", menuTitle: "change-delete.txt"},
diff --git a/pkg/integration/tests/filter_by_path/select_file.go b/pkg/integration/tests/filter_by_path/select_file.go
index 6722958dd..6c1243dc8 100644
--- a/pkg/integration/tests/filter_by_path/select_file.go
+++ b/pkg/integration/tests/filter_by_path/select_file.go
@@ -37,40 +37,3 @@ var SelectFile = NewIntegrationTest(NewIntegrationTestArgs{
postFilterTest(t)
},
})
-
-func commonSetup(shell *Shell) {
- shell.CreateFileAndAdd("filterFile", "original filterFile content")
- shell.CreateFileAndAdd("otherFile", "original otherFile content")
- shell.Commit("both files")
-
- shell.UpdateFileAndAdd("otherFile", "new otherFile content")
- shell.Commit("only otherFile")
-
- shell.UpdateFileAndAdd("filterFile", "new filterFile content")
- shell.Commit("only filterFile")
-}
-
-func postFilterTest(t *TestDriver) {
- t.Views().Information().Content(Contains("filtering by 'filterFile'"))
-
- t.Views().Commits().
- IsFocused().
- Lines(
- Contains(`only filterFile`).IsSelected(),
- Contains(`both files`),
- ).
- SelectNextItem().
- PressEnter()
-
- // we only show the filtered file's changes in the main view
- t.Views().Main().
- Content(Contains("filterFile").DoesNotContain("otherFile"))
-
- // when you click into the commit itself, you see all files from that commit
- t.Views().CommitFiles().
- IsFocused().
- Lines(
- Contains(`filterFile`),
- Contains(`otherFile`),
- )
-}
diff --git a/pkg/integration/tests/filter_by_path/shared.go b/pkg/integration/tests/filter_by_path/shared.go
new file mode 100644
index 000000000..93e5e0a3d
--- /dev/null
+++ b/pkg/integration/tests/filter_by_path/shared.go
@@ -0,0 +1,42 @@
+package filter_by_path
+
+import (
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+func commonSetup(shell *Shell) {
+ shell.CreateFileAndAdd("filterFile", "original filterFile content")
+ shell.CreateFileAndAdd("otherFile", "original otherFile content")
+ shell.Commit("both files")
+
+ shell.UpdateFileAndAdd("otherFile", "new otherFile content")
+ shell.Commit("only otherFile")
+
+ shell.UpdateFileAndAdd("filterFile", "new filterFile content")
+ shell.Commit("only filterFile")
+}
+
+func postFilterTest(t *TestDriver) {
+ t.Views().Information().Content(Contains("filtering by 'filterFile'"))
+
+ t.Views().Commits().
+ IsFocused().
+ Lines(
+ Contains(`only filterFile`).IsSelected(),
+ Contains(`both files`),
+ ).
+ SelectNextItem().
+ PressEnter()
+
+ // we only show the filtered file's changes in the main view
+ t.Views().Main().
+ Content(Contains("filterFile").DoesNotContain("otherFile"))
+
+ // when you click into the commit itself, you see all files from that commit
+ t.Views().CommitFiles().
+ IsFocused().
+ Lines(
+ Contains(`filterFile`),
+ Contains(`otherFile`),
+ )
+}
diff --git a/pkg/integration/tests/interactive_rebase/amend_first_commit.go b/pkg/integration/tests/interactive_rebase/amend_first_commit.go
index d03a880b9..483153e15 100644
--- a/pkg/integration/tests/interactive_rebase/amend_first_commit.go
+++ b/pkg/integration/tests/interactive_rebase/amend_first_commit.go
@@ -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().
diff --git a/pkg/integration/tests/interactive_rebase/edit_first_commit.go b/pkg/integration/tests/interactive_rebase/edit_first_commit.go
index def3b7fca..abf3f2be0 100644
--- a/pkg/integration/tests/interactive_rebase/edit_first_commit.go
+++ b/pkg/integration/tests/interactive_rebase/edit_first_commit.go
@@ -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"),
diff --git a/pkg/integration/tests/interactive_rebase/fixup_first_commit.go b/pkg/integration/tests/interactive_rebase/fixup_first_commit.go
index fe339f3e2..7f66c24de 100644
--- a/pkg/integration/tests/interactive_rebase/fixup_first_commit.go
+++ b/pkg/integration/tests/interactive_rebase/fixup_first_commit.go
@@ -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().
diff --git a/pkg/integration/tests/interactive_rebase/fixup_second_commit.go b/pkg/integration/tests/interactive_rebase/fixup_second_commit.go
index 007eba84f..8dc97b096 100644
--- a/pkg/integration/tests/interactive_rebase/fixup_second_commit.go
+++ b/pkg/integration/tests/interactive_rebase/fixup_second_commit.go
@@ -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().
diff --git a/pkg/integration/tests/interactive_rebase/move_in_rebase.go b/pkg/integration/tests/interactive_rebase/move_in_rebase.go
index daeedbf87..160a2c823 100644
--- a/pkg/integration/tests/interactive_rebase/move_in_rebase.go
+++ b/pkg/integration/tests/interactive_rebase/move_in_rebase.go
@@ -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"),
diff --git a/pkg/integration/tests/interactive_rebase/rebase.go b/pkg/integration/tests/interactive_rebase/rebase.go
index 3951d7826..95fd185cb 100644
--- a/pkg/integration/tests/interactive_rebase/rebase.go
+++ b/pkg/integration/tests/interactive_rebase/rebase.go
@@ -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(),
diff --git a/pkg/integration/tests/interactive_rebase/reword_first_commit.go b/pkg/integration/tests/interactive_rebase/reword_first_commit.go
index d4835fcd8..c85293cec 100644
--- a/pkg/integration/tests/interactive_rebase/reword_first_commit.go
+++ b/pkg/integration/tests/interactive_rebase/reword_first_commit.go
@@ -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().
diff --git a/pkg/integration/tests/interactive_rebase/shared.go b/pkg/integration/tests/interactive_rebase/shared.go
new file mode 100644
index 000000000..db45f42e3
--- /dev/null
+++ b/pkg/integration/tests/interactive_rebase/shared.go
@@ -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"))
+ })
+}
diff --git a/pkg/integration/tests/interactive_rebase/squash_down_first_commit.go b/pkg/integration/tests/interactive_rebase/squash_down_first_commit.go
index 0ec334a6c..7d6182081 100644
--- a/pkg/integration/tests/interactive_rebase/squash_down_first_commit.go
+++ b/pkg/integration/tests/interactive_rebase/squash_down_first_commit.go
@@ -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().
diff --git a/pkg/integration/tests/interactive_rebase/squash_down_second_commit.go b/pkg/integration/tests/interactive_rebase/squash_down_second_commit.go
index ffa54584f..385145743 100644
--- a/pkg/integration/tests/interactive_rebase/squash_down_second_commit.go
+++ b/