2023-01-18 21:05:40 +05:30
|
|
|
package patch_building
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
2023-02-19 11:44:17 +11:00
|
|
|
var CopyPatchToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
2023-01-18 21:05:40 +05:30
|
|
|
Description: "Create a patch from the commits and copy the patch to clipbaord.",
|
2023-05-21 17:00:29 +10:00
|
|
|
ExtraCmdArgs: []string{},
|
2023-02-25 13:08:45 +11:00
|
|
|
Skip: true, // skipping because CI doesn't have clipboard functionality
|
2023-01-18 21:05:40 +05:30
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.NewBranch("branch-a")
|
|
|
|
shell.CreateFileAndAdd("file1", "first line\n")
|
|
|
|
shell.Commit("first commit")
|
|
|
|
|
|
|
|
shell.NewBranch("branch-b")
|
|
|
|
shell.UpdateFileAndAdd("file1", "first line\nsecond line\n")
|
|
|
|
shell.Commit("update")
|
|
|
|
|
|
|
|
shell.Checkout("branch-a")
|
|
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
|
|
t.Views().Branches().
|
|
|
|
Focus().
|
|
|
|
Lines(
|
|
|
|
Contains("branch-a").IsSelected(),
|
|
|
|
Contains("branch-b"),
|
|
|
|
).
|
|
|
|
Press(keys.Universal.NextItem).
|
|
|
|
PressEnter().
|
|
|
|
PressEnter()
|
|
|
|
t.Views().
|
|
|
|
CommitFiles().
|
|
|
|
Lines(
|
|
|
|
Contains("M file1").IsSelected(),
|
|
|
|
).
|
2023-01-26 13:25:56 +11:00
|
|
|
PressPrimaryAction()
|
|
|
|
|
2023-05-25 21:11:51 +10:00
|
|
|
t.Views().Information().Content(Contains("Building patch"))
|
2023-01-26 13:25:56 +11:00
|
|
|
|
2023-02-26 11:49:15 +11:00
|
|
|
t.Common().SelectPatchOption(Contains("copy patch to clipboard"))
|
2023-01-23 15:48:43 +05:30
|
|
|
|
2023-01-26 13:25:56 +11:00
|
|
|
t.ExpectToast(Contains("Patch copied to clipboard"))
|
2023-01-18 21:05:40 +05:30
|
|
|
|
2023-01-26 13:25:56 +11:00
|
|
|
t.ExpectClipboard(Contains("diff --git a/file1 b/file1"))
|
2023-01-18 21:05:40 +05:30
|
|
|
},
|
|
|
|
})
|