Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ test/integration/*/used_config/
test/integration/*/expected/**/hooks/
test/integration/*/expected_remote/**/hooks/

test/integration_new/**/actual/
test/integration_new/**/used_config/
# these sample hooks waste too much space
test/integration_new/**/expected/**/hooks/
test/integration_new/**/expected_remote/**/hooks/
test/integration_new/**

oryxBuildBinary
__debug_bin
3 changes: 2 additions & 1 deletion pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/services/custom_commands"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/integration/components"
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
"github.com/jesseduffield/lazygit/pkg/tasks"
"github.com/jesseduffield/lazygit/pkg/theme"
Expand Down Expand Up @@ -426,7 +427,7 @@ func (gui *Gui) initGocui(headless bool, test integrationTypes.IntegrationTest)
playMode = gocui.RECORDING
} else if Replaying() {
playMode = gocui.REPLAYING
} else if test != nil {
} else if test != nil && os.Getenv(components.SANDBOX_ENV_VAR) != "true" {
playMode = gocui.REPLAYING_NEW
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ The name of a test is based on its path, so the name of the test at `pkg/integra

You can pass the KEY_PRESS_DELAY env var to the test runner in order to set a delay in milliseconds between keypresses, which helps for watching a test at a realistic speed to understand what it's doing. Or you can pass the '--slow' flag which sets a pre-set 'slow' key delay. In the tui you can press 't' to run the test in slow mode.

The resultant repo will be stored in `test/integration_new`, so if you're not sure what went wrong you can go there and inspect the repo.

### Running tests in VSCode

If you've opened an integration test file in your editor you can run that file by bringing up the command panel with `cmd+shift+p` and typing 'run task', then selecting the test task you want to run
Expand Down
5 changes: 0 additions & 5 deletions pkg/integration/clients/injector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ func getIntegrationTest() integrationTypes.IntegrationTest {
return nil
}

if os.Getenv(components.SANDBOX_ENV_VAR) == "true" {
// when in sandbox mode we don't want the test controlling the gui
return nil
}

integrationTestName := os.Getenv(components.TEST_NAME_ENV_VAR)
if integrationTestName == "" {
panic(fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion pkg/integration/components/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func getLazygitCommand(test *IntegrationTest, paths Paths, rootDir string, sandb

cmdObj.AddEnvVars(fmt.Sprintf("%s=%s", TEST_NAME_ENV_VAR, test.Name()))
if sandbox {
cmdObj.AddEnvVars(fmt.Sprintf("%s=%s", "SANDBOX", "true"))
cmdObj.AddEnvVars(fmt.Sprintf("%s=%s", SANDBOX_ENV_VAR, "true"))
}

if keyPressDelay > 0 {
Expand Down
25 changes: 25 additions & 0 deletions pkg/integration/tests/misc/confirm_on_quit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package misc

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Quitting with a confirm prompt",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.ConfirmOnQuit = true
config.UserConfig.Gui.Theme.ActiveBorderColor = []string{"red"}
},
SetupRepo: func(shell *Shell) {},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.CommitCount(0)

input.PressKeys(keys.Universal.Quit)
assert.InConfirm()
assert.MatchCurrentViewContent(Contains("Are you sure you want to quit?"))
input.Confirm()
},
})
2 changes: 2 additions & 0 deletions pkg/integration/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
"github.com/jesseduffield/lazygit/pkg/integration/tests/file"
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
"github.com/jesseduffield/lazygit/pkg/integration/tests/misc"
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
)

// Here is where we lists the actual tests that will run. When you create a new test,
// be sure to add it to this list.

var tests = []*components.IntegrationTest{
misc.ConfirmOnQuit,
bisect.Basic,
bisect.FromOtherBranch,
branch.CheckoutByName,
Expand Down
2 changes: 0 additions & 2 deletions test/integration/confirmQuit/config/config.yml

This file was deleted.

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion test/integration/confirmQuit/expected/repo/.git_keep/HEAD

This file was deleted.

10 changes: 0 additions & 10 deletions test/integration/confirmQuit/expected/repo/.git_keep/config

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/confirmQuit/expected/repo/myfile1

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/confirmQuit/recording.json

This file was deleted.

14 changes: 0 additions & 14 deletions test/integration/confirmQuit/setup.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/integration/confirmQuit/test.json

This file was deleted.