From bfcbf228bfcb653a402981f71f85fb5638a7644f Mon Sep 17 00:00:00 2001 From: Arnaud PERALTA Date: Sun, 27 Nov 2022 18:24:00 +0100 Subject: [PATCH] commit integrations test with window name's assertion --- pkg/integration/tests/commit/staged.go | 11 ++++++----- pkg/integration/tests/commit/unstaged.go | 11 ++++++----- .../commit/staged/expected/repo/.git_keep/index | Bin 209 -> 137 bytes .../staged/expected/repo/.git_keep/logs/HEAD | 2 +- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../2c/32ecbb77ddbbb0584ceae9316e290da7733327 | Bin 0 -> 51 bytes .../3a/e2df795236e3c84cb1faa242d3268838603515 | Bin 76 -> 0 bytes .../45/e15f2c1a4f47adeba3dbfc075e46a574f9b1fa | Bin 0 -> 48 bytes .../97/04090f88911a4083ef7d5907e38b9f45e43b16 | Bin 31 -> 0 bytes .../a0/a4dfd8937f66345c93ee7ebf5f85d53e05e9e8 | 2 ++ .../a4/de8e0658023fb43037b687b5052c1b5b2ab0c3 | Bin 0 -> 34 bytes .../ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 | Bin 30 -> 0 bytes .../ef/3197feca3fdc5b9f0170f483c6ff138d5cf186 | 2 -- .../expected/repo/.git_keep/refs/heads/master | 2 +- .../commit/staged/expected/repo/myfile | 3 ++- .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 - .../staging/expected/repo/.git_keep/FETCH_HEAD | 0 .../commit/staging/expected/repo/.git_keep/HEAD | 1 - .../staging/expected/repo/.git_keep/MERGE_RR | 0 .../staging/expected/repo/.git_keep/config | 12 ------------ .../staging/expected/repo/.git_keep/description | 1 - .../staging/expected/repo/.git_keep/index | Bin 209 -> 0 bytes .../expected/repo/.git_keep/info/exclude | 6 ------ .../staging/expected/repo/.git_keep/logs/HEAD | 1 - .../repo/.git_keep/logs/refs/heads/master | 1 - .../28/f8e24755d8792e66738e36f193949a68021709 | Bin 125 -> 0 bytes .../3a/e2df795236e3c84cb1faa242d3268838603515 | Bin 76 -> 0 bytes .../97/04090f88911a4083ef7d5907e38b9f45e43b16 | Bin 31 -> 0 bytes .../ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 | Bin 30 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 1 - .../commit/staging/expected/repo/myfile | 1 - .../commit/staging/expected/repo/myfile2 | 1 - .../unstaged/expected/repo/.git_keep/index | Bin 137 -> 137 bytes .../unstaged/expected/repo/.git_keep/logs/HEAD | 2 +- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../00/e2463e8a06d3191bd825531e5dbf26bac22d6b | Bin 0 -> 31 bytes .../0c/4369dfc55cd41da90e149f2fa8ee3fc0a8f297 | Bin 51 -> 0 bytes .../10/9e5843c76c640d7075c2897b5720f1714df776 | 2 ++ .../ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 | Bin 30 -> 0 bytes .../d4/6951396fe8179592ec90aee0c0414fc0512fc5 | Bin 124 -> 0 bytes .../e7/bcdb57454dacf229e5be8122bb27bb56d78dba | 1 + .../expected/repo/.git_keep/refs/heads/master | 2 +- .../commit/unstaged/expected/repo/myfile | 3 ++- 43 files changed, 27 insertions(+), 46 deletions(-) create mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/2c/32ecbb77ddbbb0584ceae9316e290da7733327 delete mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/3a/e2df795236e3c84cb1faa242d3268838603515 create mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/45/e15f2c1a4f47adeba3dbfc075e46a574f9b1fa delete mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 create mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/a0/a4dfd8937f66345c93ee7ebf5f85d53e05e9e8 create mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/a4/de8e0658023fb43037b687b5052c1b5b2ab0c3 delete mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 delete mode 100644 test/integration_new/commit/staged/expected/repo/.git_keep/objects/ef/3197feca3fdc5b9f0170f483c6ff138d5cf186 delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/COMMIT_EDITMSG delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/FETCH_HEAD delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/HEAD delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/MERGE_RR delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/config delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/description delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/index delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/info/exclude delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/logs/HEAD delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/logs/refs/heads/master delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/objects/28/f8e24755d8792e66738e36f193949a68021709 delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/objects/3a/e2df795236e3c84cb1faa242d3268838603515 delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/objects/ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 delete mode 100644 test/integration_new/commit/staging/expected/repo/.git_keep/refs/heads/master delete mode 100644 test/integration_new/commit/staging/expected/repo/myfile delete mode 100644 test/integration_new/commit/staging/expected/repo/myfile2 create mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/00/e2463e8a06d3191bd825531e5dbf26bac22d6b delete mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/0c/4369dfc55cd41da90e149f2fa8ee3fc0a8f297 create mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/10/9e5843c76c640d7075c2897b5720f1714df776 delete mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/ad/a5661567ddf0a64f589cad3cd0cffd7e79af99 delete mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/d4/6951396fe8179592ec90aee0c0414fc0512fc5 create mode 100644 test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/e7/bcdb57454dacf229e5be8122bb27bb56d78dba diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go index 80de2bca9..715bc0eb2 100644 --- a/pkg/integration/tests/commit/staged.go +++ b/pkg/integration/tests/commit/staged.go @@ -6,21 +6,21 @@ import ( ) var Staged = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Staging a couple files, going in the staged files menu and committing", + Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { - shell.CreateFile("myfile", "myfile content") - shell.CreateFile("myfile2", "myfile2 content") + shell. + CreateFile("myfile", "myfile content\nwith a second line"). + CreateFile("myfile2", "myfile2 content") }, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) - input.PrimaryAction() - input.NextItem() input.PrimaryAction() input.Confirm() + input.PrimaryAction() input.PressKeys(keys.Files.CommitChanges) commitMessage := "my commit message" @@ -29,5 +29,6 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(1) assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.CurrentWindowName("stagingSecondary") }, }) diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go index 5dd396eec..aa8579e2b 100644 --- a/pkg/integration/tests/commit/unstaged.go +++ b/pkg/integration/tests/commit/unstaged.go @@ -6,20 +6,20 @@ import ( ) var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Staging a couple files, going in the unstaged files menu and committing", + Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { - shell.CreateFile("myfile", "myfile content") - shell.CreateFile("myfile2", "myfile2 content") + shell. + CreateFile("myfile", "myfile content\nwith a second line"). + CreateFile("myfile2", "myfile2 content") }, Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { assert.CommitCount(0) - input.PrimaryAction() - input.NextItem() input.Confirm() + input.PrimaryAction() input.PressKeys(keys.Files.CommitChanges) commitMessage := "my commit message" @@ -28,5 +28,6 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ assert.CommitCount(1) assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.CurrentWindowName("staging") }, }) diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/index b/test/integration_new/commit/staged/expected/repo/.git_keep/index index 193a6619c85c5c3d651b6fe2f70ca51ea7dfc7d7..6ca933f528d0ac98960957621bb5edbbdb829a4b 100644 GIT binary patch literal 137 zcmZ?q402{*U|<4bMj*xk8kZnTEV1eGDhZ)#%E7LM_QbFoM zf?QpJlq7?pf&rI~(VN}ncXw}y@OkypFi(?rd9ktjd@cJ837$3Ix4d5J9P%X6RFaWf F4FK=XAe#UH literal 209 zcmZ?q402{*U|<5_l14+ z26l)!MnFv=L9VVqN|M1y!GO!^(f!IGv&ScVHvU@VbXl##BEeL&@rKAx)%Wdxn-^KW N<+(l~ 1669566692 +0100 commit (initial): my commit message +0000000000000000000000000000000000000000 a0a4dfd8937f66345c93ee7ebf5f85d53e05e9e8 CI 1669569482 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/commit/staged/expected/repo/.git_keep/logs/refs/heads/master index 40d31f9ee..277243a2e 100644 --- a/test/integration_new/commit/staged/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration_new/commit/staged/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 ef3197feca3fdc5b9f0170f483c6ff138d5cf186 CI 1669566692 +0100 commit (initial): my commit message +0000000000000000000000000000000000000000 a0a4dfd8937f66345c93ee7ebf5f85d53e05e9e8 CI 1669569482 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/objects/2c/32ecbb77ddbbb0584ceae9316e290da7733327 b/test/integration_new/commit/staged/expected/repo/.git_keep/objects/2c/32ecbb77ddbbb0584ceae9316e290da7733327 new file mode 100644 index 0000000000000000000000000000000000000000..75197c7e913c978ccb4e12bcebe3e0bfb5d0a761 GIT binary patch literal 51 zcmbWfyEIKS{qBcl{tT_-wHN?jA|1xZp&@wy diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/objects/45/e15f2c1a4f47adeba3dbfc075e46a574f9b1fa b/test/integration_new/commit/staged/expected/repo/.git_keep/objects/45/e15f2c1a4f47adeba3dbfc075e46a574f9b1fa new file mode 100644 index 0000000000000000000000000000000000000000..8a26026cdeb2c107f8fd872a84da6573feb1d46b GIT binary patch literal 48 zcmV-00MGw;0ZYosPf{>8X2`8f%gjktNY2kINzE(aD$gv*P)JlLP6Z02DCA`3r2+sa Gd=7F6eH0J? literal 0 HcmV?d00001 diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 b/test/integration_new/commit/staged/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 deleted file mode 100644 index c4b48a2f084a86a8022e805a2a31d1f398d03f12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmbSW_Bm-0 \ No newline at end of file diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/objects/a4/de8e0658023fb43037b687b5052c1b5b2ab0c3 b/test/integration_new/commit/staged/expected/repo/.git_keep/objects/a4/de8e0658023fb43037b687b5052c1b5b2ab0c3 new file mode 100644 index 0000000000000000000000000000000000000000..d746db209b355034e77175036b466f51c7ccbd10 GIT binary patch literal 34 qcmbxm'Uԝ}M0 \ No newline at end of file diff --git a/test/integration_new/commit/staged/expected/repo/.git_keep/refs/heads/master b/test/integration_new/commit/staged/expected/repo/.git_keep/refs/heads/master index b44143ba4..8aa84085c 100644 --- a/test/integration_new/commit/staged/expected/repo/.git_keep/refs/heads/master +++ b/test/integration_new/commit/staged/expected/repo/.git_keep/refs/heads/master @@ -1 +1 @@ -ef3197feca3fdc5b9f0170f483c6ff138d5cf186 +a0a4dfd8937f66345c93ee7ebf5f85d53e05e9e8 diff --git a/test/integration_new/commit/staged/expected/repo/myfile b/test/integration_new/commit/staged/expected/repo/myfile index ada566156..45e15f2c1 100644 --- a/test/integration_new/commit/staged/expected/repo/myfile +++ b/test/integration_new/commit/staged/expected/repo/myfile @@ -1 +1,2 @@ -myfile content \ No newline at end of file +myfile content +with a second line \ No newline at end of file diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/commit/staging/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 8a744b4fe..000000000 --- a/test/integration_new/commit/staging/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -my commit message diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/commit/staging/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/HEAD b/test/integration_new/commit/staging/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration_new/commit/staging/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/MERGE_RR b/test/integration_new/commit/staging/expected/repo/.git_keep/MERGE_RR deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/config b/test/integration_new/commit/staging/expected/repo/.git_keep/config deleted file mode 100644 index 2b89b8630..000000000 --- a/test/integration_new/commit/staging/expected/repo/.git_keep/config +++ /dev/null @@ -1,12 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true -[user] - email = CI@example.com - name = CI -[commit] - gpgSign = false -[protocol "file"] - allow = always diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/description b/test/integration_new/commit/staging/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration_new/commit/staging/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_new/commit/staging/expected/repo/.git_keep/index b/test/integration_new/commit/staging/expected/repo/.git_keep/index deleted file mode 100644 index 3c44f83b5778461cfcfffb754547d358a3777c52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 209 zcmZ?q402{*U|<5_ 1669566470 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/commit/staging/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 910749aff..000000000 --- a/test/integration_new/commit/staging/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 28f8e24755d8792e66738e36f193949a68021709 CI 1669566470 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/objects/28/f8e24755d8792e66738e36f193949a68021709 b/test/integration_new/commit/staging/expected/repo/.git_keep/objects/28/f8e24755d8792e66738e36f193949a68021709 deleted file mode 100644 index cc6a8ec738cdbc068ec2dd881effc185383097a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 125 zcmV-@0D}K`0ga783c@fD06pgwdlzJrO|~hB2tD-~Yr0jzCDKOF-&^nlUWXZ`RI_^n zpLo|6RUpwY&0U`Yu~NygT>LB&Vwfm!&XgG``Q+r)ZgqiSgyS%t^)2>%=%G|QfoJX$ fbLsUw@K4Kb!Q*=C1AR)a#i;Qvz{;YtX(^% diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/objects/3a/e2df795236e3c84cb1faa242d3268838603515 b/test/integration_new/commit/staging/expected/repo/.git_keep/objects/3a/e2df795236e3c84cb1faa242d3268838603515 deleted file mode 100644 index 57198442f6ad83fffd10538fa84ecee53ee8f023..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 76 zcmV-S0JHyi0V^p=O;s?nWH2-^Ff%bx$gNDv%t>WfyEIKS{qBcl{tT_-wHN?jA|1xZp&@wy diff --git a/test/integration_new/commit/staging/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 b/test/integration_new/commit/staging/expected/repo/.git_keep/objects/97/04090f88911a4083ef7d5907e38b9f45e43b16 deleted file mode 100644 index c4b48a2f084a86a8022e805a2a31d1f398d03f12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 ncmbZ) zn6uXA!uh{-mFs6Ru;o^!W#*&;^)Q44xw--=Nd`j&11=ut%=<@UuE?(B6Pd5S;+_40 c6`!V?-%w!kf3aV!s5SH6i^YNZaw2x~0L}(5CIA2c diff --git a/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/HEAD b/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/HEAD index c2cf4bcdd..2889f13ff 100644 --- a/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/HEAD +++ b/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/HEAD @@ -1 +1 @@ -0000000000000000000000000000000000000000 d46951396fe8179592ec90aee0c0414fc0512fc5 CI 1669566705 +0100 commit (initial): my commit message +0000000000000000000000000000000000000000 109e5843c76c640d7075c2897b5720f1714df776 CI 1669569750 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/refs/heads/master index c2cf4bcdd..2889f13ff 100644 --- a/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration_new/commit/unstaged/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 d46951396fe8179592ec90aee0c0414fc0512fc5 CI 1669566705 +0100 commit (initial): my commit message +0000000000000000000000000000000000000000 109e5843c76c640d7075c2897b5720f1714df776 CI 1669569750 +0100 commit (initial): my commit message diff --git a/test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/00/e2463e8a06d3191bd825531e5dbf26bac22d6b b/test/integration_new/commit/unstaged/expected/repo/.git_keep/objects/00/e2463e8a06d3191bd825531e5dbf26bac22d6b new file mode 100644 index 0000000000000000000000000000000000000000..5bdcb3903da65756ce19935b40720e2a49776c17 GIT binary patch literal 31 ncmb9VK6i>Ff%bx$gNDv%t>WfyEIKS{qBcl{t