From 53e06b71aecd2ddaf80516627ba223ac2adc5420 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 27 Dec 2022 21:25:11 +1100 Subject: add tap function --- pkg/integration/tests/bisect/basic.go | 44 ++++++++++------------- pkg/integration/tests/bisect/from_other_branch.go | 24 ++++++------- 2 files changed, 31 insertions(+), 37 deletions(-) (limited to 'pkg/integration/tests/bisect') 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"), + ) }, }) -- cgit v1.2.3