1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

move shell into test driver

This commit is contained in:
Jesse Duffield
2022-12-27 21:47:37 +11:00
parent 78b495f50a
commit c5050ecabd
39 changed files with 108 additions and 131 deletions

View File

@ -24,8 +24,7 @@ type IntegrationTest struct {
setupRepo func(shell *Shell)
setupConfig func(config *config.AppConfig)
run func(
shell *Shell,
testController *TestDriver,
testDriver *TestDriver,
keys config.KeybindingConfig,
)
}
@ -40,7 +39,7 @@ type NewIntegrationTestArgs struct {
// 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, t *TestDriver, keys config.KeybindingConfig)
Run func(t *TestDriver, keys config.KeybindingConfig)
// additional args passed to lazygit
ExtraCmdArgs string
// for when a test is flakey
@ -92,15 +91,15 @@ func (self *IntegrationTest) SetupRepo(shell *Shell) {
// I want access to all contexts, the model, the ability to press a key, the ability to log,
func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver) {
shell := NewShell("/tmp/lazygit-test")
shell := NewShell("/tmp/lazygit-test", func(errorMsg string) { gui.Fail(errorMsg) })
keys := gui.Keys()
testController := NewTestController(gui, keys, KeyPressDelay())
testDriver := NewTestDriver(gui, shell, keys, KeyPressDelay())
self.run(shell, testController, keys)
self.run(testDriver, keys)
if KeyPressDelay() > 0 {
// the dev would want to see the final state if they're running in slow mode
testController.Wait(2000)
testDriver.Wait(2000)
}
}