Merge "Add grouping by item Make test for item grouping Change-Id: I2573eeb0d6920af3005084091e41503c98436c1b 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 e061a70..cfa1ee0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Xored Software Inc and others.
+ * Copyright (c) 2009, 2020 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
@@ -104,6 +104,7 @@
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;
@@ -212,8 +213,18 @@
if (c1 instanceof Selector && c2 instanceof Selector) {
Selector s1 = (Selector) c1;
Selector s2 = (Selector) c2;
- if (s1.getId() != null && s2.getId() != null)
+ if (s1.getId() != null && s2.getId() != null) {
return s1.getId().compareTo(s2.getId());
+ }
+ }
+
+ if (c1 instanceof GetItemImpl && c2 instanceof GetItemImpl) {
+ GetItemImpl i1 = (GetItemImpl) c1;
+ GetItemImpl i2 = (GetItemImpl) c2;
+
+ if (i1.getPath() != null && i2.getPath() != null) {
+ return i1.getPath().compareTo(i2.getPath());
+ }
}
return 1;
}
@@ -238,8 +249,8 @@
}
/**
- * @throws IndexOutOfBoundsException
- * if there's no more tesla commands to convert
+ * @throws IndexOutOfBoundsException if there's no more tesla commands to
+ * convert
* @return ECL command
*/
protected Command teslaCommand() {
@@ -727,7 +738,8 @@
@TeslaCommand(packageUri = ProtocolPackage.eNS_URI, classifier = "ActivateCellEditor")
protected Command activateCellEditor(ActivateCellEditor c) {
Command selector = selectorOf(c.getElement());
- return TeslaScriptletFactory.makePipe(selector, TeslaScriptletFactory.makeCellEditorActivate(c.getColumn(), c.getType().getValue(), c.getButton()));
+ return TeslaScriptletFactory.makePipe(selector,
+ TeslaScriptletFactory.makeCellEditorActivate(c.getColumn(), c.getType().getValue(), c.getButton()));
}
@TeslaCommand(packageUri = ProtocolPackage.eNS_URI, classifier = "ApplyCellEditor")
diff --git a/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test b/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test
new file mode 100644
index 0000000..2eaba21
--- /dev/null
+++ b/rcpttTests/platform_tests/selfAUTTests/Assertion/AssertionGroupByItem.test
@@ -0,0 +1,127 @@
+--- RCPTT testcase ---
+Format-Version: 1.0
+Element-Name: AssertionGroupByItem
+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
+Testcase-Type: ecl
+
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
+Content-Type: text/plain
+Entry-Name: .description
+
+Copyright (c) 2020 Xored Software Inc and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v2.0
+which accompanies this distribution, and is available at
+https://www.eclipse.org/legal/epl-v20.html
+
+Contributors:
+ Xored Software Inc - initial creation and/or initial documentation
+--------------------------------------------------------------------------------
+
+Test Steps:
+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
+5. Check if generate correct code with grouping by item
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
+Content-Type: text/ecl
+Entry-Name: .content
+
+get-view "Test Explorer" | get-tree | get-menu -path "New/RCP Testing Tool Project" | click
+with [get-window "New Project"] {
+ with [get-editbox -after [get-label "Project name:"]] {
+ set-text test
+ }
+ get-button Finish | click
+}
+get-view "Test Explorer" | get-tree | select test | get-menu -path "New/Test Case" | click
+with [get-window "New Test Case"] {
+ get-editbox -after [get-label "Name:"] | set-text t2
+ get-button Finish | click
+}
+with [get-editor t2 | get-section Script | get-text-viewer] {
+ set-text "get-button \"Open Perspective\" | click\n" +
+ "get-window \"Open Perspective\" | get-table | select Debug | double-click\n" +
+ "with [get-view Expressions] {\n" +
+ "click\n" +
+ "with [get-tree] {\n" +
+ "select \"Add new expression\" | activate-cell-edit -type MouseClickSelection\n" +
+ "with [get-editbox] {\n" +
+ "set-text 123\n" +
+ "key-type Enter\n" +
+ "}\n" +
+ "apply-cell-edit -deactivate\n" +
+ "select \"Add new expression\" | activate-cell-edit -type MouseClickSelection\n" +
+ "with [get-editbox] {\n" +
+ "set-text 456\n" +
+ "key-type Enter\n" +
+ "}\n" +
+ "apply-cell-edit -deactivate\n" +
+ "}\n" +
+ "}\n"
+}
+
+get-editor t2 | get-button Record | 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 {
+ with [get-view Expressions | get-tree] {
+ get-item -path "\"123\"" | click
+ }
+}
+
+with [get-window "Control Panel - t2 (test) - selfQ7 [Asserting]"] {
+ with [get-window "Assertion and Verification"] {
+ get-tree | get-item -path "TreeItem \\(Basic Properties\\)/columns" | expand
+ get-tree | get-item -path "TreeItem \\(Basic Properties\\)/columns" | check
+ get-button Add | click
+ }
+}
+
+get-aut selfQ7 | eval {
+ with [get-view Expressions | get-tree] {
+ get-item -path "\"456\"" | click
+ }
+}
+
+with [get-window "Control Panel - t2 (test) - selfQ7 [Asserting]"] {
+ with [get-window "Assertion and Verification"] {
+ get-tree | get-item -path "TreeItem \\(Basic Properties\\)/columns" | expand
+ get-tree | get-item -path "TreeItem \\(Basic Properties\\)/columns" | check
+ get-button Add | click
+ }
+}
+
+
+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-button "Switch to Recording Mode" | click
+}
+
+get-aut selfQ7 | eval {
+ get-button "Remove All Expressions" | click
+ get-window "Remove All Expressions" | get-button Yes | click
+}
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--