Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Amend = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amends the last commit from the files panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "myfile content\n") shell.Commit("first commit") shell.UpdateFileAndAdd("myfile", "myfile content\nmore content\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Lines( Contains("first commit"), ) t.Views().Files(). Focus(). Press(keys.Commits.AmendToCommit) t.ExpectPopup().Confirmation().Title( Equals("Amend Last Commit")). Content(Contains("Are you sure you want to amend last commit?")). Confirm() t.Views().Commits(). Focus(). Lines( Contains("first commit"), ) t.Views().Main().Content(Contains("+myfile content").Contains("+more content")) }, })
View Source
var Commit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a couple files and committing", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFile("myfile", "myfile content") shell.CreateFile("myfile2", "myfile2 content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). IsEmpty() t.Views().Files(). IsFocused(). Lines( Contains("?? myfile").IsSelected(), Contains("?? myfile2"), ). PressPrimaryAction(). Lines( Contains("A myfile").IsSelected(), Contains("?? myfile2"), ). SelectNextItem(). PressPrimaryAction(). Lines( Contains("A myfile"), Contains("A myfile2").IsSelected(), ). Press(keys.Files.CommitChanges) commitMessage := "my commit message" t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Files(). IsEmpty() t.Views().Commits(). Focus(). Lines( Contains(commitMessage).IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A myfile"), Contains("A myfile2"), ) }, })
View Source
var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Commit with a multi-line commit message", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFile("myfile", "myfile content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). IsEmpty() t.Views().Files(). IsFocused(). PressPrimaryAction(). Press(keys.Files.CommitChanges) t.ExpectPopup().CommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm() t.Views().Commits(). Lines( Contains("first line"), ) t.Views().Commits().Focus() t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line")) }, })
View Source
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new tag on a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("two").IsSelected(), Contains("one"), ). Press(keys.Commits.CreateTag) t.ExpectPopup().Menu(). Title(Equals("Create tag")). Select(Contains("lightweight")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("Tag name:")). Type("new-tag"). Confirm() t.Views().Commits(). Lines( MatchesRegexp(`new-tag.*two`).IsSelected(), MatchesRegexp(`one`), ) t.Views().Tags(). Focus(). Lines( MatchesRegexp(`new-tag.*two`).IsSelected(), ) t.Git(). TagNamesAt("HEAD", []string{"new-tag"}) }, })
View Source
var DiscardOldFileChange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding a single file from an old commit (does rebase in background to remove the file but retain the other one)", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file0", "file0") shell.Commit("first commit") shell.CreateFileAndAdd("file1", "file2") shell.CreateFileAndAdd("fileToRemove", "fileToRemove") shell.Commit("commit to change") shell.CreateFileAndAdd("file3", "file3") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to change"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), Contains("fileToRemove"), ). SelectNextItem(). Press(keys.Universal.Remove) t.ExpectPopup().Confirmation(). Title(Equals("Discard file changes")). Content(Contains("Are you sure you want to discard this commit's changes to this file?")). Confirm() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ) t.FileSystem().PathNotPresent("fileToRemove") }, })
View Source
var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Creating a new branch from a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("commit 1"). EmptyCommit("commit 2"). EmptyCommit("commit 3") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 3").IsSelected(), Contains("commit 2"), Contains("commit 1"), ). SelectNextItem(). Press(keys.Universal.New). Tap(func() { branchName := "my-branch-name" t.ExpectPopup().Prompt().Title(Contains("New Branch Name")).Type(branchName).Confirm() t.Git().CurrentBranchName(branchName) }). Lines( Contains("commit 2"), Contains("commit 1"), ) }, })
View Source
var ResetAuthor = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reset author on a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.SetConfig("user.email", "Bill@example.com") shell.SetConfig("user.name", "Bill Smith") shell.EmptyCommit("one") shell.SetConfig("user.email", "John@example.com") shell.SetConfig("user.name", "John Smith") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("BS").Contains("one").IsSelected(), ). Press(keys.Commits.ResetCommitAuthor). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Amend commit attribute")). Select(Contains("reset author")). Confirm() }). Lines( Contains("JS").Contains("one").IsSelected(), ) }, })
View Source
var Revert = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reverts a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFile("myfile", "myfile content") shell.GitAddAll() shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit"), ). Press(keys.Commits.RevertCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Revert commit")). Content(MatchesRegexp(`Are you sure you want to revert \w+?`)). Confirm() }). Lines( Contains("Revert \"first commit\"").IsSelected(), Contains("first commit"), ) t.Views().Main().Content(Contains("-myfile content")) t.FileSystem().PathNotPresent("myfile") }, })
View Source
var RevertMerge = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reverts a merge commit and chooses to revert to the parent commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shared.CreateMergeCommit(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Focus(). TopLines( Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(), ). Press(keys.Commits.RevertCommit) t.ExpectPopup().Menu(). Title(Equals("Select parent commit for merge")). Lines( Contains("first change"), Contains("second-change-branch unrelated change"), Contains("cancel"), ). Select(Contains("first change")). Confirm() t.Views().Commits().IsFocused(). TopLines( Contains("Revert \"Merge branch 'second-change-branch' into first-change-branch\""), Contains("Merge branch 'second-change-branch' into first-change-branch").IsSelected(), ). SelectPreviousItem() t.Views().Main().Content(Contains("-Second Change").Contains("+First Change")) }, })
View Source
var Search = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Search for a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.EmptyCommit("four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press(keys.Universal.StartSearch). Tap(func() { t.ExpectSearch(). Type("two"). Confirm() t.Views().Search().Content(Contains("matches for 'two' (1 of 1)")) }). Lines( Contains("four"), Contains("three"), Contains("two").IsSelected(), Contains("one"), ). Press(keys.Universal.StartSearch). Tap(func() { t.ExpectSearch(). Type("o"). Confirm() t.Views().Search().Content(Contains("matches for 'o' (2 of 3)")) }). Lines( Contains("four"), Contains("three"), Contains("two").IsSelected(), Contains("one"), ). Press("n"). Tap(func() { t.Views().Search().Content(Contains("matches for 'o' (3 of 3)")) }). Lines( Contains("four"), Contains("three"), Contains("two"), Contains("one").IsSelected(), ). Press("n"). Tap(func() { t.Views().Search().Content(Contains("matches for 'o' (1 of 3)")) }). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press("n"). Tap(func() { t.Views().Search().Content(Contains("matches for 'o' (2 of 3)")) }). Lines( Contains("four"), Contains("three"), Contains("two").IsSelected(), Contains("one"), ). Press("N"). Tap(func() { t.Views().Search().Content(Contains("matches for 'o' (1 of 3)")) }). Lines( Contains("four").IsSelected(), Contains("three"), Contains("two"), Contains("one"), ). Press("N"). Tap(func() { t.Views().Search().Content(Contains("matches for 'o' (3 of 3)")) }). Lines( Contains("four"), Contains("three"), Contains("two"), Contains("one").IsSelected(), ) }, })
View Source
var SetAuthor = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Set author on a commit", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.SetConfig("user.email", "Bill@example.com") shell.SetConfig("user.name", "Bill Smith") shell.EmptyCommit("one") shell.SetConfig("user.email", "John@example.com") shell.SetConfig("user.name", "John Smith") shell.EmptyCommit("two") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("JS").Contains("two").IsSelected(), Contains("BS").Contains("one"), ). Press(keys.Commits.ResetCommitAuthor). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Amend commit attribute")). Select(Contains(" set author")). Confirm() t.ExpectPopup().Prompt(). Title(Contains("Set author")). SuggestionLines( Contains("John Smith"), Contains("Bill Smith"), ). ConfirmSuggestion(Contains("John Smith")) }). Lines( Contains("JS").Contains("two").IsSelected(), Contains("BS").Contains("one"), ) }, })
View Source
var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a range of lines", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n") shell.Commit("Add file") shell.UpdateFile("myfile", "1st changed\n2nd changed\n3rd\n4th\n5th changed\n6th\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). PressEnter() t.Views().Staging(). Content( Contains("-1st\n-2nd\n+1st changed\n+2nd changed\n 3rd\n 4th\n-5th\n+5th changed\n 6th"), ). SelectedLine(Equals("-1st")). Press(keys.Main.ToggleDragSelect). SelectNextItem(). SelectNextItem(). SelectNextItem(). SelectNextItem(). PressPrimaryAction(). Content( Contains(" 3rd\n 4th\n-5th\n+5th changed\n 6th"), ). SelectedLine(Equals("-5th")) }, })
View Source
var Staged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). IsEmpty() t.Views().Files(). IsFocused(). SelectedLine(Contains("myfile")). PressPrimaryAction(). PressEnter() t.Views().StagingSecondary(). IsFocused(). Tap(func() { t.Views().StagingSecondary().Content(Contains("+myfile content")) t.Views().StagingSecondary().Content(Contains("+with a second line")) t.Views().Staging().Content(DoesNotContain("+myfile content")) t.Views().Staging().Content(DoesNotContain("+with a second line")) }). PressPrimaryAction(). Tap(func() { t.Views().StagingSecondary().Content(DoesNotContain("+myfile content")) t.Views().StagingSecondary().Content(Contains("+with a second line")) t.Views().Staging().Content(Contains("+myfile content")) t.Views().Staging().Content(DoesNotContain("+with a second line")) }). Press(keys.Files.CommitChanges) commitMessage := "my commit message" t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( Contains(commitMessage), ) t.Views().StagingSecondary(). IsEmpty() t.Views().Staging(). IsFocused(). Content(Contains("+myfile content")). Content(DoesNotContain("+with a second line")) }, })
View Source
var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing without pre-commit hooks", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). IsEmpty() t.Views().Files(). IsFocused(). SelectedLine(Contains("myfile")). PressPrimaryAction(). PressEnter() t.Views().StagingSecondary().Content( Contains("+myfile content").Contains("+with a second line"), ) t.Views().Staging().Content( DoesNotContain("+myfile content").DoesNotContain("+with a second line"), ) t.Views().StagingSecondary(). IsFocused(). PressPrimaryAction(). Tap(func() { t.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line")) }). Content(DoesNotContain("+myfile content").Contains("+with a second line")). Press(keys.Files.CommitChangesWithoutHook) commitMessage := ": my commit message" t.ExpectPopup().CommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm() t.Views().Commits(). Lines( Contains("WIP" + commitMessage), ) t.Views().StagingSecondary(). IsEmpty() t.Views().Staging(). IsFocused(). Content(Contains("+myfile content")). Content(DoesNotContain("+with a second line")) }, })
View Source
var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CreateFile("myfile", "myfile content\nwith a second line"). CreateFile("myfile2", "myfile2 content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). IsEmpty() t.Views().Files(). IsFocused(). SelectedLine(Contains("myfile")). PressEnter() t.Views().Staging(). IsFocused(). Tap(func() { t.Views().StagingSecondary().Content(DoesNotContain("+myfile content")) t.Views().Staging().SelectedLine(Equals("+myfile content")) }). PressPrimaryAction(). Tap(func() { t.Views().Staging().Content(DoesNotContain("+myfile content")). SelectedLine(Equals("+with a second line")) t.Views().StagingSecondary().Content(Contains("+myfile content")) }). Press(keys.Files.CommitChanges) commitMessage := "my commit message" t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( Contains(commitMessage), ) t.Views().Staging().IsFocused() }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.