diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-12-29 23:25:35 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-19 09:23:55 +0100 |
commit | 98671802020883be6b3e10268db8542bf6c00324 (patch) | |
tree | 491a1ecb51b2f22eed1770e274e815c757391311 | |
parent | 8dec35ba6738444beed8209f2c89654302468557 (diff) |
Add test showing how branch should stay selected after fetching (but doesn't yet)
-rw-r--r-- | pkg/integration/tests/sync/fetch_when_sorted_by_date.go | 54 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/pkg/integration/tests/sync/fetch_when_sorted_by_date.go b/pkg/integration/tests/sync/fetch_when_sorted_by_date.go new file mode 100644 index 000000000..d3230b233 --- /dev/null +++ b/pkg/integration/tests/sync/fetch_when_sorted_by_date.go @@ -0,0 +1,54 @@ +package sync + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var FetchWhenSortedByDate = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Fetch a branch while sort order is by date; verify that branch stays selected", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell. + EmptyCommitWithDate("commit", "2023-04-07 10:00:00"). // first master commit, older than branch2 + EmptyCommitWithDate("commit", "2023-04-07 12:00:00"). // second master commit, newer than branch2 + NewBranch("branch1"). // branch1 will be checked out, so its date doesn't matter + EmptyCommitWithDate("commit", "2023-04-07 11:00:00"). // branch2 commit, date is between the two master commits + NewBranch("branch2"). + Checkout("master"). + CloneIntoRemote("origin"). + SetBranchUpstream("master", "origin/master"). // upstream points to second master commit + HardReset("HEAD^"). // rewind to first master commit + Checkout("branch1") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). + Focus(). + Press(keys.Branches.SortOrder) + + t.ExpectPopup().Menu().Title(Equals("Sort order")). + Select(Contains("-committerdate")). + Confirm() + + t.Views().Branches(). + Lines( + Contains("* branch1").IsSelected(), + Contains("branch2"), + Contains("master ↓1"), + ). + NavigateToLine(Contains("master")). + Press(keys.Branches.FetchRemote). + Lines( + /* EXPECTED: + Contains("* branch1"), + Contains("master").IsSelected(), + Contains("branch2"), + ACTUAL: */ + Contains("* branch1"), + Contains("master"), + Contains("branch2").IsSelected(), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 8541f9a5c..3e34549af 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -230,6 +230,7 @@ var tests = []*components.IntegrationTest{ submodule.Remove, submodule.Reset, sync.FetchPrune, + sync.FetchWhenSortedByDate, sync.ForcePush, sync.ForcePushMultipleMatching, sync.ForcePushMultipleUpstream, |