summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/cherry_pick
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-12-25 11:38:00 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-12-25 11:38:00 +1100
commit5d2584a1883df779d2ced5a3c44498a09179d83d (patch)
tree741f6147ea4411d730c3a803c2d05aa31fe10942 /pkg/integration/tests/cherry_pick
parentb623ecf898e1ac35b0a6093978203a7b5c13c42e (diff)
introduce ViewLines functions
Diffstat (limited to 'pkg/integration/tests/cherry_pick')
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick.go37
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go30
2 files changed, 47 insertions, 20 deletions
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)