From 4a90a2149b1937d86ecba43076b2f246f19d6635 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 20 Aug 2026 18:29:15 +0200 Subject: [PATCH] Let focused diff tests own shared staging behavior Keeping the same staging interactions covered through the explorer would pin the suite to the panel that this branch removes. The focused main view now owns line, range, hunk, navigation, search, context-size, and rapid-input coverage. Co-Authored-By: GitHub Copilot --- ...ge_partial_block_of_changes_first_lines.go | 6 +- ...age_partial_block_of_changes_last_lines.go | 6 +- ...e_partial_block_of_changes_middle_lines.go | 6 +- .../tests/staging/diff_context_change.go | 123 ------------------ pkg/integration/tests/staging/search.go | 42 ------ ...ext_line_after_staging_in_two_hunk_diff.go | 61 --------- ..._line_after_staging_isolated_added_line.go | 51 -------- pkg/integration/tests/staging/stage_hunks.go | 120 ----------------- .../stage_hunks_with_rapid_keypresses.go | 50 ------- pkg/integration/tests/staging/stage_lines.go | 122 ----------------- pkg/integration/tests/staging/stage_ranges.go | 108 --------------- pkg/integration/tests/test_list.go | 14 +- 12 files changed, 12 insertions(+), 697 deletions(-) rename pkg/integration/tests/{staging => main_view}/stage_partial_block_of_changes_first_lines.go (95%) rename pkg/integration/tests/{staging => main_view}/stage_partial_block_of_changes_last_lines.go (95%) rename pkg/integration/tests/{staging => main_view}/stage_partial_block_of_changes_middle_lines.go (96%) delete mode 100644 pkg/integration/tests/staging/diff_context_change.go delete mode 100644 pkg/integration/tests/staging/search.go delete mode 100644 pkg/integration/tests/staging/select_next_line_after_staging_in_two_hunk_diff.go delete mode 100644 pkg/integration/tests/staging/select_next_line_after_staging_isolated_added_line.go delete mode 100644 pkg/integration/tests/staging/stage_hunks.go delete mode 100644 pkg/integration/tests/staging/stage_hunks_with_rapid_keypresses.go delete mode 100644 pkg/integration/tests/staging/stage_lines.go delete mode 100644 pkg/integration/tests/staging/stage_ranges.go diff --git a/pkg/integration/tests/staging/stage_partial_block_of_changes_first_lines.go b/pkg/integration/tests/main_view/stage_partial_block_of_changes_first_lines.go similarity index 95% rename from pkg/integration/tests/staging/stage_partial_block_of_changes_first_lines.go rename to pkg/integration/tests/main_view/stage_partial_block_of_changes_first_lines.go index 0588184a0..695505527 100644 --- a/pkg/integration/tests/staging/stage_partial_block_of_changes_first_lines.go +++ b/pkg/integration/tests/main_view/stage_partial_block_of_changes_first_lines.go @@ -1,4 +1,4 @@ -package staging +package main_view import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -26,7 +26,7 @@ var StagePartialBlockOfChangesFirstLines = NewIntegrationTest(NewIntegrationTest ). PressEnter() - t.Views().Staging(). + t.Views().Main(). IsFocused(). ContainsLines( Contains(" 1"), @@ -53,7 +53,7 @@ var StagePartialBlockOfChangesFirstLines = NewIntegrationTest(NewIntegrationTest SelectedLines(Contains("+3b")). PressPrimaryAction() - t.Views().StagingSecondary(). + t.Views().Secondary(). ContainsLines( Contains(" 1"), Contains("-2"), diff --git a/pkg/integration/tests/staging/stage_partial_block_of_changes_last_lines.go b/pkg/integration/tests/main_view/stage_partial_block_of_changes_last_lines.go similarity index 95% rename from pkg/integration/tests/staging/stage_partial_block_of_changes_last_lines.go rename to pkg/integration/tests/main_view/stage_partial_block_of_changes_last_lines.go index 355b02292..e923e9f5a 100644 --- a/pkg/integration/tests/staging/stage_partial_block_of_changes_last_lines.go +++ b/pkg/integration/tests/main_view/stage_partial_block_of_changes_last_lines.go @@ -1,4 +1,4 @@ -package staging +package main_view import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -26,7 +26,7 @@ var StagePartialBlockOfChangesLastLines = NewIntegrationTest(NewIntegrationTestA ). PressEnter() - t.Views().Staging(). + t.Views().Main(). IsFocused(). ContainsLines( Contains(" 1"), @@ -53,7 +53,7 @@ var StagePartialBlockOfChangesLastLines = NewIntegrationTest(NewIntegrationTestA SelectedLines(Contains("+7b")). PressPrimaryAction() - t.Views().StagingSecondary(). + t.Views().Secondary(). ContainsLines( Contains(" 3"), Contains(" 4"), diff --git a/pkg/integration/tests/staging/stage_partial_block_of_changes_middle_lines.go b/pkg/integration/tests/main_view/stage_partial_block_of_changes_middle_lines.go similarity index 96% rename from pkg/integration/tests/staging/stage_partial_block_of_changes_middle_lines.go rename to pkg/integration/tests/main_view/stage_partial_block_of_changes_middle_lines.go index 085c188a9..22c9a140d 100644 --- a/pkg/integration/tests/staging/stage_partial_block_of_changes_middle_lines.go +++ b/pkg/integration/tests/main_view/stage_partial_block_of_changes_middle_lines.go @@ -1,4 +1,4 @@ -package staging +package main_view import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -26,7 +26,7 @@ var StagePartialBlockOfChangesMiddleLines = NewIntegrationTest(NewIntegrationTes ). PressEnter() - t.Views().Staging(). + t.Views().Main(). IsFocused(). ContainsLines( Contains(" 1"), @@ -53,7 +53,7 @@ var StagePartialBlockOfChangesMiddleLines = NewIntegrationTest(NewIntegrationTes SelectedLines(Contains("+5b")). PressPrimaryAction() - t.Views().StagingSecondary(). + t.Views().Secondary(). // This is not the desired result, ideally the added lines would come right after the // deleted lines. However, this is hard to do, and it's a lot less common than staging // either the first lines or last lines of a block of changes, so we live with the diff --git a/pkg/integration/tests/staging/diff_context_change.go b/pkg/integration/tests/staging/diff_context_change.go deleted file mode 100644 index dae511971..000000000 --- a/pkg/integration/tests/staging/diff_context_change.go +++ /dev/null @@ -1,123 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Change the number of diff context lines while in the staging panel", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) {}, - SetupRepo: func(shell *Shell) { - // need to be working with a few lines so that git perceives it as two separate hunks - shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a") - shell.Commit("one") - - shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a") - - // hunk looks like: - // diff --git a/file1 b/file1 - // index 3653080..a6388b6 100644 - // --- a/file1 - // +++ b/file1 - // @@ -1,6 +1,6 @@ - // 1a - // 2a - // -3a - // +3b - // 4a - // 5a - // 6a - // @@ -10,6 +10,6 @@ - // 10a - // 11a - // 12a - // -13a - // +13b - // 14a - // 15a - // \ No newline at end of file - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.IncreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 4")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.DecreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 3")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.DecreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 2")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.DecreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 1")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - PressPrimaryAction(). - Press(keys.Universal.TogglePanel) - - t.Views().StagingSecondary(). - IsFocused(). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.DecreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 0")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.IncreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 1")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.IncreaseContextInDiffView). - Tap(func() { - t.ExpectToast(Equals("Changed diff context size to 2")) - }). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ) - }, -}) diff --git a/pkg/integration/tests/staging/search.go b/pkg/integration/tests/staging/search.go deleted file mode 100644 index 1f2c95777..000000000 --- a/pkg/integration/tests/staging/search.go +++ /dev/null @@ -1,42 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var Search = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Use the search feature in the staging panel", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) {}, - SetupRepo: func(shell *Shell) { - shell.CreateFile("file1", "one\ntwo\nthree\nfour\nfive") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - Press(keys.Universal.StartSearch). - Tap(func() { - t.ExpectSearch(). - Type("four"). - Confirm() - - t.Views().Search().IsVisible().Content(Contains("matches for 'four' (1 of 1)")) - }). - SelectedLine(Contains("+four")). // stage the line - PressPrimaryAction(). - Content(DoesNotContain("+four")). - Tap(func() { - t.Views().StagingSecondary(). - Content(Contains("+four")) - }) - }, -}) diff --git a/pkg/integration/tests/staging/select_next_line_after_staging_in_two_hunk_diff.go b/pkg/integration/tests/staging/select_next_line_after_staging_in_two_hunk_diff.go deleted file mode 100644 index 8bf264ae2..000000000 --- a/pkg/integration/tests/staging/select_next_line_after_staging_in_two_hunk_diff.go +++ /dev/null @@ -1,61 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -// Tests that after staging individual lines from a consecutive changes block, -// the cursor advances to the correct next change. The file has two separate -// hunks so that we can verify the cursor crosses hunk boundaries correctly. -var SelectNextLineAfterStagingInTwoHunkDiff = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "After staging lines from a two-hunk diff, the cursor advances correctly", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = false - }, - SetupRepo: func(shell *Shell) { - // Use 7 context lines between the two change blocks so that git creates - // two separate hunks. - shell.CreateFileAndAdd("file1", "1\n2\na\nb\nc\nd\ne\nf\ng\n3\n4\n") - shell.Commit("one") - - shell.UpdateFile("file1", "1b\n2b\na\nb\nc\nd\ne\nf\ng\n3b\n4b\n") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - ContainsLines( - Contains("-1"), - Contains("-2"), - Contains("+1b"), - Contains("+2b"), - Contains(" a"), - Contains(" b"), - Contains(" c"), - Contains("@@"), - Contains(" e"), - Contains(" f"), - Contains(" g"), - Contains("-3"), - Contains("-4"), - Contains("+3b"), - Contains("+4b"), - ). - NavigateToLine(Contains("-2")). - PressPrimaryAction(). - SelectedLine(Contains("+1b")). - PressPrimaryAction(). - SelectedLine(Contains("+2b")). - PressPrimaryAction(). - SelectedLine(Contains("-3")) - }, -}) diff --git a/pkg/integration/tests/staging/select_next_line_after_staging_isolated_added_line.go b/pkg/integration/tests/staging/select_next_line_after_staging_isolated_added_line.go deleted file mode 100644 index 221ebba38..000000000 --- a/pkg/integration/tests/staging/select_next_line_after_staging_isolated_added_line.go +++ /dev/null @@ -1,51 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -// Tests that after staging an isolated addition (one that is alone in its block of changes), the -// cursor stays at the first change of the next block of changes which moves up to the same line, -// even if that block starts with a deletion. -var SelectNextLineAfterStagingIsolatedAddedLine = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "After staging an isolated added line, the cursor advances to the next hunk's first change", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = false - }, - SetupRepo: func(shell *Shell) { - shell.CreateFileAndAdd("file1", "1\n2\n3\n4\n5\n6\n7\n8\n9\n") - shell.Commit("one") - - shell.UpdateFile("file1", "1\n2\n3\nnew\n4\n5\n6\n7b\n8\n9\n") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - ContainsLines( - Contains(" 1"), - Contains(" 2"), - Contains(" 3"), - Contains("+new"), - Contains(" 4"), - Contains(" 5"), - Contains(" 6"), - Contains("-7"), - Contains("+7b"), - Contains(" 8"), - Contains(" 9"), - ). - SelectedLine(Contains("+new")). - PressPrimaryAction(). - SelectedLine(Contains("-7")) - }, -}) diff --git a/pkg/integration/tests/staging/stage_hunks.go b/pkg/integration/tests/staging/stage_hunks.go deleted file mode 100644 index 7afc3a24d..000000000 --- a/pkg/integration/tests/staging/stage_hunks.go +++ /dev/null @@ -1,120 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Stage and unstage various hunks of a file in the staging panel", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = false - }, - SetupRepo: func(shell *Shell) { - shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a") - shell.Commit("one") - - shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6b\n7a\n8a") - - // hunk looks like: - // diff --git a/file1 b/file1 - // index 3653080..a6388b6 100644 - // --- a/file1 - // +++ b/file1 - // @@ -1,6 +1,6 @@ - // 1a - // 2a - // -3a - // +3b - // 4a - // 5a - // -6a - // +6b - // 7a - // 8a - // \ No newline at end of file - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - SelectedLines( - Contains("-3a"), - ). - Press(keys.Universal.NextBlock). - SelectedLines( - Contains("-6a"), - ). - Press(keys.Main.ToggleSelectHunk). - SelectedLines( - Contains("-6a"), - Contains("+6b"), - ). - // when in hunk mode, pressing up/down moves us up/down by a hunk - SelectPreviousItem(). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - SelectNextItem(). - SelectedLines( - Contains("-6a"), - Contains("+6b"), - ). - // stage the second hunk - PressPrimaryAction(). - ContainsLines( - Contains("-3a"), - Contains("+3b"), - ). - Tap(func() { - t.Views().StagingSecondary(). - ContainsLines( - Contains("-6a"), - Contains("+6b"), - ) - }). - Press(keys.Universal.TogglePanel) - - t.Views().StagingSecondary(). - IsFocused(). - // after toggling panel, we're back to only having selected a single line - SelectedLines( - Contains("-6a"), - ). - PressPrimaryAction(). - SelectedLines( - Contains("+6b"), - ). - PressPrimaryAction(). - IsEmpty() - - t.Views().Staging(). - IsFocused(). - SelectedLines( - Contains("-3a"), - ). - Press(keys.Main.ToggleSelectHunk). - SelectedLines( - Contains(`-3a`), - Contains(`+3b`), - ). - Press(keys.Universal.Remove). - Tap(func() { - t.Common().ConfirmDiscardLines() - }). - Content(DoesNotContain("-3a").DoesNotContain("+3b")). - SelectedLines( - Contains("-6a"), - Contains("+6b"), - ) - }, -}) diff --git a/pkg/integration/tests/staging/stage_hunks_with_rapid_keypresses.go b/pkg/integration/tests/staging/stage_hunks_with_rapid_keypresses.go deleted file mode 100644 index 5b41073e2..000000000 --- a/pkg/integration/tests/staging/stage_hunks_with_rapid_keypresses.go +++ /dev/null @@ -1,50 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -// The second space is pressed before the refresh triggered by the first one -// has updated the staging panel. That refresh is what moves the selection to -// the next hunk, so the second press must not be handled until it has landed; -// handling it earlier would try to stage the first hunk a second time. -var StageHunksWithRapidKeypresses = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Stage two hunks with two space presses in rapid succession", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = true - }, - SetupRepo: func(shell *Shell) { - // Use 7 context lines between the two change blocks so that git creates - // two separate hunks. - shell.CreateFileAndAdd("file1", "1\n2\na\nb\nc\nd\ne\nf\ng\n3\n4\n") - shell.Commit("one") - - shell.UpdateFile("file1", "1b\n2b\na\nb\nc\nd\ne\nf\ng\n3b\n4b\n") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - PressRapidly(keys.Universal.Select, keys.Universal.Select) - - t.Views().StagingSecondary(). - IsFocused(). - ContainsLines( - Contains("+1b"), - Contains("+2b"), - ). - ContainsLines( - Contains("+3b"), - Contains("+4b"), - ) - }, -}) diff --git a/pkg/integration/tests/staging/stage_lines.go b/pkg/integration/tests/staging/stage_lines.go deleted file mode 100644 index 39ea2d0bf..000000000 --- a/pkg/integration/tests/staging/stage_lines.go +++ /dev/null @@ -1,122 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Stage and unstage various lines of a file in the staging panel", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = false - }, - SetupRepo: func(shell *Shell) { - shell.CreateFileAndAdd("file1", "one\ntwo\n") - shell.Commit("one") - - shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - SelectedLines(Contains("+three")). - // stage 'three' - PressPrimaryAction(). - // 'three' moves over to the staging secondary panel - Content(DoesNotContain("+three")). - Tap(func() { - t.Views().StagingSecondary(). - ContainsLines( - Contains("+three"), - ) - }). - SelectedLines(Contains("+four")). - // stage 'four' - PressPrimaryAction(). - // nothing left in our staging panel - IsEmpty() - - // because we've staged everything we get moved to the staging secondary panel - // do the same thing as above, moving the lines back to the staging panel - t.Views().StagingSecondary(). - IsFocused(). - ContainsLines( - Contains("+three"), - Contains("+four"), - ). - SelectedLines(Contains("+three")). - PressPrimaryAction(). - Content(DoesNotContain("+three")). - Tap(func() { - t.Views().Staging(). - ContainsLines( - Contains("+three"), - ) - }). - SelectedLines(Contains("+four")). - // pressing 'remove' has the same effect as pressing space when in the staging secondary panel - Press(keys.Universal.Remove). - IsEmpty() - - // stage one line and then manually toggle to the staging secondary panel - t.Views().Staging(). - IsFocused(). - ContainsLines( - Contains("+three"), - Contains("+four"), - ). - SelectedLines(Contains("+three")). - PressPrimaryAction(). - Content(DoesNotContain("+three")). - Tap(func() { - t.Views().StagingSecondary(). - Content(Contains("+three")) - }). - Press(keys.Universal.TogglePanel) - - // manually toggle back to the staging panel - t.Views().StagingSecondary(). - IsFocused(). - Press(keys.Universal.TogglePanel) - - t.Views().Staging(). - SelectedLines(Contains("+four")). - // discard the line - Press(keys.Universal.Remove). - Tap(func() { - t.ExpectPopup().Confirmation(). - Title(Equals("Discard change")). - Content(Contains("Are you sure you want to discard this change")). - Confirm() - }). - IsEmpty() - - t.Views().StagingSecondary(). - IsFocused(). - ContainsLines( - Contains("+three"), - ). - // return to file - PressEscape() - - t.Views().Files(). - IsFocused(). - Lines( - Contains("M file1").IsSelected(), - ). - PressEnter() - - // because we only have a staged change we'll land in the staging secondary panel - t.Views().StagingSecondary(). - IsFocused() - }, -}) diff --git a/pkg/integration/tests/staging/stage_ranges.go b/pkg/integration/tests/staging/stage_ranges.go deleted file mode 100644 index 3d96d0610..000000000 --- a/pkg/integration/tests/staging/stage_ranges.go +++ /dev/null @@ -1,108 +0,0 @@ -package staging - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Stage and unstage various ranges of a file in the staging panel", - ExtraCmdArgs: []string{}, - Skip: false, - SetupConfig: func(config *config.AppConfig) { - config.GetUserConfig().Gui.UseHunkModeInStagingView = false - }, - SetupRepo: func(shell *Shell) { - shell.CreateFileAndAdd("file1", "one\ntwo\n") - shell.Commit("one") - - shell.UpdateFile("file1", "one\ntwo\nthree\nfour\nfive\nsix\n") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Files(). - IsFocused(). - Lines( - Contains("file1").IsSelected(), - ). - PressEnter() - - t.Views().Staging(). - IsFocused(). - SelectedLines( - Contains("+three"), - ). - Press(keys.Universal.ToggleRangeSelect). - NavigateToLine(Contains("+five")). - SelectedLines( - Contains("+three"), - Contains("+four"), - Contains("+five"), - ). - // stage the three lines we've just selected - PressPrimaryAction(). - SelectedLines( - Contains("+six"), - ). - ContainsLines( - Contains(" five"), - Contains("+six"), - ). - Tap(func() { - t.Views().StagingSecondary(). - ContainsLines( - Contains("+three"), - Contains("+four"), - Contains("+five"), - ) - }). - Press(keys.Universal.TogglePanel) - - t.Views().StagingSecondary(). - IsFocused(). - SelectedLines( - Contains("+three"), - ). - Press(keys.Universal.ToggleRangeSelect). - NavigateToLine(Contains("+five")). - SelectedLines( - Contains("+three"), - Contains("+four"), - Contains("+five"), - ). - // unstage the three selected lines - PressPrimaryAction(). - // nothing left in our staging secondary panel - IsEmpty(). - Tap(func() { - t.Views().Staging(). - ContainsLines( - Contains("+three"), - Contains("+four"), - Contains("+five"), - Contains("+six"), - ) - }) - - t.Views().Staging(). - IsFocused(). - // coincidentally we land at '+four' here. Maybe we should instead land - // at '+three'? given it's at the start of the hunk? - SelectedLines( - Contains("+four"), - ). - Press(keys.Universal.ToggleRangeSelect). - SelectNextItem(). - SelectedLines( - Contains("+four"), - Contains("+five"), - ). - Press(keys.Universal.Remove). - Tap(func() { - t.Common().ConfirmDiscardLines() - }). - ContainsLines( - Contains("+three"), - Contains("+six"), - ) - }, -}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 250829800..a7804c74e 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -440,6 +440,9 @@ var tests = []*components.IntegrationTest{ main_view.StageDiffLines, main_view.StageDiffLinesOfAPathWithASpace, main_view.StageHunksWithRapidKeypresses, + main_view.StagePartialBlockOfChangesFirstLines, + main_view.StagePartialBlockOfChangesLastLines, + main_view.StagePartialBlockOfChangesMiddleLines, main_view.StageRangeSpanningFiles, main_view.StageUnderConformingDiffRenderer, main_view.StageUnderUnsupportedDiffRenderer, @@ -510,18 +513,7 @@ var tests = []*components.IntegrationTest{ shell_commands.History, shell_commands.OmitFromHistory, staging.DiffChangeScreenMode, - staging.DiffContextChange, staging.DiscardAllChanges, - staging.Search, - staging.SelectNextLineAfterStagingInTwoHunkDiff, - staging.SelectNextLineAfterStagingIsolatedAddedLine, - staging.StageHunks, - staging.StageHunksWithRapidKeypresses, - staging.StageLines, - staging.StagePartialBlockOfChangesFirstLines, - staging.StagePartialBlockOfChangesLastLines, - staging.StagePartialBlockOfChangesMiddleLines, - staging.StageRanges, stash.Apply, stash.ApplyPatch, stash.CreateBranch,