summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-12-27 21:25:11 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-12-27 21:26:18 +1100
commit53e06b71aecd2ddaf80516627ba223ac2adc5420 (patch)
treed45e564eb6718d9a9431aede2ed4a8f52911d1de
parentb166b8f776e45c77a94b6e919f3b9460ff3c2e06 (diff)
add tap function
-rw-r--r--pkg/integration/components/view.go8
-rw-r--r--pkg/integration/tests/bisect/basic.go44
-rw-r--r--pkg/integration/tests/bisect/from_other_branch.go24
-rw-r--r--pkg/integration/tests/branch/checkout_by_name.go18
-rw-r--r--pkg/integration/tests/branch/delete.go24
-rw-r--r--pkg/integration/tests/branch/reset.go3
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick.go43
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go39
-rw-r--r--pkg/integration/tests/commit/commit.go5
-rw-r--r--pkg/integration/tests/commit/new_branch.go24
-rw-r--r--pkg/integration/tests/commit/revert.go15
-rw-r--r--pkg/integration/tests/commit/staged.go34
-rw-r--r--pkg/integration/tests/commit/staged_without_hooks.go10
-rw-r--r--pkg/integration/tests/commit/unstaged.go22
-rw-r--r--pkg/integration/tests/diff/diff.go38
-rw-r--r--pkg/integration/tests/diff/diff_and_apply_patch.go40
-rw-r--r--pkg/integration/tests/diff/diff_commits.go35
-rw-r--r--pkg/integration/tests/interactive_rebase/one.go14
-rw-r--r--pkg/integration/tests/stash/rename.go10
19 files changed, 215 insertions, 235 deletions
diff --git a/pkg/integration/components/view.go b/pkg/integration/components/view.go
index e94d0d60c..cda5ff4cb 100644
--- a/pkg/integration/components/view.go
+++ b/pkg/integration/components/view.go
@@ -194,3 +194,11 @@ func (self *View) NavigateToListItem(matcher *matcher) *View {
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 {
+ f()
+
+ return self
+}
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go
index 131672654..ac4953095 100644
--- a/pkg/integration/tests/bisect/basic.go
+++ b/pkg/integration/tests/bisect/basic.go
@@ -38,34 +38,28 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Commits().
Focus().
SelectedLine(Contains("commit 10")).
- NavigateToListItem(Contains("commit 09"))
+ NavigateToListItem(Contains("commit 09")).
+ Tap(func() {
+ markCommitAsBad()
- markCommitAsBad()
-
- input.Views().Information().Content(Contains("bisecting"))
-
- input.Views().Commits().
- IsFocused().
+ input.Views().Information().Content(Contains("bisecting"))
+ }).
SelectedLine(Contains("<-- bad")).
- NavigateToListItem(Contains("commit 02"))
-
- markCommitAsGood()
-
- // lazygit will land us in the commit between our good and bad commits.
- input.Views().Commits().IsFocused().
- SelectedLine(Contains("commit 05").Contains("<-- current"))
-
- markCommitAsBad()
-
- input.Views().Commits().IsFocused().
- SelectedLine(Contains("commit 04").Contains("<-- current"))
-
- markCommitAsGood()
-
- // commit 5 is the culprit because we marked 4 as good and 5 as bad.
- input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
+ NavigateToListItem(Contains("commit 02")).
+ Tap(markCommitAsGood).
+ // lazygit will land us in the commit between our good and bad commits.
+ SelectedLine(Contains("commit 05").Contains("<-- current")).
+ Tap(markCommitAsBad).
+ SelectedLine(Contains("commit 04").Contains("<-- current")).
+ Tap(func() {
+ markCommitAsGood()
+
+ // commit 5 is the culprit because we marked 4 as good and 5 as bad.
+ input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm()
+ }).
+ IsFocused().
+ Content(Contains("commit 04"))
- input.Views().Commits().IsFocused().Content(Contains("commit 04"))
input.Views().Information().Content(DoesNotContain("bisecting"))
},
})
diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go
index 0112d7da5..20f0fb646 100644
--- a/pkg/integration/tests/bisect/from_other_branch.go
+++ b/pkg/integration/tests/bisect/from_other_branch.go
@@ -36,17 +36,17 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
MatchesRegexp(`<-- good.*commit 05`),
).
SelectNextItem().
- Press(keys.Commits.ViewBisectOptions)
-
- input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
-
- input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm()
-
- input.Views().Information().Content(DoesNotContain("bisecting"))
-
- // back in master branch which just had the one commit
- input.Views().Commits().Lines(
- Contains("only commit on master"),
- )
+ Press(keys.Commits.ViewBisectOptions).
+ Tap(func() {
+ input.ExpectMenu().Title(Equals("Bisect")).Select(MatchesRegexp(`mark .* as good`)).Confirm()
+
+ input.ExpectAlert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 08.*Do you want to reset")).Confirm()
+
+ input.Views().Information().Content(DoesNotContain("bisecting"))
+ }).
+ // back in master branch which just had the one commit
+ Lines(
+ Contains("only commit on master"),
+ )
},
})
diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go
index 59e810dec..2d5e6e098 100644
--- a/pkg/integration/tests/branch/checkout_by_name.go
+++ b/pkg/integration/tests/branch/checkout_by_name.go
@@ -21,22 +21,20 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Branches().
Focus().
Lines(
- Contains("master"),
+ Contains("master").IsSelected(),
Contains("@"),
).
SelectNextItem().
- Press(keys.Branches.CheckoutBranchByName)
-
- input.ExpectPrompt().Title(Equals("Branch name:")).Type("new-branch").Confirm()
+ Press(keys.Branches.CheckoutBranchByName).
+ Tap(func() {
+ input.ExpectPrompt().Title(Equals("Branch name:")).Type("new-branch").Confirm()
- input.ExpectAlert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm()
-
- input.Views().Branches().IsFocused().
+ input.ExpectAlert().Title(Equals("Branch not found")).Content(Equals("Branch not found. Create a new branch named new-branch?")).Confirm()
+ }).
Lines(
- MatchesRegexp(`\*.*new-branch`),
+ MatchesRegexp(`\*.*new-branch`).IsSelected(),
Contains("master"),
Contains("@"),
- ).
- SelectedLine(Contains("new-branch"))
+ )
},
})
diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go
index eba3a016f..f0921a82e 100644
--- a/pkg/integration/tests/branch/delete.go
+++ b/pkg/integration/tests/branch/delete.go
@@ -24,20 +24,18 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
MatchesRegexp(`branch-one`),
MatchesRegexp(`master`),
).
- Press(keys.Universal.Remove)
-
- input.ExpectAlert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm()
-
- input.Views().Branches().
+ Press(keys.Universal.Remove).
+ Tap(func() {
+ input.ExpectAlert().Title(Equals("Error")).Content(Contains("You cannot delete the checked out branch!")).Confirm()
+ }).
SelectNextItem().
- Press(keys.Universal.Remove)
-
- input.ExpectConfirmation().
- Title(Equals("Delete Branch")).
- Content(Contains("Are you sure you want to delete the branch 'branch-one'?")).
- Confirm()
-
- input.Views().Branches().IsFocused().
+ Press(keys.Universal.Remove).
+ Tap(func() {
+ input.ExpectConfirmation().
+ Title(Equals("Delete Branch")).
+ Content(Contains("Are you sure you want to delete the branch 'branch-one'?")).
+ Confirm()
+ }).
Lines(
MatchesRegexp(`\*.*branch-two`),
MatchesRegexp(`master`).IsSelected(),
diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go
index fc5bbebf0..f96a48b56 100644
--- a/pkg/integration/tests/branch/reset.go
+++ b/pkg/integration/tests/branch/reset.go
@@ -37,9 +37,6 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{
input.ExpectMenu().Title(Contains("reset to other-branch")).Select(Contains("hard reset")).Confirm()
- // ensure that we've returned from the menu before continuing
- input.Views().Branches().IsFocused()
-
// assert that we now have the expected commits in the commit panel
input.Views().Commits().
Lines(
diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go
index 75c060b34..de9e0a645 100644
--- a/pkg/integration/tests/cherry_pick/cherry_pick.go
+++ b/pkg/integration/tests/cherry_pick/cherry_pick.go
@@ -42,11 +42,10 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Contains("base"),
).
// copy commits 'four' and 'three'
- Press(keys.Commits.CherryPickCopy)
-
- input.Views().Information().Content(Contains("1 commit copied"))
-
- input.Views().SubCommits().
+ Press(keys.Commits.CherryPickCopy).
+ Tap(func() {
+ input.Views().Information().Content(Contains("1 commit copied"))
+ }).
SelectNextItem().
Press(keys.Commits.CherryPickCopy)
@@ -59,29 +58,27 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Contains("one"),
Contains("base"),
).
- Press(keys.Commits.PasteCommits)
-
- input.ExpectAlert().
- Title(Equals("Cherry-Pick")).
- Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
- Confirm()
-
- input.Views().Commits().
- IsFocused().
+ Press(keys.Commits.PasteCommits).
+ Tap(func() {
+ input.ExpectAlert().
+ Title(Equals("Cherry-Pick")).
+ Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
+ Confirm()
+ }).
Lines(
Contains("four"),
Contains("three"),
Contains("two"),
Contains("one"),
Contains("base"),
- )
-
- // we need to manually exit out of cherrry pick mode
- input.Views().Information().Content(Contains("2 commits copied"))
-
- input.Views().Commits().
- PressEscape()
-
- input.Views().Information().Content(DoesNotContain("commits copied"))
+ ).
+ Tap(func() {
+ // we need to manually exit out of cherry pick mode
+ input.Views().Information().Content(Contains("2 commits copied"))
+ }).
+ PressEscape().
+ Tap(func() {
+ input.Views().Information().Content(DoesNotContain("commits copied"))
+ })
},
})
diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
index 9b97be5db..9c02cc8d0 100644
--- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
+++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go
@@ -31,11 +31,10 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Contains("second-change-branch unrelated change"),
Contains("second change"),
).
- Press(keys.Commits.CherryPickCopy)
-
- input.Views().Information().Content(Contains("1 commit copied"))
-
- input.Views().SubCommits().
+ Press(keys.Commits.CherryPickCopy).
+ Tap(func() {
+ input.Views().Information().Content(Contains("1 commit copied"))
+ }).
SelectNextItem().
Press(keys.Commits.CherryPickCopy)
@@ -80,20 +79,20 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Contains("second change"),
Contains("first change"),
).
- SelectNextItem()
-
- // because we picked 'Second change' when resolving the conflict,
- // we now see this commit as having replaced First Change with Second Change,
- // as opposed to replacing 'Original' with 'Second change'
- input.Views().Main().
- Content(Contains("-First Change")).
- Content(Contains("+Second Change"))
-
- input.Views().Information().Content(Contains("2 commits copied"))
-
- input.Views().Commits().
- PressEscape()
-
- input.Views().Information().Content(DoesNotContain("commits copied"))
+ SelectNextItem().
+ Tap(func() {
+ // because we picked 'Second change' when resolving the conflict,
+ // we now see this commit as having replaced First Change with Second Change,
+ // as opposed to replacing 'Original' with 'Second change'
+ input.Views().Main().
+ Content(Contains("-First Change")).
+ Content(Contains("+Second Change"))
+
+ input.Views().Information().Content(Contains("2 commits copied"))
+ }).
+ PressEscape().
+ Tap(func() {
+ input.Views().Information().Content(DoesNotContain("commits copied"))
+ })
},
})
diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go
index acd31e4e7..c9bc91fdd 100644
--- a/pkg/integration/tests/commit/commit.go
+++ b/pkg/integration/tests/commit/commit.go
@@ -28,7 +28,8 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
input.ExpectCommitMessagePanel().Type(commitMessage).Confirm()
- input.Model().CommitCount(1)
- input.Model().HeadCommitMessage(Equals(commitMessage))
+ input.Model().
+ CommitCount(1).
+ HeadCommitMessage(Equals(commitMessage))
},
})
diff --git a/pkg/integration/tests/commit/new_branch.go b/pkg/integration/tests/commit/new_branch.go
index cd194593b..758edb558 100644
--- a/pkg/integration/tests/commit/new_branch.go
+++ b/pkg/integration/tests/commit/new_branch.go
@@ -21,22 +21,22 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Commits().
Focus().
+ SelectNextItem().
Lines(
Contains("commit 3"),
- Contains("commit 2"),
+ Contains("commit 2").IsSelected(),
Contains("commit 1"),
).
- SelectNextItem().
- Press(keys.Universal.New)
-
- branchName := "my-branch-name"
- input.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
+ Press(keys.Universal.New).
+ Tap(func() {
+ branchName := "my-branch-name"
+ input.ExpectPrompt().Title(Contains("New Branch Name")).Type(branchName).Confirm()
- input.Model().CurrentBranchName(branchName)
-
- input.Views().Commits().Lines(
- Contains("commit 2"),
- Contains("commit 1"),
- )
+ input.Model().CurrentBranchName(branchName)
+ }).
+ Lines(
+ Contains("commit 2"),
+ Contains("commit 1"),
+ )
},
})
diff --git a/pkg/integration/tests/commit/revert.go b/pkg/integration/tests/commit/revert.go
index 24de24e34..23cb5cb8e 100644
--- a/pkg/integration/tests/commit/revert.go
+++ b/pkg/integration/tests/commit/revert.go
@@ -23,14 +23,13 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
Lines(
Contains("first commit"),
).
- Press(keys.Commits.RevertCommit)
-
- input.ExpectConfirmation().
- Title(Equals("Revert commit")).
- Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
- Confirm()
-
- input.Views().Commits().IsFocused().
+ Press(keys.Commits.RevertCommit).
+ Tap(func() {
+ input.ExpectConfirmation().
+ Title(Equals("Revert commit")).
+ Content(MatchesRegexp(`Are you sure you want to revert \w+?`)).
+ Confirm()
+ }).
Lines(
Contains("Revert \"first commit\"").IsSelected(),
Contains("first commit"),
diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go
index 8919ab852..4e5dacd0b 100644
--- a/pkg/integration/tests/commit/staged.go
+++ b/pkg/integration/tests/commit/staged.go
@@ -24,24 +24,24 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
PressPrimaryAction(). // stage the file
PressEnter()
- input.Views().StagingSecondary().IsFocused()
- // 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"))
-
- // unstage the selected line
- input.Views().StagingSecondary().
- PressPrimaryAction()
-
- // 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"))
-
input.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"))
+ }).
+ // 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"))
+ }).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go
index d77602d51..9b46f4259 100644
--- a/pkg/integration/tests/commit/staged_without_hooks.go
+++ b/pkg/integration/tests/commit/staged_without_hooks.go
@@ -36,11 +36,11 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
// unstage the selected line
input.Views().StagingSecondary().
IsFocused().
- PressPrimaryAction()
-
- // the line should have been moved to the main view
- input.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line"))
- input.Views().StagingSecondary().
+ 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"))
+ }).
Content(DoesNotContain("+myfile content").Contains("+with a second line")).
Press(keys.Files.CommitChangesWithoutHook)
diff --git a/pkg/integration/tests/commit/unstaged.go b/pkg/integration/tests/commit/unstaged.go
index ea08b8462..2d6ba8b8a 100644
--- a/pkg/integration/tests/commit/unstaged.go
+++ b/pkg/integration/tests/commit/unstaged.go
@@ -26,18 +26,16 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
PressEnter()
input.Views().Staging().
- IsFocused()
-
- input.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
-
- // stage the first line
- input.Views().Staging().
- PressPrimaryAction()
-
- input.Views().Staging().Content(DoesNotContain("+myfile content"))
- input.Views().StagingSecondary().Content(Contains("+myfile content"))
-
- input.Views().Staging().
+ IsFocused().
+ Tap(func() {
+ input.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"))
+ }).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
diff --git a/pkg/integration/tests/diff/diff.go b/pkg/integration/tests/diff/diff.go
index d940b8c20..a30a50589 100644
--- a/pkg/integration/tests/diff/diff.go
+++ b/pkg/integration/tests/diff/diff.go
@@ -33,35 +33,33 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{
input.ExpectMenu().Title(Equals("Diffing")).Select(Contains(`diff branch-a`)).Confirm()
input.Views().Branches().
- IsFocused()
-
- input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-a"))
-
- input.Views().Branches().
- SelectNextItem()
-
- input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-b"))
- input.Views().Main().Content(Contains("+second line"))
-
- input.Views().Branches().
+ IsFocused().
+ Tap(func() {
+ input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-a"))
+ }).
+ SelectNextItem().
+ Tap(func() {
+ input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-b"))
+ input.Views().Main().Content(Contains("+second line"))
+ }).
PressEnter()
input.Views().SubCommits().
IsFocused().
- SelectedLine(Contains("update"))
-
- input.Views().Main().Content(Contains("+second line"))
-
- input.Views().SubCommits().
+ SelectedLine(Contains("update")).
+ Tap(func() {
+ input.Views().Main().Content(Contains("+second line"))
+ }).
PressEnter()
input.Views().CommitFiles().
IsFocused().
- SelectedLine(Contains("file1"))
-
- input.Views().Main().Content(Contains("+second line"))
+ SelectedLine(Contains("file1")).
+ Tap(func() {
+ input.Views().Main().Content(Contains("+second line"))
+ }).
+ PressEscape()
- input.Views().CommitFiles().PressEscape()
input.Views().SubCommits().PressEscape()
input.Views().Branches().
diff --git a/pkg/integration/tests/diff/diff_and_apply_patch.go b/pkg/integration/tests/diff/diff_and_apply_patch.go
index 3d78e1c55..65bb27ebd 100644
--- a/pkg/integration/tests/diff/diff_and_apply_patch.go
+++ b/pkg/integration/tests/diff/diff_and_apply_patch.go
@@ -36,38 +36,34 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Branches().
IsFocused().
- SelectNextItem()
-
- input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-b"))
- input.Views().Main().Content(Contains("+second line"))
-
- input.Views().Branches().
+ SelectNextItem().
+ Tap(func() {
+ input.Views().Information().Content(Contains("showing output for: git diff branch-a branch-b"))
+ input.Views().Main().Content(Contains("+second line"))
+ }).
PressEnter()
input.Views().SubCommits().
IsFocused().
- SelectedLine(Contains("update"))
-
- input.Views().Main().Content(Contains("+second line"))
-
- input.Views().SubCommits().
+ SelectedLine(Contains("update")).
+ Tap(func() {
+ input.Views().Main().Content(Contains("+second line"))
+ }).
PressEnter()
input.Views().CommitFiles().
IsFocused().
- SelectedLine(Contains("file1"))
-
- input.Views().Main().Content(Contains("+second line"))
-
- input.Views().CommitFiles().
+ SelectedLine(Contains("file1")).
+ Tap(func() {
+ input.Views().Main().Content(Contains("+second line"))
+ }).
PressPrimaryAction(). // add the file to the patch
- Press(keys.Universal.DiffingMenu)
-
- input.ExpectMenu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm()
+ Press(keys.Universal.DiffingMenu).
+ Tap(func() {
+ input.ExpectMenu().Title(Equals("Diffing")).Select(Contains("exit diff mode")).Confirm()
- input.Views().Information().Content(DoesNotContain("building patch"))
-
- input.Views().CommitFiles().
+ input.Views().Information().Content(DoesNotContain("building patch"))
+ }).
Press(keys.Universal.CreatePatchOptionsMenu)
// adding the regex '$' here to distinguish the menu item from the 'apply patch in reverse' item
diff --git a/pkg/integration/tests/diff/diff_commits.go b/pkg/integration/tests/diff/diff_commits.go
index 9b05cc582..c8091a17e 100644
--- a/pkg/integration/tests/diff/diff_commits.go
+++ b/pkg/integration/tests/diff/diff_commits.go
@@ -22,31 +22,28 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{
input.Views().Commits().
Focus().
Lines(
- Contains("third commit"),
+ Contains("third commit").IsSelected(),
Contains("second commit"),
Contains("first commit"),
).
- Press(keys.Universal.DiffingMenu)
+ Press(keys.Universal.DiffingMenu).
+ Tap(func() {
+ input.ExpectMenu().Title(Equals("Diffing")).Select(MatchesRegexp(`diff \w+`)).Confirm()
- input.ExpectMenu().Title(Equals("Diffing")).Select(MatchesRegexp(`diff \w+`)).Confirm()
-
- input.Views().Information().Content(Contains("showing output for: git diff"))
-
- input.Views().Commits().
+ input.Views().Information().Content(Contains("showing output for: git diff"))
+ }).
SelectNextItem().
SelectNextItem().
- SelectedLine(Contains("first commit"))
-
- input.Views().Main().Content(Contains("-second line\n-third line"))
-
- input.Views().Commits().
- Press(keys.Universal.DiffingMenu)
-
- input.ExpectMenu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm()
-
- input.Views().Main().Content(Contains("+second line\n+third line"))
-
- input.Views().Commits().
+ SelectedLine(Contains("first commit")).
+ Tap(func() {
+ input.Views().Main().Content(Contains("-second line\n-third line"))
+ }).
+ Press(keys.Universal.DiffingMenu).
+ Tap(func() {
+ input.ExpectMenu().Title(Equals("Diffing")).Select(Contains("reverse diff direction")).Confirm()
+
+ input.Views().Main().Content(Contains("+second line\n+third line"))
+ }).
PressEnter()
input.Views().CommitFiles().
diff --git a/pkg/integration/tests/interactive_rebase/one.go b/pkg/integration/tests/interactive_rebase/one.go
index eec707ecc..5e091f7fc 100644
--- a/pkg/integration/tests/interactive_rebase/one.go
+++ b/pkg/integration/tests/interactive_rebase/one.go
@@ -59,13 +59,13 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{
MatchesRegexp("fixup.*commit 03"),
MatchesRegexp("YOU ARE HERE.*commit 02"),
Contains("commit 01"),
+ ).
+ Tap(func() {
+ input.ContinueRebase()
+ }).
+ Lines(
+ Contains("commit 02"),
+ Contains("commit 01"),
)
-
- input.ContinueRebase()
-
- input.Views().Commits().Lines(
- Contains("commit 02"),
- Contains("commit 01"),
- )
},
})
diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go
index 48eae4a99..d18ea6f38 100644
--- a/pkg/integration/tests/stash/rename.go
+++ b/pkg/integration/tests/stash/rename.go
@@ -26,10 +26,10 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{
Equals("On master: foo"),
).
SelectNextItem().
- Press(keys.Stash.RenameStash)
-
- input.ExpectPrompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm()
-
- input.Views().Stash().SelectedLine(Equals("On master: foo baz"))
+ Press(keys.Stash.RenameStash).
+ Tap(func() {
+ input.ExpectPrompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm()
+ }).
+ SelectedLine(Equals("On master: foo baz"))
},
})