Commit graph

232 commits

Author SHA1 Message Date
Jesse Duffield f6af4c29d4 Add custom patch demo 2023-08-04 09:15:07 +10:00
Jesse Duffield c43195efb6 Add demo for amending old commit 2023-08-02 22:32:51 +10:00
Jesse Duffield c92ed07082 Appease linter 2023-08-02 08:32:57 +10:00
Jesse Duffield f43fd7af79 Wait in demo after setting caption
This looks nicer than waiting a second and then showing the caption as the action begins
2023-08-01 22:19:04 +10:00
Jesse Duffield 9cc1d65280 Add demo test variant
We're piggybacking on our existing integration test framework to record  demos that we can include in our docs
2023-07-31 22:33:04 +10:00
Jesse Duffield 975d2bedb6 Remove secureexec package
From the go 1.19 release notes:

Command and LookPath no longer allow results from a PATH search to be found relative to the current directory. This removes a common source of security problems but may also break existing programs that depend on using, say, exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in the current directory. See the os/exec package documentation for information about how best to update such programs.
2023-07-30 19:59:51 +10:00
Jesse Duffield e33fe37a99 Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one
for consistency. Lo is more extensive and better maintained so we're going with that.

My slices package was a superset of go's own slices package so in some places I've just used
the official one (the methods were just wrappers anyway).

I've also moved the remaining methods into the utils package.
2023-07-30 18:51:23 +10:00
Jesse Duffield 2b24c15938 Add test for opening lazygit in the worktree of a bare repo 2023-07-30 18:35:23 +10:00
Jesse Duffield b3060065d9 Support fastforwarding worktree 2023-07-30 18:35:23 +10:00
Jesse Duffield b93b9dae88 Add worktree tests for removing/detaching 2023-07-30 18:35:23 +10:00
Jesse Duffield 277142fc4b Add worktree integration tests 2023-07-30 18:35:23 +10:00
Jesse Duffield ca6f9c4155 Fix tests
Going and fixing up some submodule tests which were broken by bad assumptions with worktree code
2023-07-30 18:35:23 +10:00
Jesse Duffield 7569180cac Fix tests
We now change directories to the repo on startup so we don't need to determine the test path in some special way
2023-07-30 18:35:23 +10:00
Jesse Duffield 7807b40322 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
2023-07-22 14:36:35 +10:00
Jesse Duffield b46623ebef Use fuzzy search when filtering a view
This adds fuzzy filtering instead of exact match filtering, which is more forgiving of typos
and allows more efficiency.
2023-07-22 13:14:29 +10:00
Jesse Duffield 866e0a618b Add integration test for accordion mode 2023-07-19 22:17:29 +10:00
Stefan Haller ea0baf58e6 Fix Shell.Stash() for older versions of git
Older versions need an explicit "push" subcommand for the -m option to be
recognized.
2023-07-10 15:09:17 +02:00
Stefan Haller 1d96ade0ba Remove StashWithMessage function
It's identical to Stash(), so use that.
2023-07-10 15:09:17 +02:00
Stefan Haller 82b3803164 Use -c init.defaultBranch=master to pass the desired main branch to git init
Older versions of git don't support the -b option yet. However, no version of
git complains about the -c option, even when the init.defaultBranch config is
not supported.
2023-07-10 15:09:17 +02:00
Stefan Haller f4ada537d2 Remove mainBranch parameter from Shell.Init()
For older git versions we won't be able to support any other main branch than
"master", so hard-code that in Init.

This doesn't fix anything for older versions yet; see the next commit for that.
2023-07-10 15:09:17 +02:00
Jesse Duffield c7a3b69eb9 Remove retry logic in integration tests
I want to see how we go removing all retry logic within a test. Lazygit should be trusted to tell us when it's no longer busy,
and if it that proves false we should fix the issue in the code rather than being lenient in the tests
2023-07-09 20:57:18 +10:00
Jesse Duffield 6c4e7ee972 Add busy count for integration tests
Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
2023-07-08 22:54:52 +10:00
Jesse Duffield 261f30f49c Add integration tests for searching/filtering 2023-07-03 12:54:14 +10:00
Stefan Haller 51a558040d Fix the title and text (and variable names) of the Discard Changes prompt
The title was saying "Unstage lines", which was just wrong. The text said
"Delete lines", which can be seen as a bit misleading; we are only discarding
the changes to the selected lines, not deleting the lines themselves.

For consistency, rename the config variable skipUnstageLineWarning accordingly.
2023-06-26 08:15:35 +02:00
Jesse Duffield c92e687d3b Fix focus issue when opening recent-repos menu at launch
I don't know why we were setting the initial context to CurrentSideContext
and not just CurrentContext in the first place. If there is no current context
in either case it'll default to the files context. So the only issue is if
we anticipated that some random context would be focused and we didn't want to
activate that. But I can't think of any situation where that would happen.
2023-06-07 18:27:18 +10:00
Jesse Duffield dd34adb36c Support matchers on integers in integration tests 2023-06-03 15:32:23 +10:00
Jesse Duffield 4ff02bd3b7 Add integration test for commit highlighting on focus
A better refactor would be to allow matchers to assert against either a string or a slice of cells, so that I could have
the same ergonomics that I have elsewhere, but this is a start.
2023-06-01 22:20:30 +10:00
Stefan Haller 16dceb813b Show menu instead of prompt when there are conflicts in a rebase or merge
This solves the issue that previously you could too easily abort a rebase
accidentally by hitting escape.
2023-06-01 10:51:48 +02:00
Jesse Duffield d772c9f1d4 Use sentence case everywhere
We have not been good at consistent casing so far. Now we use 'Sentence case' everywhere. EVERYWHERE.

Also Removing 'Lc' prefix from i18n field names: the 'Lc' stood for lowercase but now that everything
is in 'Sentence case' there's no need for the distinction.

I've got a couple lower case things I've kept: namely, things that show up in parentheses.
2023-05-25 23:52:19 +10:00
Jesse Duffield 63dc07fded Construct arg vector manually rather than parse string
By constructing an arg vector manually, we no longer need to quote arguments

Mandate that args must be passed when building a command

Now you need to provide an args array when building a command.
There are a handful of places where we need to deal with a string,
such as with user-defined custom commands, and for those we now require
that at the callsite they use str.ToArgv to do that. I don't want
to provide a method out of the box for it because I want to discourage its
use.

For some reason we were invoking a command through a shell when amending a
commit, and I don't believe we needed to do that as there was nothing user-
supplied about the command. So I've switched to using a regular command out-
side the shell there
2023-05-23 19:49:19 +10:00
Jesse Duffield 2b30085dba Merge branch 'master' into refactor-better-encapsulation 2023-05-11 19:00:01 +10:00
Stefan Haller c8f26aca68 Rename From to AtLeast 2023-05-02 16:27:32 +02:00
Sean 9d68b287db Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 13:19:53 +10:00
Jesse Duffield 8a86de85c8 remove log call because it clutters test output 2023-04-30 13:19:53 +10:00
Sean 49da7b482d Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 12:17:34 +10:00
Jesse Duffield aec46942a8 enforce lowercase filenames 2023-04-29 13:05:05 +10:00
Stefan Haller 860a8d102b Add integration test for dropping a todo commit when there's an update-ref
The test shows how we are accidentally dropping the wrong commit in this case.
We'll fix that in the next commit.
2023-04-15 08:36:03 +02:00
Stefan Haller a304fed68c Add GitVersion field to NewIntegrationTestArgs
It can be used to specify which git versions a given test should or should not run on.
2023-04-15 08:36:03 +02:00
Jesse Duffield 7ce3165afa specify view when assertion on line count fails 2023-03-19 16:30:39 +11:00
Stefan Haller 4b4dccfd7d
Fix "move patch into new commit" for partial hunk (#2507) 2023-03-18 18:17:47 +11:00
Jesse Duffield f7e8b2dd71 cleanup integration test code 2023-02-26 12:54:13 +11:00
Jesse Duffield 8b5d59c238 remove legacy integration tests 2023-02-26 11:34:18 +11:00
Jesse Duffield 9c645088bf give CI longer wait times before failing assertions 2023-02-25 21:37:16 +11:00
Jesse Duffield dd1bf629b8 migrate patch building tests 2023-02-25 21:37:16 +11:00
Jesse Duffield db011d8e34 Improve staging panel integration tests 2023-02-25 11:35:41 +11:00
Jesse Duffield c63fed2074 migrate staging tests 2023-02-23 22:29:40 +11:00
Jesse Duffield 1034962c7e migrate more tests 2023-02-22 22:29:01 +11:00
Jesse Duffield eabe7f462a migrate more tests 2023-02-22 21:57:32 +11:00
Jesse Duffield bfde06d049 migrate push tests 2023-02-21 21:50:03 +11:00
Jesse Duffield 2b6a109e38 migrate stash tests 2023-02-20 21:52:27 +11:00
Jesse Duffield daf8176dd7 add tag checkout test 2023-02-20 19:01:08 +11:00
Ryoga 72a92d748f
test: fix TagNamesAt
Co-authored-by: Jesse Duffield <jessedduffield@gmail.com>
2023-02-19 23:35:38 +09:00
Ryooooooga 36c2b00336
test: add an integration test for creating tag on branches 2023-02-19 23:35:38 +09:00
Jesse Duffield b5e325b0a4 migrate revert merge test 2023-02-19 15:48:09 +11:00
Jesse Duffield 31d796ee75 migrate forcePush integration test 2023-02-19 13:38:15 +11:00
stk 4d39668743 Undo a change made in #2444 that we didn't end up needing 2023-02-18 09:53:31 +01:00
Jesse Duffield c517d1e0a2 update view cursor when selecting new line in patch explorer view 2023-02-18 10:19:34 +11:00
stk ff2a799200 Make SelectedLine/SelectedLineIdx work in staging/stagingSecondary views
While we try to keep the view's cursor position in sync with the context state's
selectedLineIdx (at least when pressing up or down), there are enough situations
where the two run out of sync; for example when initially opening the view, or
after staging a hunk, or when scrolling the view using the wheel. While it would
be possible to fix these situations to keep them always in sync, it doesn't seem
worth it, because the view's cursor position isn't really used for anything
else. So we rather special-case the SelectedLine/SelectedLineIdx functions of
ViewDriver to query the context state's selectedLineIdx directly if it is a
patch explorer context.
2023-02-15 21:22:11 +01:00
Jesse Duffield d7956c481d migrate submodule enter test 2023-02-12 18:12:01 +11:00
Jesse Duffield 7a3291a1f7 fix test 2023-02-12 18:12:01 +11:00
Jesse Duffield 010f6d7f6e migrate submodule add test 2023-02-12 10:47:41 +11:00
stk b243f30f48 Disable ~/.gitconfig when running integration tests
A global ~/.gitconfig file can have influence on how integration tests behave;
in my case, I had the option "merge.conflictStyle" set to "diff3", which made
the integration test "cherry_pick_conflict" fail because the diff was different
from what the test expected.

Make this more robust by telling git to ignore the global config file when
running tests.
2023-02-07 17:26:45 +01:00
Jesse Duffield f7f24dbfc1 better test 2023-01-26 13:25:56 +11:00
Jesse Duffield 6f709456fe migrate test for rename branch and pull 2022-12-30 22:42:32 +11:00
Jesse Duffield 277ca706eb migrate fetchPrune integration test 2022-12-30 22:42:32 +11:00
Jesse Duffield f770a6246b rename function 2022-12-28 14:19:56 +11:00
Jesse Duffield f2d0f362d4 migrate discard staged changes test 2022-12-28 13:24:23 +11:00
Jesse Duffield 14a974742f rename from asserter to driver 2022-12-28 11:27:48 +11:00
Jesse Duffield 9fef4447b6 move popup assertions into a struct 2022-12-28 11:00:22 +11:00
Jesse Duffield 7aa843c75a create actions struct 2022-12-28 10:54:38 +11:00
Jesse Duffield a27092a7ad remove broken test 2022-12-28 10:43:14 +11:00
Jesse Duffield a3450dfdfc fix suggestions test 2022-12-28 10:41:42 +11:00
Jesse Duffield f495945b87 fix bug 2022-12-28 10:29:32 +11:00
Jesse Duffield 06c878c051 minor changes 2022-12-28 10:23:54 +11:00
Jesse Duffield ed93e0a2b0 remove dependency on model 2022-12-27 22:52:20 +11:00
Jesse Duffield c5050ecabd move shell into test driver 2022-12-27 21:47:37 +11:00
Jesse Duffield 78b495f50a rename input to t 2022-12-27 21:35:36 +11:00
Jesse Duffield 53e06b71ae add tap function 2022-12-27 21:26:18 +11:00
Jesse Duffield b166b8f776 combine assert and input structs, clean up interface 2022-12-27 21:26:18 +11:00
Jesse Duffield c5c9f5bb94 rename 2022-12-27 21:26:18 +11:00
Jesse Duffield 09e80e5f2a better namespacing for assertions 2022-12-27 21:26:18 +11:00
Jesse Duffield be30cbb375 add view asserter getter struct 2022-12-27 21:26:18 +11:00
Jesse Duffield b64f55518b refactor commit message stuff in integration tests 2022-12-27 21:26:18 +11:00
Jesse Duffield 926ed7b9b2 more refactoring of popup stuff 2022-12-27 21:26:18 +11:00
Jesse Duffield 8052ac4fd6 add prompt asserter 2022-12-27 21:26:18 +11:00
Jesse Duffield c976839a63 refactor prompt handling in integration tests 2022-12-27 21:26:17 +11:00
Jesse Duffield 09db4c4397 allow checking if line is selected in Lines and TopLines methods 2022-12-26 17:45:10 +11:00
Jesse Duffield 96310288ee allow chaining matchers 2022-12-26 17:15:33 +11:00
Jesse Duffield c841ba8237 add switch-to-view methods 2022-12-26 16:49:54 +11:00
Jesse Duffield 9a6f21ce42 cleaner test assertions 2022-12-26 12:20:13 +11:00
Jesse Duffield fa0414777f rename SelectedLine to CurrentLine in tests 2022-12-26 10:42:19 +11:00
Jesse Duffield 5d2584a188 introduce ViewLines functions 2022-12-25 11:38:00 +11:00
Jesse Duffield b623ecf898 add helper functions for popups in tests 2022-12-24 19:15:59 +11:00
Jesse Duffield aedfce2845 refactor to not have Match at the start of assert method names, because it reads better that way 2022-12-24 19:14:52 +11:00
Jesse Duffield 13639ac924 faster test 2022-12-24 19:05:46 +11:00
Jesse Duffield 5c11b1ecb7 discard changes integration test 2022-12-24 19:05:46 +11:00
Jesse Duffield 7c7f7bf9b9 migrate diffing integration tests 2022-12-21 22:52:23 +11:00
Jesse Duffield dde70486a1 apply user config changes in sandbox mode 2022-12-20 23:07:43 +11:00
Jesse Duffield e3c6738535 remove snapshot approach for new integration tests 2022-12-20 22:45:03 +11:00
Jesse Duffield bc4ace8357 add commit revert integration test 2022-12-20 22:45:02 +11:00
Jesse Duffield b40190bd94 add multi-line commit integration test 2022-12-20 22:45:02 +11:00
Nils Andresen 245563bc99 (#2288) quote remoteName before compiling regex
If the remote name contains special regex-chars,
the compilation of the regex might fail.
Quoting the remoteName ensures that all special chars
in the remoteName are properly escaped before compiling
the regex.
2022-11-24 12:56:28 +00:00
Jesse Duffield f98b2edae5 fix broken CI (see https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html)
try this

WIP
2022-11-12 18:09:15 -03:30
Jesse Duffield 97ced9e14f fix could-not-access error 2022-11-12 18:09:15 -03:30
Andrew Hynes a47e72892a
Merge branch 'master' into stash-untracked-changes 2022-11-01 16:08:34 -02:30
Ryooooooga e78e829e3a
test: add an integration test for rename stash 2022-10-16 09:30:03 +09:00
Gustavo Andrioli 39e84e13f4 Use lazycore utils: Clamp and GetLazyRootDirectory 2022-10-15 13:55:44 -03:00
Andrew Hynes 8c46a0110d
Merge branch 'master' into stash-untracked-changes 2022-10-06 22:59:06 -02:30
Jesse Duffield 23d39c79b2 update test 2022-09-24 23:37:17 +02:00
Luka Markušić 0141bbde0e Add test for amending a merge commit 2022-09-24 23:37:17 +02:00
Luka Markušić 4c7d363959 Add CheckoutBranch and Merge helpers for integration tests 2022-09-24 23:37:17 +02:00
jiepeng b8900baf1a remove deprecated calls 2022-09-17 15:10:41 -07:00
Jesse Duffield 6dca3e1766 allow two attempts on CI 2022-09-16 22:31:46 -07:00
Jesse Duffield 74acb3e86a add integration tests for cherry picking 2022-09-16 22:15:16 -07:00
Jesse Duffield 7af7af27c6 various changes to improve integration tests 2022-09-16 08:42:39 -07:00
Andrew Hynes db9373662a test: add test for basic stash 2022-09-15 23:11:27 -02:30
Jesse Duffield 7b757d1cfe add branch rebase integration test 2022-09-09 20:55:47 -07:00
Jesse Duffield 8cdfc6758f add another bisect integration test 2022-09-09 20:55:47 -07:00
Jesse Duffield 010f430d1f add bisect integration test 2022-09-09 20:55:47 -07:00
Jesse Duffield 47f84b6aea better assertions 2022-09-09 20:55:47 -07:00
Ryooooooga 6248091e9c
test: improve integration test portability 2022-08-18 23:48:53 +09:00
Jesse Duffield fed2aaf37f migrate menuFromCommand integration test 2022-08-14 21:30:37 +10:00
Jesse Duffield b2ae651686 add slow flag to integration tests 2022-08-14 20:49:20 +10:00
Jesse Duffield e875d6b448 ensuring you can't accidentally forget to add a test to the tests list 2022-08-14 20:49:20 +10:00
Jesse Duffield 53979f7cec a more complex custom command test 2022-08-14 20:49:20 +10:00
Jesse Duffield 5173d7f5e1 better CLI interface 2022-08-14 17:20:52 +10:00
Jesse Duffield 349a7d2453 even better structure 2022-08-14 11:24:07 +10:00
Jesse Duffield d1b093e703 no need for this 2022-08-13 19:30:51 +10:00
Jesse Duffield 5e475355bf add tests for my tests 2022-08-13 13:56:50 +10:00
Jesse Duffield 304d74370e refactor to ensure code doesn't depend on integration code 2022-08-13 13:56:50 +10:00
Jesse Duffield faed509bfd fix CI 2022-08-13 13:56:50 +10:00
Jesse Duffield b8d9443999 rename helpers to components 2022-08-13 13:55:17 +10:00