Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AmendOldCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Amend old commit", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" config.UserConfig.Gui.ShowFileTree = false }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(60) shell.NewBranch("feature/demo") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("feature/demo", "origin/feature/demo") shell.UpdateFile("navigation/site_navigation.go", "package navigation\n\nfunc Navigate() {\n\tpanic(\"unimplemented\")\n}") shell.CreateFile("docs/README.md", "my readme content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Amend an old commit") t.Wait(1000) t.Views().Files(). IsFocused(). SelectedLine(Contains("site_navigation.go")). PressPrimaryAction() t.Views().Commits(). Focus(). NavigateToLine(Contains("Improve accessibility of site navigation")). Wait(500). Press(keys.Commits.AmendToCommit). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Amend commit")). Wait(1000). Content(AnyString()). Confirm() t.Wait(1000) }). Press(keys.Universal.Push). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Force push")). Content(AnyString()). Wait(1000). Confirm() }) }, })
View Source
var Bisect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Interactive rebase", ExtraCmdArgs: []string{"log"}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateFile("my-file.txt", "myfile content") shell.CreateFile("my-other-file.rb", "my-other-file content") shell.CreateNCommitsWithRandomMessages(60) shell.NewBranch("feature/demo") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("feature/demo", "origin/feature/demo") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Git bisect") t.Wait(1000) markCommitAsBad := func() { t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as bad`)).Confirm() } markCommitAsGood := func() { t.Views().Commits(). Press(keys.Commits.ViewBisectOptions) t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm() } t.Views().Commits(). IsFocused(). Tap(func() { markCommitAsBad() t.Views().Information().Content(Contains("Bisecting")) }). SelectedLine(Contains("<-- bad")). NavigateToLine(Contains("Add TypeScript types to User module")). Tap(markCommitAsGood). SelectedLine(Contains("Add loading indicators to improve UX").Contains("<-- current")). Tap(markCommitAsBad). SelectedLine(Contains("Fix broken links on the help page").Contains("<-- current")). Tap(markCommitAsGood). SelectedLine(Contains("Add end-to-end tests for checkout flow").Contains("<-- current")). Tap(markCommitAsBad). Tap(func() { t.Wait(2000) t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s).*Do you want to reset")).Confirm() }). SetCaptionPrefix("Inspect problematic commit"). Wait(500). Press(keys.Universal.PrevScreenMode). IsFocused(). Content(Contains("Add end-to-end tests for checkout flow")). Wait(500). PressEnter() t.Views().Information().Content(DoesNotContain("Bisecting")) }, })
View Source
var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Cherry pick", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(50) shell. EmptyCommit("Fix bug in timezone conversion."). NewBranch("hotfix/fix-bug"). NewBranch("feature/user-module"). Checkout("hotfix/fix-bug"). EmptyCommit("Integrate support for markdown in user posts"). EmptyCommit("Remove unused code and libraries"). Checkout("feature/user-module"). EmptyCommit("Handle session timeout gracefully"). EmptyCommit("Add Webpack for asset bundling"). Checkout("hotfix/fix-bug") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Cherry pick commits from another branch") t.Wait(1000) t.Views().Branches(). Focus(). Lines( Contains("hotfix/fix-bug"), Contains("feature/user-module"), Contains("master"), ). SelectNextItem(). Wait(300). PressEnter() t.Views().SubCommits(). IsFocused(). TopLines( Contains("Add Webpack for asset bundling").IsSelected(), Contains("Handle session timeout gracefully"), Contains("Fix bug in timezone conversion."), ). Press(keys.Commits.CherryPickCopy). Tap(func() { t.Views().Information().Content(Contains("1 commit copied")) }). SelectNextItem(). Press(keys.Commits.CherryPickCopy) t.Views().Information().Content(Contains("2 commits copied")) t.Views().Commits(). Focus(). TopLines( Contains("Remove unused code and libraries").IsSelected(), Contains("Integrate support for markdown in user posts"), Contains("Fix bug in timezone conversion."), ). Press(keys.Commits.PasteCommits). Tap(func() { t.Wait(1000) t.ExpectPopup().Alert(). Title(Equals("Cherry-pick")). Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")). Confirm() }). TopLines( Contains("Add Webpack for asset bundling"), Contains("Handle session timeout gracefully"), Contains("Remove unused code and libraries"), Contains("Integrate support for markdown in user posts"), Contains("Fix bug in timezone conversion."), ). Tap(func() { t.Views().Information().Content(Contains("2 commits copied")) }). PressEscape(). Tap(func() { t.Views().Information().Content(DoesNotContain("commits copied")) }) }, })
View Source
var CommitAndPush = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Make a commit and push", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateFile("my-file.txt", "myfile content") shell.CreateFile("my-other-file.rb", "my-other-file content") shell.CreateNCommitsWithRandomMessages(30) shell.NewBranch("feature/demo") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("feature/demo", "origin/feature/demo") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Stage a file") t.Wait(1000) t.Views().Files(). IsFocused(). PressPrimaryAction(). SetCaptionPrefix("Commit our changes"). Press(keys.Files.CommitChanges) t.ExpectPopup().CommitMessagePanel(). Type("my commit summary"). SwitchToDescription(). Type("my commit description"). SwitchToSummary(). Confirm() t.Views().Commits(). TopLines( Contains("my commit summary"), ) t.SetCaptionPrefix("Push to the remote") t.Views().Files(). IsFocused(). Press(keys.Universal.Push) }, })
View Source
var CustomCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Invoke a custom command", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(cfg *config.AppConfig) { cfg.UserConfig.Gui.NerdFontsVersion = "2" cfg.UserConfig.CustomCommands = []config.CustomCommand{ { Key: "a", Context: "localBranches", Command: `git checkout {{.Form.Branch}}`, Prompts: []config.CustomCommandPrompt{ { Key: "Branch", Type: "input", Title: "Enter a branch name to checkout", Suggestions: config.CustomCommandSuggestions{ Preset: "branches", }, }, }, }, } }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) shell.NewBranch("feature/user-authentication") shell.NewBranch("feature/payment-processing") shell.NewBranch("feature/search-functionality") shell.NewBranch("feature/mobile-responsive") shell.EmptyCommit("Make mobile response") shell.NewBranch("bugfix/fix-login-issue") shell.HardReset("HEAD~1") shell.NewBranch("bugfix/fix-crash-bug") shell.CreateFile("custom_commands_example.yml", customCommandContent) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Invoke a custom command") t.Wait(1500) t.Views().Branches(). Focus(). Wait(500). Press("a"). Tap(func() { t.Wait(500) t.ExpectPopup().Prompt(). Title(Equals("Enter a branch name to checkout")). Type("mobile"). ConfirmFirstSuggestion() }) }, })
View Source
var CustomPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Remove a line from an old commit", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(cfg *config.AppConfig) { cfg.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) shell.NewBranch("feature/user-authentication") shell.EmptyCommit("Add user authentication feature") shell.CreateFileAndAdd("src/users.go", "package main\n") shell.Commit("Fix local session storage") shell.CreateFile("src/authentication.go", "package main") shell.CreateFile("src/session.go", "package main") shell.UpdateFileAndAdd("src/users.go", usersFileContent) shell.EmptyCommit("Stop using shims") shell.UpdateFileAndAdd("src/authentication.go", "package authentication") shell.UpdateFileAndAdd("src/session.go", "package session") shell.Commit("Enhance user authentication feature") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Remove a line from an old commit") t.Wait(1000) t.Views().Commits(). Focus(). NavigateToLine(Contains("Stop using shims")). Wait(1000). PressEnter(). Tap(func() { t.Views().CommitFiles(). IsFocused(). NavigateToLine(Contains("users.go")). Wait(1000). PressEnter(). Tap(func() { t.Views().PatchBuilding(). IsFocused(). NavigateToLine(Contains("TODO")). Wait(500). PressPrimaryAction(). PressEscape() }). Press(keys.Universal.CreatePatchOptionsMenu). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Patch options")). Select(Contains("Remove patch from original commit")). Wait(500). Confirm() }). PressEscape() }) }, })
View Source
var Filter = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Filter branches", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) shell.NewBranch("feature/user-authentication") shell.NewBranch("feature/payment-processing") shell.NewBranch("feature/search-functionality") shell.NewBranch("feature/mobile-responsive") shell.NewBranch("bugfix/fix-login-issue") shell.NewBranch("bugfix/fix-crash-bug") shell.NewBranch("bugfix/fix-validation-error") shell.NewBranch("refactor/improve-performance") shell.NewBranch("refactor/code-cleanup") shell.NewBranch("refactor/extract-method") shell.NewBranch("docs/update-readme") shell.NewBranch("docs/add-user-guide") shell.NewBranch("docs/api-documentation") shell.NewBranch("experiment/new-feature-idea") shell.NewBranch("experiment/try-new-library") shell.NewBranch("chore/update-dependencies") shell.NewBranch("chore/add-test-cases") shell.NewBranch("chore/migrate-database") shell.NewBranch("hotfix/critical-bug") shell.NewBranch("hotfix/security-patch") shell.NewBranch("feature/social-media-integration") shell.NewBranch("feature/email-notifications") shell.NewBranch("feature/admin-panel") shell.NewBranch("feature/analytics-dashboard") shell.NewBranch("bugfix/fix-registration-flow") shell.NewBranch("bugfix/fix-payment-bug") shell.NewBranch("refactor/improve-error-handling") shell.NewBranch("refactor/optimize-database-queries") shell.NewBranch("docs/improve-tutorials") shell.NewBranch("docs/add-faq-section") shell.NewBranch("experiment/try-alternative-algorithm") shell.NewBranch("experiment/implement-design-concept") shell.NewBranch("chore/update-documentation") shell.NewBranch("chore/improve-test-coverage") shell.NewBranch("chore/cleanup-codebase") shell.NewBranch("hotfix/critical-security-vulnerability") shell.NewBranch("hotfix/fix-production-issue") shell.NewBranch("feature/integrate-third-party-api") shell.NewBranch("feature/image-upload-functionality") shell.NewBranch("feature/localization-support") shell.NewBranch("feature/chat-feature") shell.NewBranch("bugfix/fix-broken-link") shell.NewBranch("bugfix/fix-css-styling") shell.NewBranch("refactor/improve-logging") shell.NewBranch("refactor/extract-reusable-component") shell.NewBranch("docs/add-changelog") shell.NewBranch("docs/update-api-reference") shell.NewBranch("experiment/implement-new-design") shell.NewBranch("experiment/try-different-architecture") shell.NewBranch("chore/clean-up-git-history") shell.NewBranch("chore/update-environment-configuration") shell.CreateFileAndAdd("env_config.rb", "EnvConfig.call(false)\n") shell.Commit("Update env config") shell.CreateFileAndAdd("env_config.rb", "# Turns out we need to pass true for this to work\nEnvConfig.call(true)\n") shell.Commit("Fix env config issue") shell.Checkout("docs/add-faq-section") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Fuzzy filter branches") t.Wait(1000) t.Views().Branches(). Focus(). Wait(500). Press(keys.Universal.StartSearch). Tap(func() { t.Wait(500) t.ExpectSearch().Type("environ").Confirm() }). Wait(500). PressEnter() }, })
View Source
var InteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Interactive rebase", ExtraCmdArgs: []string{"log"}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateFile("my-file.txt", "myfile content") shell.CreateFile("my-other-file.rb", "my-other-file content") shell.CreateNCommitsWithRandomMessages(60) shell.NewBranch("feature/demo") shell.CloneIntoRemote("origin") shell.SetBranchUpstream("feature/demo", "origin/feature/demo") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Interactive rebase") t.Wait(1000) t.Views().Commits(). IsFocused(). NavigateToLine(Contains("Add TypeScript types to User module")). Press(keys.Universal.Edit). SelectPreviousItem(). Press(keys.Universal.Remove). SelectPreviousItem(). Press(keys.Commits.SquashDown). SelectPreviousItem(). Press(keys.Commits.MarkCommitAsFixup). Press(keys.Universal.CreateRebaseOptionsMenu). Tap(func() { t.ExpectPopup().Menu(). Title(Contains("Rebase options")). Select(Contains("continue")). Confirm() }). SetCaptionPrefix("Push to remote"). Press(keys.Universal.NextScreenMode). Press(keys.Universal.Push). Tap(func() { t.ExpectPopup().Confirmation(). Title(Contains("Force push")). Content(AnyString()). Confirm() }) }, })
View Source
var NukeWorkingTree = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Nuke the working tree", ExtraCmdArgs: []string{"status"}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" config.UserConfig.Gui.AnimateExplosion = true }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("blah") shell.CreateFile("controllers/red_controller.rb", "") shell.CreateFile("controllers/green_controller.rb", "") shell.CreateFileAndAdd("controllers/blue_controller.rb", "") shell.CreateFile("controllers/README.md", "") shell.CreateFileAndAdd("views/helpers/list.rb", "") shell.CreateFile("views/helpers/sort.rb", "") shell.CreateFileAndAdd("views/users_view.rb", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Nuke the working tree") t.Wait(1000) t.Views().Files(). IsFocused(). Wait(1000). Press(keys.Files.ViewResetOptions). Tap(func() { t.Wait(1000) t.ExpectPopup().Menu(). Title(Equals("")). Select(Contains("Nuke working tree")). Confirm() }) }, })
View Source
var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage individual lines", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" config.UserConfig.Gui.ShowFileTree = false config.UserConfig.Gui.ShowCommandLog = false }, SetupRepo: func(shell *Shell) { shell.NewBranch("docs-fix") shell.CreateNCommitsWithRandomMessages(30) shell.CreateFileAndAdd("docs/README.md", originalFile) shell.Commit("Update docs/README") shell.UpdateFile("docs/README.md", updatedFile) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Stage individual lines") t.Wait(1000) t.Views().Files(). IsFocused(). PressEnter() t.Views().Staging(). IsFocused(). Press(keys.Main.ToggleDragSelect). PressFast(keys.Universal.NextItem). PressFast(keys.Universal.NextItem). Wait(500). PressPrimaryAction(). Wait(500). PressEscape() t.Views().Files(). IsFocused(). Press(keys.Files.CommitChanges). Tap(func() { t.ExpectPopup().CommitMessagePanel(). Type("Update tagline"). Confirm() }) t.Views().Commits(). Focus() }, })
View Source
var Undo = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Undo", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(config *config.AppConfig) { config.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Undo commands") t.Wait(1000) confirmCommitDrop := func() { t.ExpectPopup().Confirmation(). Title(Equals("Delete commit")). Content(Equals("Are you sure you want to delete this commit?")). Wait(500). Confirm() } confirmUndo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Undo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Wait(500). Confirm() } confirmRedo := func() { t.ExpectPopup().Confirmation(). Title(Equals("Redo")). Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)). Wait(500). Confirm() } t.Views().Commits().Focus(). SetCaptionPrefix("Drop two commits"). Wait(1000). Press(keys.Universal.Remove). Tap(confirmCommitDrop). Press(keys.Universal.Remove). Tap(confirmCommitDrop). SetCaptionPrefix("Undo the drops"). Wait(1000). Press(keys.Universal.Undo). Tap(confirmUndo). Press(keys.Universal.Undo). Tap(confirmUndo). SetCaptionPrefix("Redo the drops"). Wait(1000). Press(keys.Universal.Redo). Tap(confirmRedo). Press(keys.Universal.Redo). Tap(confirmRedo) }, })
View Source
var WorktreeCreateFromBranches = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a worktree from the branches view", ExtraCmdArgs: []string{}, Skip: false, IsDemo: true, SetupConfig: func(cfg *config.AppConfig) { cfg.UserConfig.Gui.NerdFontsVersion = "2" }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) shell.NewBranch("feature/user-authentication") shell.EmptyCommit("Add user authentication feature") shell.EmptyCommit("Fix local session storage") shell.CreateFile("src/authentication.go", "package main") shell.CreateFile("src/shims.go", "package main") shell.CreateFile("src/session.go", "package main") shell.EmptyCommit("Stop using shims") shell.UpdateFile("src/authentication.go", "package authentication") shell.UpdateFileAndAdd("src/shims.go", "// removing for now") shell.UpdateFile("src/session.go", "package session") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.SetCaptionPrefix("Create a worktree from a branch") t.Wait(1000) t.Views().Branches(). Focus(). NavigateToLine(Contains("master")). Wait(500). Press(keys.Worktrees.ViewWorktreeOptions). Tap(func() { t.Wait(500) t.ExpectPopup().Menu(). Title(Equals("Worktree")). Select(Contains("Create worktree from master").DoesNotContain("detached")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("New worktree path")). Type("../hotfix"). Confirm() t.ExpectPopup().Prompt(). Title(Contains("New branch name")). Type("hotfix/db-on-fire"). Confirm() }) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.