From f910b42c9c4989f09bda3f81ce704c0918e1a0ce Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 20 Dec 2022 23:08:39 +1100 Subject: [PATCH] migrate confirm-on-quit integration test --- pkg/integration/tests/misc/confirm_on_quit.go | 25 ++++++++++++++++++ pkg/integration/tests/tests.go | 2 ++ .../integration/confirmQuit/config/config.yml | 2 -- .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../expected/repo/.git_keep/FETCH_HEAD | 0 .../confirmQuit/expected/repo/.git_keep/HEAD | 1 - .../expected/repo/.git_keep/config | 10 ------- .../expected/repo/.git_keep/description | 1 - .../confirmQuit/expected/repo/.git_keep/index | Bin 137 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 7 ----- .../expected/repo/.git_keep/logs/HEAD | 1 - .../repo/.git_keep/logs/refs/heads/master | 1 - .../0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 | Bin 52 -> 0 bytes .../54/4efed4e669ec3bd64b44799175bffac95035f5 | Bin 121 -> 0 bytes .../a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 | Bin 21 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 1 - .../confirmQuit/expected/repo/myfile1 | 1 - test/integration/confirmQuit/recording.json | 1 - test/integration/confirmQuit/setup.sh | 14 ---------- test/integration/confirmQuit/test.json | 4 --- 20 files changed, 27 insertions(+), 45 deletions(-) create mode 100644 pkg/integration/tests/misc/confirm_on_quit.go delete mode 100644 test/integration/confirmQuit/config/config.yml delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/HEAD delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/config delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/description delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/index delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/objects/54/4efed4e669ec3bd64b44799175bffac95035f5 delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 delete mode 100644 test/integration/confirmQuit/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration/confirmQuit/expected/repo/myfile1 delete mode 100644 test/integration/confirmQuit/recording.json delete mode 100644 test/integration/confirmQuit/setup.sh delete mode 100644 test/integration/confirmQuit/test.json diff --git a/pkg/integration/tests/misc/confirm_on_quit.go b/pkg/integration/tests/misc/confirm_on_quit.go new file mode 100644 index 000000000..fc5ea9c5c --- /dev/null +++ b/pkg/integration/tests/misc/confirm_on_quit.go @@ -0,0 +1,25 @@ +package misc + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Quitting with a confirm prompt", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) { + config.UserConfig.ConfirmOnQuit = true + config.UserConfig.Gui.Theme.ActiveBorderColor = []string{"red"} + }, + SetupRepo: func(shell *Shell) {}, + Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { + assert.CommitCount(0) + + input.PressKeys(keys.Universal.Quit) + assert.InConfirm() + assert.MatchCurrentViewContent(Contains("Are you sure you want to quit?")) + input.Confirm() + }, +}) diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go index bad90f0cc..3feeb2d81 100644 --- a/pkg/integration/tests/tests.go +++ b/pkg/integration/tests/tests.go @@ -18,6 +18,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" + "github.com/jesseduffield/lazygit/pkg/integration/tests/misc" "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" ) @@ -25,6 +26,7 @@ import ( // be sure to add it to this list. var tests = []*components.IntegrationTest{ + misc.ConfirmOnQuit, bisect.Basic, bisect.FromOtherBranch, branch.CheckoutByName, diff --git a/test/integration/confirmQuit/config/config.yml b/test/integration/confirmQuit/config/config.yml deleted file mode 100644 index 7227c0b5d..000000000 --- a/test/integration/confirmQuit/config/config.yml +++ /dev/null @@ -1,2 +0,0 @@ -disableStartupPopups: true -confirmOnQuit: true diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/confirmQuit/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 3829ab872..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -myfile1 diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/FETCH_HEAD b/test/integration/confirmQuit/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/HEAD b/test/integration/confirmQuit/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/config b/test/integration/confirmQuit/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/description b/test/integration/confirmQuit/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/index b/test/integration/confirmQuit/expected/repo/.git_keep/index deleted file mode 100644 index e70e72626133a6b1aaab944dda232e51085a3d2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 137 zcmZ?q402{*U|<4b#>7WcG&$4-e}QPWZK^tq3=FJH?8|c*7#f!VrN08zhyXF$(mjv= zs;1uf5)m53lkapPz^kSEDg%3NWm;xVsv%H8NRX>5kdkCDR50M;%lWWu`@CM4hix~6 i7Jm13zUIFssJiw@-^cC^O)Y1&wiwkre7zM{YX< 1642239015 +1100 commit (initial): myfile1 diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/confirmQuit/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index d1743395b..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 544efed4e669ec3bd64b44799175bffac95035f5 CI 1642239015 +1100 commit (initial): myfile1 diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/confirmQuit/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 deleted file mode 100644 index 7f2ebf4eeb6ad6875bcc2a2b91ca3345ee06b45e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52 zcmbn~V3cJTHDqR`AUTkaR0dwS%fcn5-n;m2uX?~V!+n~c`iZu0dP~(FK*HX4 bBT^4nB1CuAbJFxr?(AFEP09TLF9s~TL)kgn diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/confirmQuit/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5fbab12262e28d85e78af8a31cd0024c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21 ccmb`~^A08nuUMF0Q* diff --git a/test/integration/confirmQuit/expected/repo/.git_keep/refs/heads/master b/test/integration/confirmQuit/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index c8e696e5a..000000000 --- a/test/integration/confirmQuit/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -544efed4e669ec3bd64b44799175bffac95035f5 diff --git a/test/integration/confirmQuit/expected/repo/myfile1 b/test/integration/confirmQuit/expected/repo/myfile1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/confirmQuit/expected/repo/myfile1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/confirmQuit/recording.json b/test/integration/confirmQuit/recording.json deleted file mode 100644 index fea04afb7..000000000 --- a/test/integration/confirmQuit/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":466,"Mod":0,"Key":256,"Ch":113},{"Timestamp":890,"Mod":0,"Key":13,"Ch":13}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/confirmQuit/setup.sh b/test/integration/confirmQuit/setup.sh deleted file mode 100644 index ee8276237..000000000 --- a/test/integration/confirmQuit/setup.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test1 > myfile1 -git add . -git commit -am "myfile1" diff --git a/test/integration/confirmQuit/test.json b/test/integration/confirmQuit/test.json deleted file mode 100644 index 0386cab89..000000000 --- a/test/integration/confirmQuit/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "quit with a confirm", - "speed": 20 -}