diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-22 14:05:42 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-22 14:36:35 +1000 |
commit | 7807b403229cb57f261d97d15a76d0b35b15e19a (patch) | |
tree | 6e243e0a712a644e579e44fe055cd1054bf51523 /pkg/integration | |
parent | b284970bac62364c2cccf6a2408d4584ae93056d (diff) |
Better tag creation UX
Previously we used a single-line prompt for a tag annotation. Now we're using the commit message
prompt.
I've had to update other uses of that prompt to allow the summary and description labels to
be passed in
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/components/commit_description_panel_driver.go | 6 | ||||
-rw-r--r-- | pkg/integration/tests/branch/create_tag.go | 9 | ||||
-rw-r--r-- | pkg/integration/tests/commit/create_tag.go | 9 | ||||
-rw-r--r-- | pkg/integration/tests/tag/create_while_committing.go | 37 | ||||
-rw-r--r-- | pkg/integration/tests/tag/crud_annotated.go | 25 | ||||
-rw-r--r-- | pkg/integration/tests/tag/crud_lightweight.go | 9 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
7 files changed, 63 insertions, 33 deletions
diff --git a/pkg/integration/components/commit_description_panel_driver.go b/pkg/integration/components/commit_description_panel_driver.go index 46d36652d..e7ab13b33 100644 --- a/pkg/integration/components/commit_description_panel_driver.go +++ b/pkg/integration/components/commit_description_panel_driver.go @@ -23,3 +23,9 @@ func (self *CommitDescriptionPanelDriver) AddNewline() *CommitDescriptionPanelDr self.t.press(self.t.keys.Universal.Confirm) return self } + +func (self *CommitDescriptionPanelDriver) Title(expected *TextMatcher) *CommitDescriptionPanelDriver { + self.getViewDriver().Title(expected) + + return self +} diff --git a/pkg/integration/tests/branch/create_tag.go b/pkg/integration/tests/branch/create_tag.go index 68f91ec1b..9ea100f4f 100644 --- a/pkg/integration/tests/branch/create_tag.go +++ b/pkg/integration/tests/branch/create_tag.go @@ -26,13 +26,8 @@ var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). Press(keys.Branches.CreateTag) - t.ExpectPopup().Menu(). - Title(Equals("Create tag")). - Select(Contains("Lightweight")). - Confirm() - - t.ExpectPopup().Prompt(). - Title(Equals("Tag name:")). + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). Type("new-tag"). Confirm() diff --git a/pkg/integration/tests/commit/create_tag.go b/pkg/integration/tests/commit/create_tag.go index 22a4baa86..f068f271b 100644 --- a/pkg/integration/tests/commit/create_tag.go +++ b/pkg/integration/tests/commit/create_tag.go @@ -23,13 +23,8 @@ var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{ ). Press(keys.Commits.CreateTag) - t.ExpectPopup().Menu(). - Title(Equals("Create tag")). - Select(Contains("Lightweight")). - Confirm() - - t.ExpectPopup().Prompt(). - Title(Equals("Tag name:")). + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). Type("new-tag"). Confirm() diff --git a/pkg/integration/tests/tag/create_while_committing.go b/pkg/integration/tests/tag/create_while_committing.go new file mode 100644 index 000000000..88d31f759 --- /dev/null +++ b/pkg/integration/tests/tag/create_while_committing.go @@ -0,0 +1,37 @@ +package tag + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var CreateWhileCommitting = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Draft a commit message, escape out, and make a tag. Verify the draft message doesn't appear in the tag create prompt", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.CreateFileAndAdd("file.txt", "file contents") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + Press(keys.Files.CommitChanges). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Commit summary")). + Type("draft message"). + Cancel() + }) + + t.Views().Tags(). + Focus(). + IsEmpty(). + Press(keys.Universal.New). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). + InitialText(Equals("")) + }) + }, +}) diff --git a/pkg/integration/tests/tag/crud_annotated.go b/pkg/integration/tests/tag/crud_annotated.go index af40b32df..d32c7f265 100644 --- a/pkg/integration/tests/tag/crud_annotated.go +++ b/pkg/integration/tests/tag/crud_annotated.go @@ -19,19 +19,13 @@ var CrudAnnotated = NewIntegrationTest(NewIntegrationTestArgs{ IsEmpty(). Press(keys.Universal.New). Tap(func() { - t.ExpectPopup().Menu(). - Title(Equals("Create tag")). - Select(Contains("Annotated")). - Confirm() - - t.ExpectPopup().Prompt(). - Title(Equals("Tag name:")). + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). Type("new-tag"). - Confirm() - - t.ExpectPopup().Prompt(). - Title(Equals("Tag message:")). + SwitchToDescription(). + Title(Equals("Tag description")). Type("message"). + SwitchToSummary(). Confirm() }). Lines( @@ -44,6 +38,13 @@ var CrudAnnotated = NewIntegrationTest(NewIntegrationTestArgs{ Content(Equals("Are you sure you want to delete tag 'new-tag'?")). Confirm() }). - IsEmpty() + IsEmpty(). + Press(keys.Universal.New). + Tap(func() { + // confirm content is cleared on next tag create + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). + InitialText(Equals("")) + }) }, }) diff --git a/pkg/integration/tests/tag/crud_lightweight.go b/pkg/integration/tests/tag/crud_lightweight.go index 12d75a05a..ce5ff9e42 100644 --- a/pkg/integration/tests/tag/crud_lightweight.go +++ b/pkg/integration/tests/tag/crud_lightweight.go @@ -19,13 +19,8 @@ var CrudLightweight = NewIntegrationTest(NewIntegrationTestArgs{ IsEmpty(). Press(keys.Universal.New). Tap(func() { - t.ExpectPopup().Menu(). - Title(Equals("Create tag")). - Select(Contains("Lightweight")). - Confirm() - - t.ExpectPopup().Prompt(). - Title(Equals("Tag name:")). + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). Type("new-tag"). Confirm() }). diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index aa43dd2c1..1af3890dd 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -207,6 +207,7 @@ var tests = []*components.IntegrationTest{ sync.PushWithCredentialPrompt, sync.RenameBranchAndPull, tag.Checkout, + tag.CreateWhileCommitting, tag.CrudAnnotated, tag.CrudLightweight, tag.Reset, |