blob: 6b1d5d1f6d468ef96925ca7174d0d92018ed5d9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package misc
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// We're emulating the clipboard by writing to a file called clipboard
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Copy a branch name to the clipboard using custom clipboard command template",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.OS.CopyToClipboardCmd = "echo {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-a")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("branch-a").IsSelected(),
).
Press(keys.Universal.CopyToClipboard)
t.ExpectToast(Equals("'branch-a' Copied to clipboard"))
t.Views().Files().
Focus()
t.GlobalPress(keys.Files.RefreshFiles)
// Expect to see the clipboard file with contents
t.Views().Files().
IsFocused().
Lines(
Contains("clipboard").IsSelected(),
)
t.Views().Main().Content(Contains("branch-a"))
},
})
|