| 
 | 1 | +package commit  | 
 | 2 | + | 
 | 3 | +import (  | 
 | 4 | +	"github.com/jesseduffield/lazygit/pkg/config"  | 
 | 5 | +	. "github.com/jesseduffield/lazygit/pkg/integration/components"  | 
 | 6 | +)  | 
 | 7 | + | 
 | 8 | +var AddCoAuthor = NewIntegrationTest(NewIntegrationTestArgs{  | 
 | 9 | +	Description:  "Add co-author on a commit",  | 
 | 10 | +	ExtraCmdArgs: []string{},  | 
 | 11 | +	Skip:         false,  | 
 | 12 | +	SetupConfig:  func(config *config.AppConfig) {},  | 
 | 13 | +	SetupRepo: func(shell *Shell) {  | 
 | 14 | +		shell.NewBranch("original")  | 
 | 15 | + | 
 | 16 | +		shell. SetConfig( "user.email",  "[email protected]")   | 
 | 17 | +		shell.SetConfig("user.name", "Bill Smith")  | 
 | 18 | + | 
 | 19 | +		shell.EmptyCommit("one")  | 
 | 20 | + | 
 | 21 | +		shell.NewBranch("other")  | 
 | 22 | + | 
 | 23 | +		shell. SetConfig( "user.email",  "[email protected]")   | 
 | 24 | +		shell.SetConfig("user.name", "John Smith")  | 
 | 25 | + | 
 | 26 | +		shell.EmptyCommit("two")  | 
 | 27 | + | 
 | 28 | +		shell.Checkout("original")  | 
 | 29 | +	},  | 
 | 30 | +	Run: func(t *TestDriver, keys config.KeybindingConfig) {  | 
 | 31 | +		t.Views().Commits().  | 
 | 32 | +			Focus().  | 
 | 33 | +			Lines(  | 
 | 34 | +				Contains("BS").Contains("one").IsSelected(),  | 
 | 35 | +			)  | 
 | 36 | + | 
 | 37 | +		t.Views().Branches().  | 
 | 38 | +			Focus().  | 
 | 39 | +			Lines(  | 
 | 40 | +				Contains("original").IsSelected(),  | 
 | 41 | +				Contains("other"),  | 
 | 42 | +			).  | 
 | 43 | +			NavigateToLine(Contains("other")).  | 
 | 44 | +			PressEnter()  | 
 | 45 | + | 
 | 46 | +		// ensuring we get these commit authors as suggestions  | 
 | 47 | +		t.Views().SubCommits().  | 
 | 48 | +			IsFocused().  | 
 | 49 | +			Lines(  | 
 | 50 | +				Contains("JS").Contains("two").IsSelected(),  | 
 | 51 | +				Contains("BS").Contains("one"),  | 
 | 52 | +			)  | 
 | 53 | + | 
 | 54 | +		t.Views().Commits().  | 
 | 55 | +			Focus().  | 
 | 56 | +			Press(keys.Commits.ResetCommitAuthor).  | 
 | 57 | +			Tap(func() {  | 
 | 58 | +				t.ExpectPopup().Menu().  | 
 | 59 | +					Title(Equals("Amend commit attribute")).  | 
 | 60 | +					Select(Contains("Add co-author")).  | 
 | 61 | +					Confirm()  | 
 | 62 | + | 
 | 63 | +				t.ExpectPopup().Prompt().  | 
 | 64 | +					Title(Contains("Add co-author")).  | 
 | 65 | +					SuggestionLines(  | 
 | 66 | +						Contains("Bill Smith"),  | 
 | 67 | +						Contains("John Smith"),  | 
 | 68 | +					).  | 
 | 69 | +					ConfirmSuggestion(Contains("John Smith"))  | 
 | 70 | +			})  | 
 | 71 | +		t.Views().Main().ContainsLines(  | 
 | 72 | +			Contains("Co-authored-by"),  | 
 | 73 | +		)  | 
 | 74 | +	},  | 
 | 75 | +})  | 
0 commit comments