Test the next/previous comment buttons

Also add a new helper to get the right end side of the compare editor
and use it where necessary

Change-Id: I24b458665c93083d3a17dd98f671942eea0afc09
Signed-off-by: Pascal Rapicault <pascal@rapicorp.com>
diff --git a/org.eclipse.egerrit.ui.rcptt.tests/HelperScripts.ctx b/org.eclipse.egerrit.ui.rcptt.tests/HelperScripts.ctx
index 44c2035..b6eb657 100644
--- a/org.eclipse.egerrit.ui.rcptt.tests/HelperScripts.ctx
+++ b/org.eclipse.egerrit.ui.rcptt.tests/HelperScripts.ctx
@@ -6,7 +6,7 @@
 Element-Version: 2.0
 Id: _jPStUFRJEeaXLqlXvYQIgg
 Runtime-Version: 2.1.0.201605312320
-Save-Time: 8/18/16 4:51 PM
+Save-Time: 8/18/16 3:21 PM
 
 ------=_.ecl.context-718f04b4-ed39-33e3-af62-0995e4561998
 Content-Type: text/ecl
@@ -245,4 +245,12 @@
 	}
 }
 
+proc "assert-that-selected-text" [val is] [val in -input] {
+	$in | get-property -name "getSelectionText()" | equals $is | verify-true
+}
+
+proc "get-right-editor" [val in -input] {
+	get-text-viewer -index 1
+}
+
 ------=_.ecl.context-718f04b4-ed39-33e3-af62-0995e4561998--
diff --git a/org.eclipse.egerrit.ui.rcptt.tests/compare/CompareEditorComment.test b/org.eclipse.egerrit.ui.rcptt.tests/compare/CompareEditorComment.test
index 515361b..425857b 100644
--- a/org.eclipse.egerrit.ui.rcptt.tests/compare/CompareEditorComment.test
+++ b/org.eclipse.egerrit.ui.rcptt.tests/compare/CompareEditorComment.test
@@ -5,8 +5,8 @@
 Element-Version: 3.0
 External-Reference: 
 Id: _Hr_sEFq6EeaEZtYu-O9HmA
-Runtime-Version: 2.1.0.201606221726
-Save-Time: 8/16/16 11:42 AM
+Runtime-Version: 2.1.0.201605312320
+Save-Time: 8/18/16 3:17 PM
 Testcase-Type: ecl
 
 ------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
@@ -26,7 +26,7 @@
 // Type a comment and make sure it is colored in yellow
 with [get-editor -index 1] {
 	insertComment -on right -text comment -atLine 1
-	with [get-text-viewer -index 1] {
+	with [get-right-editor] {
 		set-caret-pos -line 2
 		get-property "styleAtCaret.text" | equals comment | verify-true
 		get-property "styleAtCaret.foregroundColor" | equals "#000000" | verify-true
@@ -37,7 +37,7 @@
 // Save the comment and confirm that it is a draft and is colored in yellow
 with [get-editor -index 1] {
 	key-type "M1+s"
-	with [get-text-viewer -index 1] {
+	with [get-right-editor] {
 		set-caret-pos -line 2
 		get-property "styleAtCaret.text" | equals "Draft.*comment.*" | verify-true
 		get-property "styleAtCaret.foregroundColor" | equals "#000000" | verify-true
@@ -52,7 +52,7 @@
 
 // Now check that the color is not yellow
 with [get-editor -index 1] {
-	with [get-text-viewer -index 1] {
+	with [get-right-editor] {
 		set-caret-pos -line 2
 		get-property "styleAtCaret.text" | equals "admin.*comment.*" | verify-true
 		get-property "styleAtCaret.foregroundColor" | equals "#000000" | verify-true
diff --git a/org.eclipse.egerrit.ui.rcptt.tests/compare/NextPreviousCommentAction.test b/org.eclipse.egerrit.ui.rcptt.tests/compare/NextPreviousCommentAction.test
new file mode 100644
index 0000000..8ed6627
--- /dev/null
+++ b/org.eclipse.egerrit.ui.rcptt.tests/compare/NextPreviousCommentAction.test
@@ -0,0 +1,48 @@
+--- RCPTT testcase ---
+Format-Version: 1.0
+Element-Name: NextPreviousCommentAction
+Element-Type: testcase
+Element-Version: 3.0
+External-Reference: 
+Id: _yjV7cGU6EeaCA8nt1hTvvg
+Runtime-Version: 2.1.0.201605312320
+Save-Time: 8/18/16 3:15 PM
+Testcase-Type: ecl
+
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
+Content-Type: text/plain
+Entry-Name: .description
+
+Test the next comment action
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
+Content-Type: text/ecl
+Entry-Name: .content
+
+let [val review [amend-review -review [create-review -server $serverURL]]] {
+	openCompareEditor $review
+}
+
+// Type a comment and make sure it is colored in yellow
+with [get-editor "Compare.*"] {
+	insertComment -on right -text "first comment" -atLine 0 -save
+	insertComment -on right -text "second comment" -atLine 2 -save
+}
+
+with [get-editor "Compare.*"] {
+	get-button "Go To Next Group of Comment Annotation" | click
+	get-right-editor | assert-that-selected-text -is ".*first comment.*"
+
+	get-button "Go To Next Group of Comment Annotation" | click
+	get-right-editor | assert-that-selected-text -is ".*second comment.*"
+
+	// Check that we circle through the comments in the same editor
+	get-button "Go To Next Group of Comment Annotation" | click
+	get-right-editor | assert-that-selected-text -is ".*first comment.*"
+
+	// Now use the previous comment button
+	// Check that we circle through the comments in the same editor
+	get-button "Go To Previous Group of Comment Annotation" | click
+	get-right-editor | assert-that-selected-text -is ".*second comment.*"
+}
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--