mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-06-20 01:19:23 +02:00
add prompt asserter
This commit is contained in:
@@ -28,7 +28,7 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Press(keys.Branches.CheckoutBranchByName)
|
||||
|
||||
input.Prompt(Equals("Branch name:"), "new-branch")
|
||||
input.Prompt().Title(Equals("Branch name:")).Type("new-branch").Confirm()
|
||||
|
||||
input.Alert(Equals("Branch not found"), Equals("Branch not found. Create a new branch named new-branch?"))
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.NextItem()
|
||||
|
||||
input.Press(keys.Universal.Remove)
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Delete Branch")).
|
||||
Content(Contains("Are you sure you want to delete the branch 'branch-one'?")).
|
||||
Confirm()
|
||||
|
||||
@@ -31,11 +31,11 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.NextItem()
|
||||
input.Press(keys.Branches.RebaseBranch)
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Rebasing")).
|
||||
Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")).
|
||||
Confirm()
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Auto-merge failed")).
|
||||
Content(Contains("Conflicts!")).
|
||||
Confirm()
|
||||
@@ -51,7 +51,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
assert.View("information").Content(Contains("rebasing"))
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("continue")).
|
||||
Content(Contains("all merge conflicts resolved. Continue?")).
|
||||
Confirm()
|
||||
|
||||
@@ -36,14 +36,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.NextItem()
|
||||
input.Press(keys.Branches.RebaseBranch)
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Rebasing")).
|
||||
Content(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")).
|
||||
Confirm()
|
||||
|
||||
assert.View("information").Content(Contains("rebasing"))
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Auto-merge failed")).
|
||||
Content(Contains("Conflicts!")).
|
||||
Confirm()
|
||||
@@ -83,7 +83,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert.CurrentView().Name("mergeConflicts")
|
||||
input.PrimaryAction()
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("continue")).
|
||||
Content(Contains("all merge conflicts resolved. Continue?")).
|
||||
Confirm()
|
||||
|
||||
@@ -47,7 +47,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.Press(keys.Commits.PasteCommits)
|
||||
input.Alert(Equals("Cherry-Pick"), Contains("Are you sure you want to cherry-pick the copied commits onto this branch?"))
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Auto-merge failed")).
|
||||
Content(Contains("Conflicts!")).
|
||||
Confirm()
|
||||
@@ -64,7 +64,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.NextItem()
|
||||
input.PrimaryAction()
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("continue")).
|
||||
Content(Contains("all merge conflicts resolved. Continue?")).
|
||||
Confirm()
|
||||
|
||||
@@ -30,7 +30,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.Press(keys.Universal.New)
|
||||
|
||||
branchName := "my-branch-name"
|
||||
input.Prompt(Contains("New Branch Name"), branchName)
|
||||
input.Prompt().Title(Equals("New Branch Name")).Type(branchName).Confirm()
|
||||
|
||||
assert.CurrentBranchName(branchName)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
)
|
||||
|
||||
input.Press(keys.Commits.RevertCommit)
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Revert commit")).
|
||||
Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
|
||||
Confirm()
|
||||
|
||||
@@ -65,11 +65,11 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Press("a")
|
||||
|
||||
input.Prompt(Equals("Enter a file name"), "my file")
|
||||
input.Prompt().Title(Equals("Enter a file name")).Type("my file").Confirm()
|
||||
|
||||
input.Menu(Equals("Choose file content"), Contains("bar"))
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Are you sure?")).
|
||||
Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")).
|
||||
Confirm()
|
||||
|
||||
@@ -55,7 +55,7 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Menu(Equals("Choose commit message"), Contains("bar"))
|
||||
|
||||
input.Prompt(Equals("Description"), " my branch")
|
||||
input.Prompt().Title(Equals("Description")).Type(" my branch").Confirm()
|
||||
|
||||
input.SwitchToFilesView()
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Press("a")
|
||||
|
||||
input.Prompt(Equals("Enter a file name"), "myfile")
|
||||
input.Prompt().Title(Equals("Enter a file name")).Type("myfile").Confirm()
|
||||
|
||||
input.Menu(Equals("Choose file content"), Contains("bar"))
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Are you sure?")).
|
||||
Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")).
|
||||
Confirm()
|
||||
|
||||
@@ -98,7 +98,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
{status: "DU", label: "deleted-us.txt", menuTitle: "deleted-us.txt"},
|
||||
})
|
||||
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("continue")).
|
||||
Content(Contains("all merge conflicts resolved. Continue?")).
|
||||
Cancel()
|
||||
|
||||
@@ -36,7 +36,7 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert.HeadCommitMessage(Contains(mergeCommitMessage))
|
||||
|
||||
input.Press(keys.Commits.AmendToCommit)
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("Amend Commit")).
|
||||
Content(Contains("Are you sure you want to amend this commit with your staged files?")).
|
||||
Confirm()
|
||||
|
||||
@@ -17,7 +17,7 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
assert.CommitCount(0)
|
||||
|
||||
input.Press(keys.Universal.Quit)
|
||||
input.InConfirm().
|
||||
input.Confirmation().
|
||||
Title(Equals("")).
|
||||
Content(Contains("Are you sure you want to quit?")).
|
||||
Confirm()
|
||||
|
||||
@@ -28,7 +28,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.NextItem()
|
||||
input.Press(keys.Stash.RenameStash)
|
||||
|
||||
input.Prompt(Equals("Rename stash: stash@{1}"), " baz")
|
||||
input.Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm()
|
||||
|
||||
assert.CurrentView().SelectedLine(Equals("On master: foo baz"))
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Menu(Equals("Stash options"), MatchesRegexp("stash all changes$"))
|
||||
|
||||
input.Prompt(Equals("Stash changes"), "my stashed file")
|
||||
input.Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm()
|
||||
|
||||
assert.StashCount(1)
|
||||
assert.WorkingTreeFileCount(0)
|
||||
|
||||
@@ -24,7 +24,7 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.Menu(Equals("Stash options"), Contains("stash all changes including untracked files"))
|
||||
|
||||
input.Prompt(Equals("Stash changes"), "my stashed file")
|
||||
input.Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm()
|
||||
|
||||
assert.StashCount(1)
|
||||
assert.WorkingTreeFileCount(0)
|
||||
|
||||
Reference in New Issue
Block a user