summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-12-27 22:52:20 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-12-27 22:52:20 +1100
commited93e0a2b0943379470049d2a25e4fb828179b97 (patch)
treeb9cb34b8f017912299714fc67a9ca4f50ba63b3d /pkg/integration
parentc5050ecabd57702c7bfb02a38729ed8a4f23b2c5 (diff)
remove dependency on model
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/components/git.go28
-rw-r--r--pkg/integration/components/model.go84
-rw-r--r--pkg/integration/components/shell.go11
-rw-r--r--pkg/integration/components/test.go8
-rw-r--r--pkg/integration/components/test_driver.go14
-rw-r--r--pkg/integration/components/test_test.go6
-rw-r--r--pkg/integration/components/view.go45
-rw-r--r--pkg/integration/tests/bisect/basic.go2
-rw-r--r--pkg/integration/tests/bisect/from_other_branch.go2
-rw-r--r--pkg/integration/tests/branch/suggestions.go2
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go2
-rw-r--r--pkg/integration/tests/commit/commit.go10
-rw-r--r--pkg/integration/tests/commit/commit_multiline.go9
-rw-r--r--pkg/integration/tests/commit/new_branch.go10
-rw-r--r--pkg/integration/tests/commit/revert.go2
-rw-r--r--pkg/integration/tests/commit/staged.go10
-rw-r--r--pkg/integration/tests/commit/staged_without_hooks.go10
-rw-r--r--pkg/integration/tests/commit/unstaged.go10
-rw-r--r--pkg/integration/tests/config/remote_named_star.go6
-rw-r--r--pkg/integration/tests/custom_commands/basic.go3
-rw-r--r--pkg/integration/tests/custom_commands/form_prompts.go10
-rw-r--r--pkg/integration/tests/custom_commands/menu_from_command.go11
-rw-r--r--pkg/integration/tests/custom_commands/menu_from_commands_output.go5
-rw-r--r--pkg/integration/tests/custom_commands/multiple_prompts.go11
-rw-r--r--pkg/integration/tests/file/dir_with_untracked_file.go5
-rw-r--r--pkg/integration/tests/file/discard_changes.go4
-rw-r--r--pkg/integration/tests/interactive_rebase/amend_merge.go18
-rw-r--r--pkg/integration/tests/misc/confirm_on_quit.go2
-rw-r--r--pkg/integration/tests/stash/stash.go16
-rw-r--r--pkg/integration/tests/stash/stash_including_untracked_files.go17
-rw-r--r--pkg/integration/types/types.go1
31 files changed, 200 insertions, 174 deletions
diff --git a/pkg/integration/components/git.go b/pkg/integration/components/git.go
new file mode 100644
index 000000000..b9b3dcc46
--- /dev/null
+++ b/pkg/integration/components/git.go
@@ -0,0 +1,28 @@
+package components
+
+import (
+ "fmt"
+ "strings"
+)
+
+type Git struct {
+ *assertionHelper
+ shell *Shell
+}
+
+func (self *Git) CurrentBranchName(expectedName string) *Git {
+ return self.assert("git rev-parse --abbrev-ref HEAD", expectedName)
+}
+
+func (self *Git) assert(cmdStr string, expected string) *Git {
+ self.assertWithRetries(func() (bool, string) {
+ output, err := self.shell.runCommandWithOutput(cmdStr)
+ if err != nil {
+ return false, fmt.Sprintf("Unexpected error running command: `%s`. Error: %s", cmdStr, err.Error())
+ }
+ actual := strings.TrimSpace(output)
+ return actual == expected, fmt.Sprintf("Expected current branch name to be '%s', but got '%s'", expected, actual)
+ })
+
+ return self
+}
diff --git a/pkg/integration/components/model.go b/pkg/integration/components/model.go
deleted file mode 100644
index 368c50852..000000000
--- a/pkg/integration/components/model.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package components
-
-import (
- "fmt"
-
- integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
-)
-
-type Model struct {
- *assertionHelper
- gui integrationTypes.GuiDriver
-}
-
-func (self *Model) WorkingTreeFileCount(expectedCount int) *Model {
- self.assertWithRetries(func() (bool, string) {
- actualCount := len(self.gui.Model().Files)
-
- return actualCount == expectedCount, fmt.Sprintf(
- "Expected %d changed working tree files, but got %d",
- expectedCount, actualCount,
- )
- })
-
- return self
-}
-
-func (self *Model) CommitCount(expectedCount int) *Model {
- self.assertWithRetries(func() (bool, string) {
- actualCount := len(self.gui.Model().Commits)
-
- return actualCount == expectedCount, fmt.Sprintf(
- "Expected %d commits present, but got %d",
- expectedCount, actualCount,
- )
- })
-
- return self
-}
-
-func (self *Model) StashCount(expectedCount int) *Model {
- self.assertWithRetries(func() (bool, string) {
- actualCount := len(self.gui.Model().StashEntries)
-
- return actualCount == expectedCount, fmt.Sprintf(
- "Expected %d stash entries, but got %d",
- expectedCount, actualCount,
- )
- })
-
- return self
-}
-
-func (self *Model) AtLeastOneCommit() *Model {
- self.assertWithRetries(func() (bool, string) {
- actualCount := len(self.gui.Model().Commits)
-
- return actualCount > 0, "Expected at least one commit present"
- })
-
- return self
-}
-
-func (self *Model) HeadCommitMessage(matcher *matcher) *Model {
- self.assertWithRetries(func() (bool, string) {
- return len(self.gui.Model().Commits) > 0, "Expected at least one commit to be present"
- })
-
- self.matchString(matcher, "Unexpected commit message.",
- func() string {
- return self.gui.Model().Commits[0].Name
- },
- )
-
- return self
-}
-
-func (self *Model) CurrentBranchName(expectedViewName string) *Model {
- self.assertWithRetries(func() (bool, string) {
- actual := self.gui.CheckedOutRef().Name
- return actual == expectedViewName, fmt.Sprintf("Expected current branch name to be '%s', but got '%s'", expectedViewName, actual)
- })
-
- return self
-}
diff --git a/pkg/integration/components/shell.go b/pkg/integration/components/shell.go
index 3fd63c8cc..f54d0fa5a 100644
--- a/pkg/integration/components/shell.go
+++ b/pkg/integration/components/shell.go
@@ -38,6 +38,17 @@ func (self *Shell) RunCommand(cmdStr string) *Shell {
return self
}
+func (self *Shell) runCommandWithOutput(cmdStr string) (string, error) {
+ args := str.ToArgv(cmdStr)
+ cmd := secureexec.Command(args[0], args[1:]...)
+ cmd.Env = os.Environ()
+ cmd.Dir = self.dir
+
+ output, err := cmd.CombinedOutput()
+
+ return string(output), err
+}
+
func (self *Shell) RunShellCommand(cmdStr string) *Shell {
cmd := secureexec.Command("sh", "-c", cmdStr)
cmd.Env = os.Environ()
diff --git a/pkg/integration/components/test.go b/pkg/integration/components/test.go
index 0b36a12d9..9291cf329 100644
--- a/pkg/integration/components/test.go
+++ b/pkg/integration/components/test.go
@@ -6,6 +6,7 @@ import (
"strings"
"github.com/jesseduffield/lazygit/pkg/config"
+ "github.com/jesseduffield/lazygit/pkg/env"
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -89,9 +90,12 @@ func (self *IntegrationTest) SetupRepo(shell *Shell) {
self.setupRepo(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", func(errorMsg string) { gui.Fail(errorMsg) })
+ // we pass the --pass arg to lazygit when running an integration test, and that
+ // ends up stored in the following env var
+ repoPath := env.GetGitWorkTreeEnv()
+
+ shell := NewShell(repoPath, func(errorMsg string) { gui.Fail(errorMsg) })
keys := gui.Keys()
testDriver := NewTestDriver(gui, shell, keys, KeyPressDelay())
diff --git a/pkg/integration/components/test_driver.go b/pkg/integration/components/test_driver.go
index f2604d211..a314c9fd3 100644
--- a/pkg/integration/components/test_driver.go
+++ b/pkg/integration/components/test_driver.go
@@ -8,7 +8,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/types"
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
- "github.com/samber/lo"
)
type TestDriver struct {
@@ -220,9 +219,9 @@ func (self *TestDriver) Views() *Views {
return &Views{t: self}
}
-// for making assertions on the lazygit model
-func (self *TestDriver) Model() *Model {
- return &Model{assertionHelper: self.assertionHelper, gui: self.gui}
+// for making assertions through git itself
+func (self *TestDriver) Git() *Git {
+ return &Git{assertionHelper: self.assertionHelper, shell: self.shell}
}
// for making assertions on the file system
@@ -235,10 +234,3 @@ func (self *TestDriver) FileSystem() *FileSystem {
func (self *TestDriver) Fail(message string) {
self.assertionHelper.fail(message)
}
-
-func (self *TestDriver) NotInPopup() {
- self.assertWithRetries(func() (bool, string) {
- viewName := self.gui.CurrentContext().GetView().Name()
- return !lo.Contains([]string{"menu", "confirmation", "commitMessage"}, viewName), fmt.Sprintf("Unexpected popup view present: %s view", viewName)
- })
-}
diff --git a/pkg/integration/components/test_test.go b/pkg/integration/components/test_test.go
index ccab35dc8..6c2f15b4b 100644
--- a/pkg/integration/components/test_test.go
+++ b/pkg/integration/components/test_test.go
@@ -30,10 +30,6 @@ func (self *fakeGuiDriver) CurrentContext() types.Context {
return nil
}
-func (self *fakeGuiDriver) Model() *types.Model {
- return &types.Model{Commits: []*models.Commit{}}
-}
-
func (self *fakeGuiDriver) Fail(message string) {
self.failureMessage = message
}
@@ -66,7 +62,6 @@ func TestAssertionFailure(t *testing.T) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.press("a")
t.press("b")
- t.Model().CommitCount(2)
},
})
driver := &fakeGuiDriver{}
@@ -93,7 +88,6 @@ func TestSuccess(t *testing.T) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.press("a")
t.press("b")
- t.Model().CommitCount(0)
},
})
driver := &fakeGuiDriver{}
diff --git a/pkg/integration/components/view.go b/pkg/integration/components/view.go
index 479c419cc..f809c3a4a 100644
--- a/pkg/integration/components/view.go
+++ b/pkg/integration/components/view.go
@@ -2,6 +2,7 @@ package components
import (
"fmt"
+ "strings"
"github.com/jesseduffield/gocui"
)
@@ -28,6 +29,10 @@ func (self *View) Title(expected *matcher) *View {
// This method is convenient when you have a list of commits but you only want to
// assert on the first couple of commits.
func (self *View) TopLines(matchers ...*matcher) *View {
+ if len(matchers) < 1 {
+ self.t.fail("TopLines method requires at least one matcher. If you are trying to assert that there are no lines, use .IsEmpty()")
+ }
+
self.t.assertWithRetries(func() (bool, string) {
lines := self.getView().BufferLines()
return len(lines) >= len(matchers), fmt.Sprintf("unexpected number of lines in view. Expected at least %d, got %d", len(matchers), len(lines))
@@ -39,10 +44,7 @@ func (self *View) TopLines(matchers ...*matcher) *View {
// asserts that the view has lines matching the given matchers. One matcher must be passed for each line.
// If you only care about the top n lines, use the TopLines method instead.
func (self *View) Lines(matchers ...*matcher) *View {
- self.t.assertWithRetries(func() (bool, string) {
- lines := self.getView().BufferLines()
- return len(lines) == len(matchers), fmt.Sprintf("unexpected number of lines in view. Expected %d, got %d", len(matchers), len(lines))
- })
+ self.LineCount(len(matchers))
return self.assertLines(matchers...)
}
@@ -184,6 +186,41 @@ func (self *View) NavigateToListItem(matcher *matcher) *View {
return self
}
+// returns true if the view is a list view and it contains no items
+func (self *View) IsEmpty() *View {
+ self.t.assertWithRetries(func() (bool, string) {
+ actual := strings.TrimSpace(self.getView().Buffer())
+ return actual == "", fmt.Sprintf("%s: Unexpected content in view: expected no content. Content: %s", self.context, actual)
+ })
+
+ return self
+}
+
+func (self *View) LineCount(expectedCount int) *View {
+ if expectedCount == 0 {
+ return self.IsEmpty()
+ }
+
+ self.t.assertWithRetries(func() (bool, string) {
+ lines := self.getView().BufferLines()
+ return len(lines) == expectedCount, fmt.Sprintf("unexpected number of lines in view. Expected %d, got %d", expectedCount, len(lines))
+ })
+
+ self.t.assertWithRetries(func() (bool, string) {
+ lines := self.getView().BufferLines()
+
+ // if the view has a single blank line (often the case) we want to treat that as having no lines
+ if len(lines) == 1 && expectedCount == 1 {
+ actual := strings.TrimSpace(self.getView().Buffer())
+ return actual == "", fmt.Sprintf("unexpected number of lines in view. Expected %d, got 0", expectedCount)
+ }
+
+ return len(lines) == expectedCount, fmt.Sprintf("unexpected number of lines in view. Expected %d, got %d", expectedCount, len(lines))
+ })
+
+ return self
+}
+
// for when you want to make some assertion unrelated to the current view
// without breaking the method chain
func (self *View) Tap(f func()) *View {
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go
index 8294f61a4..5092f2f0a 100644
--- a/pkg/integration/tests/bisect/basic.go
+++ b/pkg/integration/tests/bisect/basic.go
@@ -29,8 +29,6 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
}
- t.Model().AtLeastOneCommit()
-
t.Views().Commits().
Focus().
SelectedLine(Contains("commit 10")).
diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go
index 13e7e8055..7c2307bd6 100644
--- a/pkg/integration/tests/bisect/from_other_branch.go
+++ b/pkg/integration/tests/bisect/from_other_branch.go
@@ -21,8 +21,6 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Information().Content(Contains("bisecting"))
- t.Model().AtLeastOneCommit()
-
t.Views().Commits().
Focus().
TopLines(
diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go
index 65c64fa6d..0671578ed 100644
--- a/pkg/integration/tests/branch/suggestions.go
+++ b/pkg/integration/tests/branch/suggestions.go
@@ -34,6 +34,6 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{
SelectFirstSuggestion().
Confirm()
- t.Model().CurrentBranchName("branch-to-checkout")
+ t.Git().CurrentBranchName("branch-to-checkout")
},
})
diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
index 5eef30b50..c41de78b3 100644
--- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
+++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
@@ -70,7 +70,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Content(Contains("all merge conflicts resolved. Continue?")).
Confirm()
- t.Model().WorkingTreeFileCount(0)
+ t.Views().Files().IsEmpty()
t.Views().Commits().
Focus().
diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go
index 5950545e7..dc0615c87 100644
--- a/pkg/integration/tests/commit/commit.go
+++ b/pkg/integration/tests/commit/commit.go
@@ -15,7 +15,8 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(0)
+ t.Views().Commits().
+ IsEmpty()
t.Views().Files().
IsFocused().
@@ -28,8 +29,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
- t.Model().
- CommitCount(1).
- HeadCommitMessage(Equals(commitMessage))
+ t.Views().Commits().
+ Lines(
+ Contains(commitMessage),
+ )
},
})
diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go
index 11876e09a..1a5175146 100644
--- a/pkg/integration/tests/commit/commit_multiline.go
+++ b/pkg/integration/tests/commit/commit_multiline.go
@@ -14,7 +14,8 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(0)
+ t.Views().Commits().
+ IsEmpty()
t.Views().Files().
IsFocused().
@@ -23,8 +24,10 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm()
- t.Model().CommitCount(1)
- t.Model().HeadCommitMessage(Equals("first line"))
+ t.Views().Commits().
+ Lines(
+ Contains("first line"),
+ )
t.Views().Commits().Focus()
t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line"))
diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go
index 6f528ff4c..16ae79b35 100644
--- a/pkg/integration/tests/commit/new_branch.go
+++ b/pkg/integration/tests/commit/new_branch.go
@@ -17,22 +17,20 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
EmptyCommit("commit 3")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(3)
-
t.Views().Commits().
Focus().
- SelectNextItem().
Lines(
- Contains("commit 3"),
- Contains("commit 2").IsSelected(),
+ Contains("commit 3").IsSelected(),
+ Contains("commit 2"),
Contains("commit 1"),
).
+ SelectNextItem().
Press(keys.Universal.New).
Tap(func() {
branchName := "my-branch-name"
t.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
- t.Model().CurrentBranchName(branchName)
+ t.Git().CurrentBranchName(branchName)
}).
Lines(
Contains("commit 2"),
diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go
index bee657380..0f9c3fb9e 100644
--- a/pkg/integration/tests/commit/revert.go
+++ b/pkg/integration/tests/commit/revert.go
@@ -16,8 +16,6 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
shell.Commit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(1)
-
t.Views().Commits().
Focus().
Lines(
diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go
index d0698192a..d5c5dc84e 100644
--- a/pkg/integration/tests/commit/staged.go
+++ b/pkg/integration/tests/commit/staged.go
@@ -16,7 +16,8 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(0)
+ t.Views().Commits().
+ IsEmpty()
t.Views().Files().
IsFocused().
@@ -47,8 +48,11 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
commitMessage := "my commit message"
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
- t.Model().CommitCount(1)
- t.Model().HeadCommitMessage(Equals(commitMessage))
+ t.Views().Commits().
+ Lines(
+ Contains(commitMessage),
+ )
+
t.Views().StagingSecondary().IsFocused()
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go
index 8a6b0d3d0..32cd8df06 100644
--- a/pkg/integration/tests/commit/staged_without_hooks.go
+++ b/pkg/integration/tests/commit/staged_without_hooks.go
@@ -16,7 +16,8 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(0)
+ t.Views().Commits().
+ IsEmpty()
// stage the file
t.Views().Files().
@@ -47,8 +48,11 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
commitMessage := ": my commit message"
t.ExpectCommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm()
- t.Model().CommitCount(1)
- t.Model().HeadCommitMessage(Equals("WIP" + commitMessage))
+ t.Views().Commits().
+ Lines(
+ Contains("WIP" + commitMessage),
+ )
+
t.Views().StagingSecondary().IsFocused()
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go
index 3e0d68617..a3792e1b7 100644
--- a/pkg/integration/tests/commit/unstaged.go
+++ b/pkg/integration/tests/commit/unstaged.go
@@ -18,7 +18,8 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CommitCount(0)
+ t.Views().Commits().
+ IsEmpty()
t.Views().Files().
IsFocused().
@@ -41,8 +42,11 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
commitMessage := "my commit message"
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
- t.Model().CommitCount(1)
- t.Model().HeadCommitMessage(Equals(commitMessage))
+ t.Views().Commits().
+ Lines(
+ Contains(commitMessage),
+ )
+
t.Views().Staging().IsFocused()
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
diff --git a/pkg/integration/tests/config/remote_named_star.go b/pkg/integration/tests/config/remote_named_star.go
index 0306427ca..735389667 100644
--- a/pkg/integration/tests/config/remote_named_star.go
+++ b/pkg/integration/tests/config/remote_named_star.go
@@ -17,6 +17,10 @@ var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// here we're just asserting that we haven't panicked upon starting lazygit
- t.Model().AtLeastOneCommit()
+ t.Views().Commits().
+ Lines(
+ Anything(),
+ Anything(),
+ )
},
})
diff --git a/pkg/integration/tests/custom_commands/basic.go b/pkg/integration/tests/custom_commands/basic.go
index a73fab5a9..ce500b9a6 100644
--- a/pkg/integration/tests/custom_commands/basic.go
+++ b/pkg/integration/tests/custom_commands/basic.go
@@ -22,9 +22,8 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().WorkingTreeFileCount(0)
-
t.Views().Files().
+ IsEmpty().
IsFocused().
Press("a").
Lines(
diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go
index b35455368..c843232ee 100644
--- a/pkg/integration/tests/custom_commands/form_prompts.go
+++ b/pkg/integration/tests/custom_commands/form_prompts.go
@@ -56,9 +56,8 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().WorkingTreeFileCount(0)
-
t.Views().Files().
+ IsEmpty().
IsFocused().
Press("a")
@@ -71,8 +70,11 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")).
Confirm()
- t.Model().WorkingTreeFileCount(1)
- t.Views().Files().SelectedLine(Contains("my file"))
+ t.Views().Files().
+ Lines(
+ Contains("my file").IsSelected(),
+ )
+
t.Views().Main().Content(Contains(`"BAR"`))
},
})
diff --git a/pkg/integration/tests/custom_commands/menu_from_command.go b/pkg/integration/tests/custom_commands/menu_from_command.go
index 580022521..71a6a5c15 100644
--- a/pkg/integration/tests/custom_commands/menu_from_command.go
+++ b/pkg/integration/tests/custom_commands/menu_from_command.go
@@ -43,7 +43,9 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().WorkingTreeFileCount(0)
+ t.Views().Files().
+ IsEmpty()
+
t.Views().Branches().
Focus().
Press("a")
@@ -52,9 +54,12 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
t.ExpectPrompt().Title(Equals("Description")).Type(" my branch").Confirm()
- t.Model().WorkingTreeFileCount(1)
+ t.Views().Files().
+ Focus().
+ Lines(
+ Contains("output.txt").IsSelected(),
+ )
- t.Views().Files().Focus().SelectedLine(Contains("output.txt"))
t.Views().Main().Content(Contains("bar Branch: #feature/foo my branch feature/foo"))
},
})
diff --git a/pkg/integration/tests/custom_commands/menu_from_commands_output.go b/pkg/integration/tests/custom_commands/menu_from_commands_output.go
index a9a899341..b4b649efd 100644
--- a/pkg/integration/tests/custom_commands/menu_from_commands_output.go
+++ b/pkg/integration/tests/custom_commands/menu_from_commands_output.go
@@ -42,8 +42,7 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
- t.Model().CurrentBranchName("feature/bar")
- t.Model().WorkingTreeFileCount(0)