mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
cleanup integration test code
This commit is contained in:
@ -5,25 +5,6 @@ import (
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
func createTwoBranchesReadyToForcePush(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.EmptyCommit("two")
|
||||
|
||||
shell.NewBranch("other_branch")
|
||||
|
||||
shell.CloneIntoRemote("origin")
|
||||
|
||||
shell.SetBranchUpstream("master", "origin/master")
|
||||
shell.SetBranchUpstream("other_branch", "origin/other_branch")
|
||||
|
||||
// remove the 'two' commit so that we have something to pull from the remote
|
||||
shell.HardReset("HEAD^")
|
||||
|
||||
shell.Checkout("master")
|
||||
// doing the same for master
|
||||
shell.HardReset("HEAD^")
|
||||
}
|
||||
|
||||
var ForcePushMultipleUpstream = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Force push to only the upstream branch of the current branch because the user has push.default upstream",
|
||||
ExtraCmdArgs: "",
|
||||
|
@ -40,7 +40,7 @@ var PullMergeConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
IsFocused().
|
||||
Press(keys.Universal.Pull)
|
||||
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -60,7 +60,7 @@ var PullMergeConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
).
|
||||
PressPrimaryAction() // choose 'content4'
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Status().Content(Contains("↑2 repo → master"))
|
||||
|
||||
|
@ -40,7 +40,7 @@ var PullRebaseConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
IsFocused().
|
||||
Press(keys.Universal.Pull)
|
||||
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
@ -61,7 +61,7 @@ var PullRebaseConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // choose 'content4'
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Status().Content(Contains("↑1 repo → master"))
|
||||
|
||||
|
@ -42,7 +42,7 @@ var PullRebaseInteractiveConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
IsFocused().
|
||||
Press(keys.Universal.Pull)
|
||||
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
@ -71,7 +71,7 @@ var PullRebaseInteractiveConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // choose 'content4'
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Status().Content(Contains("↑2 repo → master"))
|
||||
|
||||
|
@ -42,7 +42,7 @@ var PullRebaseInteractiveConflictDrop = NewIntegrationTest(NewIntegrationTestArg
|
||||
IsFocused().
|
||||
Press(keys.Universal.Pull)
|
||||
|
||||
t.Actions().AcknowledgeConflicts()
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
@ -79,7 +79,7 @@ var PullRebaseInteractiveConflictDrop = NewIntegrationTest(NewIntegrationTestArg
|
||||
SelectNextItem().
|
||||
PressPrimaryAction() // choose 'content4'
|
||||
|
||||
t.Actions().ContinueOnConflictsResolved()
|
||||
t.Common().ContinueOnConflictsResolved()
|
||||
|
||||
t.Views().Status().Content(Contains("↑1 repo → master"))
|
||||
|
||||
|
@ -30,28 +30,3 @@ var Push = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assertSuccessfullyPushed(t)
|
||||
},
|
||||
})
|
||||
|
||||
func assertSuccessfullyPushed(t *TestDriver) {
|
||||
t.Views().Status().Content(Contains("✓ repo → master"))
|
||||
|
||||
t.Views().Remotes().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("origin"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().RemoteBranches().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("master"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().SubCommits().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
)
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ var PushWithCredentialPrompt = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
// actually getting a password prompt is tricky: it requires SSH'ing into localhost under a newly created, restricted, user.
|
||||
// This is not easy to do in a cross-platform way, nor is it easy to do in a docker container.
|
||||
// If you can think of a way to do it, please let me know!
|
||||
shell.RunCommand("cp ../../../../../hooks/pre-push .git/hooks/pre-push")
|
||||
shell.RunCommand("chmod +x .git/hooks/pre-push")
|
||||
shell.CopyHelpFile("pre-push", ".git/hooks/pre-push")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Status().Content(Contains("↑1 repo → master"))
|
||||
|
49
pkg/integration/tests/sync/shared.go
Normal file
49
pkg/integration/tests/sync/shared.go
Normal file
@ -0,0 +1,49 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
func createTwoBranchesReadyToForcePush(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.EmptyCommit("two")
|
||||
|
||||
shell.NewBranch("other_branch")
|
||||
|
||||
shell.CloneIntoRemote("origin")
|
||||
|
||||
shell.SetBranchUpstream("master", "origin/master")
|
||||
shell.SetBranchUpstream("other_branch", "origin/other_branch")
|
||||
|
||||
// remove the 'two' commit so that we have something to pull from the remote
|
||||
shell.HardReset("HEAD^")
|
||||
|
||||
shell.Checkout("master")
|
||||
// doing the same for master
|
||||
shell.HardReset("HEAD^")
|
||||
}
|
||||
|
||||
func assertSuccessfullyPushed(t *TestDriver) {
|
||||
t.Views().Status().Content(Contains("✓ repo → master"))
|
||||
|
||||
t.Views().Remotes().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("origin"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().RemoteBranches().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("master"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().SubCommits().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user