mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
Add test showing how branch should stay selected after fetching (but doesn't yet)
This commit is contained in:
parent
8dec35ba67
commit
9867180202
54
pkg/integration/tests/sync/fetch_when_sorted_by_date.go
Normal file
54
pkg/integration/tests/sync/fetch_when_sorted_by_date.go
Normal file
@ -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(),
|
||||
)
|
||||
},
|
||||
})
|
@ -230,6 +230,7 @@ var tests = []*components.IntegrationTest{
|
||||
submodule.Remove,
|
||||
submodule.Reset,
|
||||
sync.FetchPrune,
|
||||
sync.FetchWhenSortedByDate,
|
||||
sync.ForcePush,
|
||||
sync.ForcePushMultipleMatching,
|
||||
sync.ForcePushMultipleUpstream,
|
||||
|
Loading…
x
Reference in New Issue
Block a user