Add grouping by menu
Add tests for menu grouping

Change-Id: I70ace20aa29be30bd174b869d43e08d2f2ff737f
Signed-off-by: Galina Shvetsova <galina.shvetsova@xored.com>
diff --git a/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java b/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
index cfa1ee0..db077c9 100644
--- a/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
+++ b/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
@@ -96,6 +96,8 @@
 import org.eclipse.rcptt.tesla.ecl.model.Decrypt;
 import org.eclipse.rcptt.tesla.ecl.model.ExecWithOptions;
 import org.eclipse.rcptt.tesla.ecl.model.FromRawKey;
+import org.eclipse.rcptt.tesla.ecl.model.GetItem;
+import org.eclipse.rcptt.tesla.ecl.model.GetMenu;
 import org.eclipse.rcptt.tesla.ecl.model.GetProperty;
 import org.eclipse.rcptt.tesla.ecl.model.KeyType;
 import org.eclipse.rcptt.tesla.ecl.model.Mouse;
@@ -104,7 +106,6 @@
 import org.eclipse.rcptt.tesla.ecl.model.TeslaFactory;
 import org.eclipse.rcptt.tesla.ecl.model.TeslaPackage;
 import org.eclipse.rcptt.tesla.ecl.model.TypeCommandKey;
-import org.eclipse.rcptt.tesla.ecl.model.impl.GetItemImpl;
 import org.eclipse.rcptt.tesla.internal.core.SimpleCommandPrinter;
 import org.eclipse.rcptt.tesla.recording.core.ecl.KeyStrokeManager;
 import org.eclipse.rcptt.tesla.recording.core.ecl.TeslaCommand;
@@ -217,15 +218,22 @@
 						return s1.getId().compareTo(s2.getId());
 					}
 				}
-
-				if (c1 instanceof GetItemImpl && c2 instanceof GetItemImpl) {
-					GetItemImpl i1 = (GetItemImpl) c1;
-					GetItemImpl i2 = (GetItemImpl) c2;
+				if (c1 instanceof GetItem && c2 instanceof GetItem) {
+					GetItem i1 = (GetItem) c1;
+					GetItem i2 = (GetItem) c2;
 
 					if (i1.getPath() != null && i2.getPath() != null) {
 						return i1.getPath().compareTo(i2.getPath());
 					}
 				}
+				if (c1 instanceof GetMenu && c2 instanceof GetMenu) {
+					GetMenu m1 = (GetMenu) c1;
+					GetMenu m2 = (GetMenu) c2;
+
+					if (m1.getPath() != null && m2.getPath() != null) {
+						return m1.getPath().compareTo(m2.getPath());
+					}
+				}
 				return 1;
 			}
 		});
diff --git a/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test b/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupping.test
similarity index 67%
rename from rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test
rename to rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupping.test
index 2eaba21..0750712 100644
--- a/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test
+++ b/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupping.test
@@ -1,12 +1,12 @@
 --- RCPTT testcase ---
 Format-Version: 1.0
-Element-Name: AssertionGroupByItem
+Element-Name: AssertionGroupping
 Element-Type: testcase
 Element-Version: 3.0
 External-Reference: 
 Id: _GLGj8FFQEeqyG-160wAoew
-Runtime-Version: 2.5.1.qualifier
-Save-Time: 2/19/20 12:26 PM
+Runtime-Version: 2.5.2.qualifier
+Save-Time: 3/10/20 6:11 PM
 Testcase-Type: ecl
 
 ------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
@@ -27,8 +27,12 @@
 1. Create test for self-aut
 2. Add to created test script with variables defenition
 3. Start asserting selfQ7
-4. Assert columns in expressions table 
+4. Assert columns in expressions table
 5. Check if generate correct code with grouping by item
+6. Remove all expressions
+7. Start asserting selfQ7
+8. Assert Edit menu
+9. Check if generated code with grouping by menu
 ------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
 ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
 Content-Type: text/ecl
@@ -104,19 +108,18 @@
 }
 
 
-get-window "Control Panel - t2 (test) - selfQ7 [Asserting]" | get-text-viewer | get-property text 
-    | contains "with [get-view Expressions | get-tree] {\n"
-    + "    with [get-item -path \"\\\"123\\\"\"] {\n"
-    + "        get-property \"columns[0]\" | equals \"\\\"123\\\"\" | verify-true\n"
-    + "        get-property \"columns[1]\" | equals \"\" | verify-true\n"
-    + "    }\n"
-    + "    with [get-item -path \"\\\"456\\\"\"] {\n"
-    + "        get-property \"columns[0]\" | equals \"\\\"456\\\"\" | verify-true\n"
-    + "        get-property \"columns[1]\" | equals \"\" | verify-true\n"
-    + "    }\n"
-    + "}" | verify-true
-    
 with [get-window "Control Panel - t2 (test) - selfQ7 [Asserting]"] {
+	get-text-viewer | get-property text
+    	| contains "with [get-view Expressions | get-tree] {\n"
+    	+ "    with [get-item -path \"\\\"123\\\"\"] {\n"
+    	+ "        get-property \"columns[0]\" | equals \"\\\"123\\\"\" | verify-true\n"
+    	+ "        get-property \"columns[1]\" | equals \"\" | verify-true\n"
+    	+ "    }\n"
+    	+ "    with [get-item -path \"\\\"456\\\"\"] {\n"
+    	+ "        get-property \"columns[0]\" | equals \"\\\"456\\\"\" | verify-true\n"
+    	+ "        get-property \"columns[1]\" | equals \"\" | verify-true\n"
+    	+ "    }\n"
+    	+ "}" | verify-true
 	get-button "Switch to Recording Mode" | click
 }
 
@@ -124,4 +127,30 @@
 	get-button "Remove All Expressions" | click
 	get-window "Remove All Expressions" | get-button Yes | click
 }
+
+with [get-window "Control Panel - t2 (test) - selfQ7 [Recording]"] {
+	get-button "Switch to Recording Mode" | click
+	get-button "Switch to Assertion Mode" | click
+}
+
+get-aut selfQ7 | eval {
+	get-menu -path "Edit" | click
+}
+with [get-window "Control Panel - t2 (test) - selfQ7 [Asserting]" | get-window "Assertion and Verification"] {
+    get-tree | get-item -path "MenuItem \\(Basic Properties\\)/caption" | check
+    get-button Add | click
+}
+
+get-aut selfQ7 | eval {
+	get-menu -path "Edit" | click
+}
+with [get-window "Control Panel - t2 (test) - selfQ7 [Asserting]" | get-window "Assertion and Verification"] {
+    get-tree | get-item -path "MenuItem \\(Basic Properties\\)/index" | check
+    get-button Add | click
+}
+get-window "Control Panel - t2 (test) - selfQ7 [Asserting]" | get-text-viewer | get-property text
+    | contains "with [get-menu -path Edit] {\n"
+    + "    get-property caption | equals \"&Edit\" | verify-true\n"
+    + "    get-property index | equals 1 | verify-true\n"
+    + "}" | verify-true
 ------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--