-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Allow to switch branches in Commit View
Add integration test
- Loading branch information
1 parent
c40294e
commit dad705d
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package commit | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var Checkout = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Checkout a commit as a detached head, or checkout an existing branch at a commit", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) {}, | ||
SetupRepo: func(shell *Shell) { | ||
shell.EmptyCommit("one") | ||
shell.EmptyCommit("two") | ||
shell.NewBranch("branch1") | ||
shell.NewBranch("branch2") | ||
shell.EmptyCommit("three") | ||
shell.EmptyCommit("four") | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Commits(). | ||
Focus(). | ||
Lines( | ||
Contains("four").IsSelected(), | ||
Contains("three"), | ||
Contains("two"), | ||
Contains("one"), | ||
). | ||
PressPrimaryAction() | ||
|
||
t.ExpectPopup().Menu(). | ||
Title(Contains("Checkout branch or commit")). | ||
Lines( | ||
Contains("Checkout commit as detached head").IsSelected(), | ||
Contains("Checkout branch"), | ||
Contains("Cancel"), | ||
). | ||
Select(Contains("Checkout branch")). | ||
Tooltip(Contains("Disabled: No branches found at selected commit.")). | ||
Select(Contains("Checkout commit as detached head")). | ||
Confirm() | ||
t.Views().Branches().Lines( | ||
Contains("* (HEAD detached at"), | ||
Contains("branch2"), | ||
Contains("branch1"), | ||
Contains("master"), | ||
) | ||
|
||
t.Views().Commits(). | ||
NavigateToLine(Contains("two")). | ||
PressPrimaryAction() | ||
|
||
t.ExpectPopup().Menu(). | ||
Title(Contains("Checkout branch or commit")). | ||
Lines( | ||
Contains("Checkout commit as detached head").IsSelected(), | ||
Contains("Checkout branch").Contains("branch1"), | ||
Contains("Checkout branch").Contains("master"), | ||
Contains("Cancel"), | ||
). | ||
Select(Contains("Checkout branch").Contains("branch1")). | ||
Confirm() | ||
t.Views().Branches().Lines( | ||
Contains("branch1"), | ||
Contains("branch2"), | ||
Contains("master"), | ||
) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters