diff --git a/pkg/integration/tests/file/stage_all_without_changed_files.go b/pkg/integration/tests/file/stage_all_without_changed_files.go new file mode 100644 index 000000000..db9eecce3 --- /dev/null +++ b/pkg/integration/tests/file/stage_all_without_changed_files.go @@ -0,0 +1,28 @@ +package file + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StageAllWithoutChangedFiles = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Pressing the stage-all key when there are no changed files says that there are none", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("first commit") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + IsEmpty(). + Press(keys.Files.ToggleStagedAll). + Tap(func() { + /* EXPECTED: + t.ExpectToast(Contains("No changed files")) + ACTUAL: */ + t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Nothing to stage")).Confirm() + }) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index a945e324d..16de7805a 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -248,6 +248,7 @@ var tests = []*components.IntegrationTest{ file.RenameSimilarityThresholdChange, file.RenamedFiles, file.RenamedFilesNoRootItem, + file.StageAllWithoutChangedFiles, file.StageChildrenRangeSelect, file.StageDeletedRangeSelect, file.StageRangeSelect,