1
0
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:
Jesse Duffield
2023-02-26 11:49:15 +11:00
parent 8b5d59c238
commit f7e8b2dd71
70 changed files with 322 additions and 272 deletions

View File

@ -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: "",

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"),
)
}

View File

@ -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"))

View 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"),
)
}