2023-01-18 17:35:40 +02:00
|
|
|
package patch_building
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
|
|
)
|
|
|
|
|
2023-02-19 02:44:17 +02:00
|
|
|
var CopyPatchToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
2023-01-18 17:35:40 +02:00
|
|
|
Description: "Create a patch from the commits and copy the patch to clipbaord.",
|
2023-05-21 09:00:29 +02:00
|
|
|
ExtraCmdArgs: []string{},
|
2023-02-25 04:08:45 +02:00
|
|
|
Skip: true, // skipping because CI doesn't have clipboard functionality
|
2023-01-18 17:35:40 +02:00
|
|
|
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 04:25:56 +02:00
|
|
|
PressPrimaryAction()
|
|
|
|
|
2023-05-25 13:11:51 +02:00
|
|
|
t.Views().Information().Content(Contains("Building patch"))
|
2023-01-26 04:25:56 +02:00
|
|
|
|
2023-02-26 02:49:15 +02:00
|
|
|
t.Common().SelectPatchOption(Contains("copy patch to clipboard"))
|
2023-01-23 12:18:43 +02:00
|
|
|
|
2023-01-26 04:25:56 +02:00
|
|
|
t.ExpectToast(Contains("Patch copied to clipboard"))
|
2023-01-18 17:35:40 +02:00
|
|
|
|
2023-01-26 04:25:56 +02:00
|
|
|
t.ExpectClipboard(Contains("diff --git a/file1 b/file1"))
|
2023-01-18 17:35:40 +02:00
|
|
|
},
|
|
|
|
})
|