mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
rename input to t
This commit is contained in:
@ -14,10 +14,10 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.CreateFile("myfile", "myfile content")
|
||||
shell.CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(0)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
|
||||
input.Views().Files().
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
PressPrimaryAction(). // stage file
|
||||
SelectNextItem().
|
||||
@ -26,9 +26,9 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
commitMessage := "my commit message"
|
||||
|
||||
input.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
input.Model().
|
||||
t.Model().
|
||||
CommitCount(1).
|
||||
HeadCommitMessage(Equals(commitMessage))
|
||||
},
|
||||
|
@ -13,20 +13,20 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFile("myfile", "myfile content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(0)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
|
||||
input.Views().Files().
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
PressPrimaryAction().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
input.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm()
|
||||
t.ExpectCommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm()
|
||||
|
||||
input.Model().CommitCount(1)
|
||||
input.Model().HeadCommitMessage(Equals("first line"))
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals("first line"))
|
||||
|
||||
input.Views().Commits().Focus()
|
||||
input.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line"))
|
||||
t.Views().Commits().Focus()
|
||||
t.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line"))
|
||||
},
|
||||
})
|
||||
|
@ -16,10 +16,10 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
EmptyCommit("commit 2").
|
||||
EmptyCommit("commit 3")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(3)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(3)
|
||||
|
||||
input.Views().Commits().
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
SelectNextItem().
|
||||
Lines(
|
||||
@ -30,9 +30,9 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
branchName := "my-branch-name"
|
||||
input.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
|
||||
t.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
|
||||
|
||||
input.Model().CurrentBranchName(branchName)
|
||||
t.Model().CurrentBranchName(branchName)
|
||||
}).
|
||||
Lines(
|
||||
Contains("commit 2"),
|
||||
|
@ -15,17 +15,17 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.GitAddAll()
|
||||
shell.Commit("first commit")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(1)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(1)
|
||||
|
||||
input.Views().Commits().
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("first commit"),
|
||||
).
|
||||
Press(keys.Commits.RevertCommit).
|
||||
Tap(func() {
|
||||
input.ExpectConfirmation().
|
||||
t.ExpectConfirmation().
|
||||
Title(Equals("Revert commit")).
|
||||
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
|
||||
Confirm()
|
||||
@ -35,7 +35,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("first commit"),
|
||||
)
|
||||
|
||||
input.Views().Main().Content(Contains("-myfile content"))
|
||||
input.FileSystem().PathNotPresent("myfile")
|
||||
t.Views().Main().Content(Contains("-myfile content"))
|
||||
t.FileSystem().PathNotPresent("myfile")
|
||||
},
|
||||
})
|
||||
|
@ -15,41 +15,41 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile", "myfile content\nwith a second line").
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(0)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
|
||||
input.Views().Files().
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
SelectedLine(Contains("myfile")).
|
||||
PressPrimaryAction(). // stage the file
|
||||
PressEnter()
|
||||
|
||||
input.Views().StagingSecondary().
|
||||
t.Views().StagingSecondary().
|
||||
IsFocused().
|
||||
Tap(func() {
|
||||
// we start with both lines having been staged
|
||||
input.Views().StagingSecondary().Content(Contains("+myfile content"))
|
||||
input.Views().StagingSecondary().Content(Contains("+with a second line"))
|
||||
input.Views().Staging().Content(DoesNotContain("+myfile content"))
|
||||
input.Views().Staging().Content(DoesNotContain("+with a second line"))
|
||||
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"))
|
||||
}).
|
||||
// unstage the selected line
|
||||
PressPrimaryAction().
|
||||
Tap(func() {
|
||||
// the line should have been moved to the main view
|
||||
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
|
||||
input.Views().StagingSecondary().Content(Contains("+with a second line"))
|
||||
input.Views().Staging().Content(Contains("+myfile content"))
|
||||
input.Views().Staging().Content(DoesNotContain("+with a second line"))
|
||||
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"
|
||||
input.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
input.Model().CommitCount(1)
|
||||
input.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
input.Views().StagingSecondary().IsFocused()
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
t.Views().StagingSecondary().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
},
|
||||
|
@ -15,41 +15,41 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile", "myfile content\nwith a second line").
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(0)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
|
||||
// stage the file
|
||||
input.Views().Files().
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
SelectedLine(Contains("myfile")).
|
||||
PressPrimaryAction().
|
||||
PressEnter()
|
||||
|
||||
// we start with both lines having been staged
|
||||
input.Views().StagingSecondary().Content(
|
||||
t.Views().StagingSecondary().Content(
|
||||
Contains("+myfile content").Contains("+with a second line"),
|
||||
)
|
||||
input.Views().Staging().Content(
|
||||
t.Views().Staging().Content(
|
||||
DoesNotContain("+myfile content").DoesNotContain("+with a second line"),
|
||||
)
|
||||
|
||||
// unstage the selected line
|
||||
input.Views().StagingSecondary().
|
||||
t.Views().StagingSecondary().
|
||||
IsFocused().
|
||||
PressPrimaryAction().
|
||||
Tap(func() {
|
||||
// the line should have been moved to the main view
|
||||
input.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line"))
|
||||
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"
|
||||
input.ExpectCommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm()
|
||||
t.ExpectCommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm()
|
||||
|
||||
input.Model().CommitCount(1)
|
||||
input.Model().HeadCommitMessage(Equals("WIP" + commitMessage))
|
||||
input.Views().StagingSecondary().IsFocused()
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals("WIP" + commitMessage))
|
||||
t.Views().StagingSecondary().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
// TODO: find out why we can't use input.SelectedLine() on the staging/stagingSecondary views.
|
||||
// TODO: find out why we can't use .SelectedLine() on the staging/stagingSecondary views.
|
||||
|
||||
var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing",
|
||||
@ -17,33 +17,33 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile", "myfile content\nwith a second line").
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(0)
|
||||
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Model().CommitCount(0)
|
||||
|
||||
input.Views().Files().
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
SelectedLine(Contains("myfile")).
|
||||
PressEnter()
|
||||
|
||||
input.Views().Staging().
|
||||
t.Views().Staging().
|
||||
IsFocused().
|
||||
Tap(func() {
|
||||
input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
|
||||
t.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
|
||||
}).
|
||||
// stage the first line
|
||||
PressPrimaryAction().
|
||||
Tap(func() {
|
||||
input.Views().Staging().Content(DoesNotContain("+myfile content"))
|
||||
input.Views().StagingSecondary().Content(Contains("+myfile content"))
|
||||
t.Views().Staging().Content(DoesNotContain("+myfile content"))
|
||||
t.Views().StagingSecondary().Content(Contains("+myfile content"))
|
||||
}).
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
commitMessage := "my commit message"
|
||||
input.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
t.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
input.Model().CommitCount(1)
|
||||
input.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
input.Views().Staging().IsFocused()
|
||||
t.Model().CommitCount(1)
|
||||
t.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
t.Views().Staging().IsFocused()
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
},
|
||||
|
Reference in New Issue
Block a user