Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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(). PressPrimaryAction(). SelectNextItem(). PressPrimaryAction(). Press(keys.Files.CommitChanges) commitMessage := "my commit message" t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm() t.Views().Commits(). Lines( Contains(commitMessage), ) }, })
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 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 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 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().IsFocused() }, })
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().IsFocused() }, })
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")) }). PressPrimaryAction(). Tap(func() { t.Views().Staging().Content(DoesNotContain("+myfile content")) 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.