From 4466651d75bbec5339d5a5e45ed093db8d60ae84 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Fri, 1 Aug 2014 16:07:52 +0300 Subject: [PATCH] TableItemDescriptionGenerator test upgrade (#14292) Change-Id: Ica328a6e68c684119b1c0c627e5e1451aaf8b391 --- .../TableItemDescriptionGeneratorTest.html | 418 ------------------ ...a => TableItemDescriptionGeneratorUI.java} | 15 +- .../TableItemDescriptionGeneratorUITest.java | 241 ++++++++++ .../tests/components/table/TableTooltips.html | 91 ---- ...TreeTableItemDescriptionGeneratorTest.html | 357 --------------- ... TreeTableItemDescriptionGeneratorUI.java} | 8 +- ...eeTableItemDescriptionGeneratorUITest.java | 143 ++++++ 7 files changed, 396 insertions(+), 877 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html rename uitest/src/com/vaadin/tests/components/table/{TableItemDescriptionGeneratorTest.java => TableItemDescriptionGeneratorUI.java} (91%) create mode 100644 uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableTooltips.html delete mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html rename uitest/src/com/vaadin/tests/components/treetable/{TreeTableItemDescriptionGeneratorTest.java => TreeTableItemDescriptionGeneratorUI.java} (88%) create mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html deleted file mode 100644 index 4c2dec9784..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - - -TableItemDescriptionGeneratorTest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TableItemDescriptionGeneratorTest
open/run/TableItemDescriptionGeneratorTest?restartApplication
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Text
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Button 1 description
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Textfield's own description
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseClickvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]12,6
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Text
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Component
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Generated component
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseClickvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]7,8
mouseClickvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]7,5
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Button 1 description
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Textfield's own description
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseClickvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]7,8
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
pause1000
assertElementPositionLeftvaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]-5000
- - diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java similarity index 91% rename from uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java rename to uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java index ec81194f14..809e639448 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java @@ -5,7 +5,8 @@ import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; @@ -13,7 +14,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class TableItemDescriptionGeneratorTest extends TestBase { +public class TableItemDescriptionGeneratorUI extends AbstractTestUI { private final String TEXT_PROPERTY_ID = "Text"; private final String GEN_WIDGET_PROPERTY_ID = "Generated component"; @@ -23,7 +24,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase { private CheckBox tableRowItemDescription; @Override - protected void setup() { + protected void setup(VaadinRequest request) { final Table table = createTable(); table.setId("table"); componentDescription = new CheckBox("Tooltip on components"); @@ -73,7 +74,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase { if (propertyId == null && tableRowItemDescription.getValue()) { return "Row description " + itemId; } else if (tableCellItemDescription.getValue()) { - return "Cell description " + itemId + "," + propertyId; + return "Cell description " + itemId + ", " + propertyId; } return null; } @@ -100,7 +101,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase { } @Override - protected String getDescription() { + protected String getTestDescription() { return "Cells and rows should have tooltips"; } @@ -109,13 +110,12 @@ public class TableItemDescriptionGeneratorTest extends TestBase { return 5414; } + @SuppressWarnings("unchecked") private Container createContainer(boolean description) { IndexedContainer container = new IndexedContainer(); container.addContainerProperty(TEXT_PROPERTY_ID, String.class, ""); container.addContainerProperty(WIDGET_PROPERTY_ID, Component.class, null); - // container.addContainerProperty(COLUMN3_PROPERTY_ID, String.class, - // ""); for (int i = 0; i < 5; i++) { Item item = container.addItem("item " + i); @@ -125,7 +125,6 @@ public class TableItemDescriptionGeneratorTest extends TestBase { b.setDescription("Button " + i + " description"); } item.getItemProperty(WIDGET_PROPERTY_ID).setValue(b); - // item.getItemProperty(COLUMN3_PROPERTY_ID).setValue("last" + i); } return container; diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java new file mode 100644 index 0000000000..555a38a91e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java @@ -0,0 +1,241 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.table; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.TooltipTest; + +/** + * Tests Table tooltips with various settings. + * + * @author Vaadin Ltd + */ +public class TableItemDescriptionGeneratorUITest extends TooltipTest { + + @Test + public void testDescriptions() throws Exception { + openTestURL(); + + checkTooltipNotPresent(); + + TableElement table = $(TableElement.class).first(); + List checkboxes = $(CheckBoxElement.class).all(); + assertEquals(3, checkboxes.size()); + + // check text description + TestBenchElement cell_1_0 = table.getCell(1, 0); + cell_1_0.showTooltip(); + checkTooltip("Cell description item 1, Text"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check button description + TestBenchElement cell_1_1 = table.getCell(1, 1); + cell_1_1.showTooltip(); + checkTooltip("Button 1 description"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check textfield's description + TestBenchElement cell_1_2 = table.getCell(1, 2); + cell_1_2.showTooltip(); + checkTooltip("Textfield's own description"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // uncheck component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = table.getCell(1, 0); + cell_1_0.showTooltip(); + checkTooltip("Cell description item 1, Text"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check button description + cell_1_1 = table.getCell(1, 1); + cell_1_1.showTooltip(); + checkTooltip("Cell description item 1, Component"); + + // move somewhere without a description + new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform(); + sleep(1000); + checkTooltipNotPresent(); + + // check textfield's description + cell_1_2 = table.getCell(1, 2); + cell_1_2.showTooltip(); + checkTooltip("Cell description item 1, Generated component"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + // uncheck cell tooltips + checkboxes.get(1).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = table.getCell(1, 0); + cell_1_0.showTooltip(); + checkTooltip("Row description item 1"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check button description + cell_1_1 = table.getCell(1, 1); + cell_1_1.showTooltip(); + checkTooltip("Button 1 description"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check textfield's description + cell_1_2 = table.getCell(1, 2); + cell_1_2.showTooltip(); + checkTooltip("Textfield's own description"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // uncheck component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = table.getCell(1, 0); + cell_1_0.showTooltip(); + checkTooltip("Row description item 1"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check button description + cell_1_1 = table.getCell(1, 1); + cell_1_1.showTooltip(); + checkTooltip("Row description item 1"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + + // check textfield's description + cell_1_2 = table.getCell(1, 2); + cell_1_2.showTooltip(); + checkTooltip("Row description item 1"); + + // move somewhere without a description + checkboxes.get(2).showTooltip(); + checkTooltipNotPresent(); + } + + @Test + public void testPosition() throws Exception { + openTestURL(); + + TableElement table = $(TableElement.class).first(); + List checkboxes = $(CheckBoxElement.class).all(); + assertEquals(3, checkboxes.size()); + + TestBenchElement cell_3_0 = table.getCell(3, 0); + + // move to the center of the cell + new Actions(getDriver()).moveToElement(cell_3_0).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Cell description item 3, Text"); + clearTooltip(); + + // move outside the cell + new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform(); + + // move to the corner of the cell + new Actions(getDriver()).moveToElement(cell_3_0, 0, 0).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Cell description item 3, Text"); + clearTooltip(); + + // uncheck cell tooltips + checkboxes.get(1).findElement(By.tagName("input")).click(); + + TestBenchElement cell_1_1 = table.getCell(1, 1); + + // move to the center of the cell + new Actions(getDriver()).moveToElement(cell_1_1).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Button 1 description"); + clearTooltip(); + + // move to the corner of the element, outside of the button + new Actions(getDriver()).moveToElement(cell_1_1, 0, 0).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Row description item 1"); + clearTooltip(); + + // check cell tooltips + checkboxes.get(1).findElement(By.tagName("input")).click(); + + TestBenchElement cell_4_2 = table.getCell(4, 2); + + // move to the center of the cell + new Actions(getDriver()).moveToElement(cell_4_2).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Textfield's own description"); + clearTooltip(); + + // move to the corner of the element, outside of the textfield + new Actions(getDriver()).moveToElement(cell_4_2, 0, 0).perform(); + sleep(1000); + + // ensure the tooltip is present + checkTooltip("Cell description item 4, Generated component"); + clearTooltip(); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableTooltips.html b/uitest/src/com/vaadin/tests/components/table/TableTooltips.html deleted file mode 100644 index 13ceea935f..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableTooltips.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.table.TableItemDescriptionGeneratorTest?restartApplication
mouseMovevaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]57,5
pause10001000
assertTextvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 3,Text
mouseClickvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]810,153
mouseClickvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]355,350
dragvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]822,249
dropvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]90,12
mouseMovevaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]57,12
pause10001000
assertTextvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseClickvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]1011,283
mouseMovevaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VTextField[0]58,10
pause10001000
assertTextvaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Textfield's own description
- - diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html deleted file mode 100644 index 7f2f61bfc3..0000000000 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/TreeTableItemDescriptionGeneratorTest?restartApplication
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Text
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Button 1 description
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Textfield's own description
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseClickvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]12,6
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Text
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Component
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Cell description item 1,Generated component
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseClickvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]7,8
mouseClickvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]7,5
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Button 1 description
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Textfield's own description
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseClickvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]7,8
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]22,7
waitForElementPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
assertTextvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]Row description item 1
mouseMoveAtvaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]22,7
waitForElementNotPresentvaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]
- - diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java similarity index 88% rename from uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java rename to uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java index 2864156b03..ba057f4c41 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java @@ -15,14 +15,16 @@ */ package com.vaadin.tests.components.treetable; -import com.vaadin.tests.components.table.TableItemDescriptionGeneratorTest; +import com.vaadin.tests.components.table.TableItemDescriptionGeneratorUI; import com.vaadin.ui.Table; import com.vaadin.ui.TreeTable; -public class TreeTableItemDescriptionGeneratorTest extends - TableItemDescriptionGeneratorTest { +public class TreeTableItemDescriptionGeneratorUI extends + TableItemDescriptionGeneratorUI { + @Override protected Table createTable() { return new TreeTable(); } + } diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java new file mode 100644 index 0000000000..849d19cafa --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java @@ -0,0 +1,143 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.treetable; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.TreeTableElement; +import com.vaadin.tests.tb3.TooltipTest; + +/** + * Tests TreeTable tooltips with various settings. + * + * @author Vaadin Ltd + */ +public class TreeTableItemDescriptionGeneratorUITest extends TooltipTest { + + @Test + public void testDescriptions() throws Exception { + openTestURL(); + + checkTooltipNotPresent(); + + TreeTableElement treeTable = $(TreeTableElement.class).first(); + List checkboxes = $(CheckBoxElement.class).all(); + assertEquals(3, checkboxes.size()); + + // check text description + TestBenchElement cell_1_0 = treeTable.getCell(1, 0); + checkTooltip(cell_1_0, "Cell description item 1, Text"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check button description + TestBenchElement cell_1_1 = treeTable.getCell(1, 1); + checkTooltip(cell_1_1, "Button 1 description"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check textfield's description + TestBenchElement cell_1_2 = treeTable.getCell(1, 2); + checkTooltip(cell_1_2, "Textfield's own description"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // uncheck component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = treeTable.getCell(1, 0); + checkTooltip(cell_1_0, "Cell description item 1, Text"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check button description + cell_1_1 = treeTable.getCell(1, 1); + checkTooltip(cell_1_1, "Cell description item 1, Component"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check textfield's description + cell_1_2 = treeTable.getCell(1, 2); + checkTooltip(cell_1_2, "Cell description item 1, Generated component"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + // uncheck cell tooltips + checkboxes.get(1).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = treeTable.getCell(1, 0); + checkTooltip(cell_1_0, "Row description item 1"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check button description + cell_1_1 = treeTable.getCell(1, 1); + checkTooltip(cell_1_1, "Button 1 description"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check textfield's description + cell_1_2 = treeTable.getCell(1, 2); + checkTooltip(cell_1_2, "Textfield's own description"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // uncheck component tooltips + checkboxes.get(0).findElement(By.tagName("input")).click(); + + // check text description + cell_1_0 = treeTable.getCell(1, 0); + checkTooltip(cell_1_0, "Row description item 1"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check button description + cell_1_1 = treeTable.getCell(1, 1); + checkTooltip(cell_1_1, "Row description item 1"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + + // check textfield's description + cell_1_2 = treeTable.getCell(1, 2); + checkTooltip(cell_1_2, "Row description item 1"); + + // move somewhere without a description + checkTooltip(checkboxes.get(2), null); + } + +} -- 2.39.5