Documentation ¶
Index ¶
- Constants
- func Contains(target string) *matcher
- func Equals(target string) *matcher
- func HandleSnapshots(paths Paths, logf logf, test *IntegrationTest, mode Mode) error
- func KeyPressDelay() int
- func NotContains(target string) *matcher
- func RunTests(tests []*IntegrationTest, logf func(format string, formatArgs ...interface{}), ...) error
- func TestNameFromFilePath(path string) string
- type Assert
- func (self *Assert) AtLeastOneCommit()
- func (self *Assert) CommitCount(expectedCount int)
- func (self *Assert) CurrentBranchName(expectedViewName string)
- func (self *Assert) CurrentViewName(expectedViewName string)
- func (self *Assert) CurrentWindowName(expectedWindowName string)
- func (self *Assert) Fail(message string)
- func (self *Assert) InAlert()
- func (self *Assert) InConfirm()
- func (self *Assert) InListContext()
- func (self *Assert) InMenu()
- func (self *Assert) InPrompt()
- func (self *Assert) MatchCurrentViewContent(matcher *matcher)
- func (self *Assert) MatchCurrentViewTitle(matcher *matcher)
- func (self *Assert) MatchHeadCommitMessage(matcher *matcher)
- func (self *Assert) MatchMainViewContent(matcher *matcher)
- func (self *Assert) MatchSecondaryViewContent(matcher *matcher)
- func (self *Assert) MatchSelectedLine(matcher *matcher)
- func (self *Assert) MatchViewContent(viewName string, matcher *matcher)
- func (self *Assert) StashCount(expectedCount int)
- func (self *Assert) WorkingTreeFileCount(expectedCount int)
- type Input
- func (self *Input) Cancel()
- func (self *Input) Confirm()
- func (self *Input) ContinueMerge()
- func (self *Input) ContinueRebase()
- func (self *Input) Enter()
- func (self *Input) Log(message string)
- func (self *Input) LogUI(message string)
- func (self *Input) NavigateToListItemContainingText(text string)
- func (self *Input) NextItem()
- func (self *Input) PressKeys(keyStrs ...string)
- func (self *Input) PreviousItem()
- func (self *Input) PrimaryAction()
- func (self *Input) ProceedWhenAsked(matcher *matcher)
- func (self *Input) SwitchToBranchesWindow()
- func (self *Input) SwitchToCommitsWindow()
- func (self *Input) SwitchToFilesWindow()
- func (self *Input) SwitchToStashWindow()
- func (self *Input) SwitchToStatusWindow()
- func (self *Input) Type(content string)
- func (self *Input) Wait(milliseconds int)
- type IntegrationTest
- func (self *IntegrationTest) Description() string
- func (self *IntegrationTest) ExtraCmdArgs() string
- func (self *IntegrationTest) Name() string
- func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver)
- func (self *IntegrationTest) SetupConfig(config *config.AppConfig)
- func (self *IntegrationTest) SetupRepo(shell *Shell)
- func (self *IntegrationTest) Skip() bool
- type MockTestingT
- type Mode
- type NewIntegrationTestArgs
- type Paths
- type Shell
- func (s *Shell) Checkout(name string) *Shell
- func (s *Shell) Commit(message string) *Shell
- func (s *Shell) CreateDir(path string) *Shell
- func (s *Shell) CreateFile(path string, content string) *Shell
- func (s *Shell) CreateFileAndAdd(fileName string, fileContents string) *Shell
- func (s *Shell) CreateNCommits(n int) *Shell
- func (s *Shell) EmptyCommit(message string) *Shell
- func (s *Shell) GitAdd(path string) *Shell
- func (s *Shell) GitAddAll() *Shell
- func (s *Shell) Merge(name string) *Shell
- func (s *Shell) NewBranch(name string) *Shell
- func (s *Shell) RunCommand(cmdStr string) *Shell
- func (s *Shell) StashWithMessage(message string) *Shell
- func (s *Shell) UpdateFile(path string, content string) *Shell
- func (s *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell
- type Snapshotter
Constants ¶
const ( TEST_NAME_ENV_VAR = "TEST_NAME" SANDBOX_ENV_VAR = "SANDBOX" )
Variables ¶
This section is empty.
Functions ¶
func HandleSnapshots ¶
func HandleSnapshots(paths Paths, logf logf, test *IntegrationTest, mode Mode) error
func KeyPressDelay ¶
func KeyPressDelay() int
this is the delay in milliseconds between keypresses defaults to zero
func NotContains ¶
func NotContains(target string) *matcher
func TestNameFromFilePath ¶
Types ¶
type Assert ¶
type Assert struct {
// contains filtered or unexported fields
}
func NewAssert ¶
func NewAssert(gui integrationTypes.GuiDriver) *Assert
func (*Assert) AtLeastOneCommit ¶
func (self *Assert) AtLeastOneCommit()
func (*Assert) CommitCount ¶
func (*Assert) CurrentBranchName ¶
func (*Assert) CurrentViewName ¶
func (*Assert) CurrentWindowName ¶
func (*Assert) InListContext ¶
func (self *Assert) InListContext()
func (*Assert) MatchCurrentViewContent ¶
func (self *Assert) MatchCurrentViewContent(matcher *matcher)
func (*Assert) MatchCurrentViewTitle ¶
func (self *Assert) MatchCurrentViewTitle(matcher *matcher)
func (*Assert) MatchHeadCommitMessage ¶
func (self *Assert) MatchHeadCommitMessage(matcher *matcher)
func (*Assert) MatchMainViewContent ¶
func (self *Assert) MatchMainViewContent(matcher *matcher)
func (*Assert) MatchSecondaryViewContent ¶
func (self *Assert) MatchSecondaryViewContent(matcher *matcher)
func (*Assert) MatchSelectedLine ¶
func (self *Assert) MatchSelectedLine(matcher *matcher)
func (*Assert) MatchViewContent ¶
func (*Assert) StashCount ¶
func (*Assert) WorkingTreeFileCount ¶
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
func NewInput ¶
func NewInput(gui integrationTypes.GuiDriver, keys config.KeybindingConfig, assert *Assert, pushKeyDelay int) *Input
func (*Input) ContinueMerge ¶
func (self *Input) ContinueMerge()
func (*Input) ContinueRebase ¶
func (self *Input) ContinueRebase()
func (*Input) NavigateToListItemContainingText ¶
this will look for a list item in the current panel and if it finds it, it will enter the keypresses required to navigate to it. The test will fail if: - the user is not in a list item - no list item is found containing the given text - multiple list items are found containing the given text in the initial page of items
NOTE: this currently assumes that ViewBufferLines returns all the lines that can be accessed. If this changes in future, we'll need to update this code to first attempt to find the item in the current page and failing that, jump to the top of the view and iterate through all of it, looking for the item.
func (*Input) PressKeys ¶
key is something like 'w' or '<space>'. It's best not to pass a direct value, but instead to go through the default user config to get a more meaningful key name
func (*Input) ProceedWhenAsked ¶
func (self *Input) ProceedWhenAsked(matcher *matcher)
func (*Input) SwitchToBranchesWindow ¶
func (self *Input) SwitchToBranchesWindow()
func (*Input) SwitchToCommitsWindow ¶
func (self *Input) SwitchToCommitsWindow()
func (*Input) SwitchToFilesWindow ¶
func (self *Input) SwitchToFilesWindow()
func (*Input) SwitchToStashWindow ¶
func (self *Input) SwitchToStashWindow()
func (*Input) SwitchToStatusWindow ¶
func (self *Input) SwitchToStatusWindow()
type IntegrationTest ¶
type IntegrationTest struct {
// contains filtered or unexported fields
}
func NewIntegrationTest ¶
func NewIntegrationTest(args NewIntegrationTestArgs) *IntegrationTest
func (*IntegrationTest) Description ¶
func (self *IntegrationTest) Description() string
func (*IntegrationTest) ExtraCmdArgs ¶
func (self *IntegrationTest) ExtraCmdArgs() string
func (*IntegrationTest) Name ¶
func (self *IntegrationTest) Name() string
func (*IntegrationTest) Run ¶
func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver)
I want access to all contexts, the model, the ability to press a key, the ability to log,
func (*IntegrationTest) SetupConfig ¶
func (self *IntegrationTest) SetupConfig(config *config.AppConfig)
func (*IntegrationTest) SetupRepo ¶
func (self *IntegrationTest) SetupRepo(shell *Shell)
func (*IntegrationTest) Skip ¶
func (self *IntegrationTest) Skip() bool
type MockTestingT ¶
type MockTestingT struct {
// contains filtered or unexported fields
}
func (*MockTestingT) Errorf ¶
func (self *MockTestingT) Errorf(format string, args ...interface{})
type Mode ¶
type Mode int
const ( // Default: if a snapshot test fails, the we'll be asked whether we want to update it ASK_TO_UPDATE_SNAPSHOT Mode = iota // fails the test if the snapshots don't match CHECK_SNAPSHOT // runs the test and updates the snapshot UPDATE_SNAPSHOT // This just makes use of the setup step of the test to get you into // a lazygit session. Then you'll be able to do whatever you want. Useful // when you want to test certain things without needing to manually set // up the situation yourself. // fails the test if the snapshots don't match SANDBOX )
type NewIntegrationTestArgs ¶
type NewIntegrationTestArgs struct { // Briefly describes what happens in the test and what it's testing for Description string // prepares a repo for testing SetupRepo func(shell *Shell) // takes a config and mutates. The mutated context will end up being passed to the gui SetupConfig func(config *config.AppConfig) // runs the test Run func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) // additional args passed to lazygit ExtraCmdArgs string // for when a test is flakey Skip bool }
type Paths ¶
type Paths struct {
// contains filtered or unexported fields
}
convenience struct for easily getting directories within our test directory. We have one test directory for each test, found in test/integration_new.
func (Paths) Actual ¶
when a test first runs, it's situated in a repo called 'repo' within this directory. In its setup step, the test is allowed to create other repos alongside the 'repo' repo in this directory, for example, creating remotes or repos to add as submodules.
func (Paths) ActualRepo ¶
this is the 'repo' directory within the 'actual' directory, where a lazygit test will start within.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
this is for running shell commands, mostly for the sake of setting up the repo but you can also run the commands from within lazygit to emulate things happening in the background.
func (*Shell) CreateFileAndAdd ¶
convenience method for creating a file and adding it
func (*Shell) CreateNCommits ¶
creates commits 01, 02, 03, ..., n with a new file in each The reason for padding with zeroes is so that it's easier to do string matches on the commit messages when there are many of them
func (*Shell) EmptyCommit ¶
func (*Shell) RunCommand ¶
func (*Shell) StashWithMessage ¶
type Snapshotter ¶
type Snapshotter struct {
// contains filtered or unexported fields
}
func NewSnapshotter ¶
func NewSnapshotter( paths Paths, logf logf, test *IntegrationTest, mode Mode, ) *Snapshotter