From 5d2584a1883df779d2ced5a3c44498a09179d83d Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 25 Dec 2022 11:38:00 +1100 Subject: introduce ViewLines functions --- pkg/integration/tests/cherry_pick/cherry_pick.go | 37 +++++++++++++++------- .../tests/cherry_pick/cherry_pick_conflicts.go | 30 ++++++++++++------ 2 files changed, 47 insertions(+), 20 deletions(-) (limited to 'pkg/integration/tests/cherry_pick') diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 444cf35e4..6d11b9a7e 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -27,35 +27,50 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.SelectedLine(Contains("first-branch")) + assert.CurrentViewLines( + Contains("first-branch"), + Contains("second-branch"), + Contains("master"), + ) + input.NextItem() - assert.SelectedLine(Contains("second-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.SelectedLine(Contains("four")) + assert.CurrentViewLines( + Contains("four"), + Contains("three"), + Contains("base"), + ) + + // copy commits 'four' and 'three' input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) - input.NextItem() - assert.SelectedLine(Contains("three")) input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.SelectedLine(Contains("two")) + assert.CurrentViewLines( + Contains("two"), + Contains("one"), + Contains("base"), + ) + 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?")) assert.CurrentViewName("commits") - assert.SelectedLine(Contains("four")) - input.NextItem() - assert.SelectedLine(Contains("three")) - input.NextItem() - assert.SelectedLine(Contains("two")) + assert.CurrentViewLines( + Contains("four"), + Contains("three"), + Contains("two"), + Contains("one"), + Contains("base"), + ) assert.ViewContent("information", Contains("2 commits copied")) input.Press(keys.Universal.Return) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index 377e21e76..6a9c47781 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -18,26 +18,37 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.SelectedLine(Contains("first-change-branch")) + assert.CurrentViewLines( + Contains("first-change-branch"), + Contains("second-change-branch"), + Contains("original-branch"), + ) + input.NextItem() - assert.SelectedLine(Contains("second-change-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.SelectedLine(Contains("second-change-branch unrelated change")) + + assert.CurrentViewTopLines( + Contains("second-change-branch unrelated change"), + Contains("second change"), + ) + input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() - assert.SelectedLine(Contains("second change")) input.Press(keys.Commits.CherryPickCopy) assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.SelectedLine(Contains("first change")) + assert.CurrentViewTopLines( + Contains("first change"), + ) + 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?")) @@ -63,16 +74,17 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.SelectedLine(Contains("second-change-branch unrelated change")) + assert.CurrentViewTopLines( + Contains("second-change-branch unrelated change"), + Contains("second change"), + Contains("first change"), + ) input.NextItem() - assert.SelectedLine(Contains("second change")) // 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' assert.MainViewContent(Contains("-First Change")) assert.MainViewContent(Contains("+Second Change")) - input.NextItem() - assert.SelectedLine(Contains("first change")) assert.ViewContent("information", Contains("2 commits copied")) input.Press(keys.Universal.Return) -- cgit v1.2.3