From 4466651d75bbec5339d5a5e45ed093db8d60ae84 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Fri, 1 Aug 2014 16:07:52 +0300 Subject: TableItemDescriptionGenerator test upgrade (#14292) Change-Id: Ica328a6e68c684119b1c0c627e5e1451aaf8b391 --- .../table/TableItemDescriptionGeneratorTest.html | 418 --------------------- .../table/TableItemDescriptionGeneratorTest.java | 134 ------- .../table/TableItemDescriptionGeneratorUI.java | 133 +++++++ .../table/TableItemDescriptionGeneratorUITest.java | 241 ++++++++++++ .../tests/components/table/TableTooltips.html | 91 ----- .../TreeTableItemDescriptionGeneratorTest.html | 357 ------------------ .../TreeTableItemDescriptionGeneratorTest.java | 28 -- .../TreeTableItemDescriptionGeneratorUI.java | 30 ++ .../TreeTableItemDescriptionGeneratorUITest.java | 143 +++++++ 9 files changed, 547 insertions(+), 1028 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java create mode 100644 uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java 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 delete mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java create mode 100644 uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java 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/TableItemDescriptionGeneratorTest.java deleted file mode 100644 index ec81194f14..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Container; -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.ui.AbstractSelect.ItemDescriptionGenerator; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; - -public class TableItemDescriptionGeneratorTest extends TestBase { - - private final String TEXT_PROPERTY_ID = "Text"; - private final String GEN_WIDGET_PROPERTY_ID = "Generated component"; - private final String WIDGET_PROPERTY_ID = "Component"; - private CheckBox componentDescription; - private CheckBox tableCellItemDescription; - private CheckBox tableRowItemDescription; - - @Override - protected void setup() { - final Table table = createTable(); - table.setId("table"); - componentDescription = new CheckBox("Tooltip on components"); - componentDescription.addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - table.setContainerDataSource(createContainer(componentDescription - .getValue())); - } - }); - componentDescription.setImmediate(true); - componentDescription.setValue(true); - tableCellItemDescription = new CheckBox("Tooltip on table cells"); - tableCellItemDescription - .addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - table.refreshRowCache(); - } - }); - tableCellItemDescription.setImmediate(true); - tableCellItemDescription.setValue(true); - - tableRowItemDescription = new CheckBox("Tooltip on table Rows"); - tableRowItemDescription - .addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - table.refreshRowCache(); - } - }); - tableRowItemDescription.setImmediate(true); - tableRowItemDescription.setValue(true); - - addComponent(componentDescription); - addComponent(tableCellItemDescription); - addComponent(tableRowItemDescription); - addComponent(table); - - table.setItemDescriptionGenerator(new ItemDescriptionGenerator() { - @Override - public String generateDescription(Component source, Object itemId, - Object propertyId) { - if (propertyId == null && tableRowItemDescription.getValue()) { - return "Row description " + itemId; - } else if (tableCellItemDescription.getValue()) { - return "Cell description " + itemId + "," + propertyId; - } - return null; - } - }); - - table.addGeneratedColumn(GEN_WIDGET_PROPERTY_ID, - new Table.ColumnGenerator() { - - @Override - public Component generateCell(Table source, Object itemId, - Object columnId) { - TextField lbl = new TextField(); - if (componentDescription.getValue()) { - lbl.setDescription("Textfield's own description"); - } - return lbl; - } - }); - - } - - protected Table createTable() { - return new Table(); - } - - @Override - protected String getDescription() { - return "Cells and rows should have tooltips"; - } - - @Override - protected Integer getTicketNumber() { - return 5414; - } - - 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); - item.getItemProperty(TEXT_PROPERTY_ID).setValue("Text " + i); - Button b = new Button("Button " + i); - if (description) { - 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/TableItemDescriptionGeneratorUI.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java new file mode 100644 index 0000000000..809e639448 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java @@ -0,0 +1,133 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Container; +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.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; + +public class TableItemDescriptionGeneratorUI extends AbstractTestUI { + + private final String TEXT_PROPERTY_ID = "Text"; + private final String GEN_WIDGET_PROPERTY_ID = "Generated component"; + private final String WIDGET_PROPERTY_ID = "Component"; + private CheckBox componentDescription; + private CheckBox tableCellItemDescription; + private CheckBox tableRowItemDescription; + + @Override + protected void setup(VaadinRequest request) { + final Table table = createTable(); + table.setId("table"); + componentDescription = new CheckBox("Tooltip on components"); + componentDescription.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.setContainerDataSource(createContainer(componentDescription + .getValue())); + } + }); + componentDescription.setImmediate(true); + componentDescription.setValue(true); + tableCellItemDescription = new CheckBox("Tooltip on table cells"); + tableCellItemDescription + .addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.refreshRowCache(); + } + }); + tableCellItemDescription.setImmediate(true); + tableCellItemDescription.setValue(true); + + tableRowItemDescription = new CheckBox("Tooltip on table Rows"); + tableRowItemDescription + .addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.refreshRowCache(); + } + }); + tableRowItemDescription.setImmediate(true); + tableRowItemDescription.setValue(true); + + addComponent(componentDescription); + addComponent(tableCellItemDescription); + addComponent(tableRowItemDescription); + addComponent(table); + + table.setItemDescriptionGenerator(new ItemDescriptionGenerator() { + @Override + public String generateDescription(Component source, Object itemId, + Object propertyId) { + if (propertyId == null && tableRowItemDescription.getValue()) { + return "Row description " + itemId; + } else if (tableCellItemDescription.getValue()) { + return "Cell description " + itemId + ", " + propertyId; + } + return null; + } + }); + + table.addGeneratedColumn(GEN_WIDGET_PROPERTY_ID, + new Table.ColumnGenerator() { + + @Override + public Component generateCell(Table source, Object itemId, + Object columnId) { + TextField lbl = new TextField(); + if (componentDescription.getValue()) { + lbl.setDescription("Textfield's own description"); + } + return lbl; + } + }); + + } + + protected Table createTable() { + return new Table(); + } + + @Override + protected String getTestDescription() { + return "Cells and rows should have tooltips"; + } + + @Override + protected Integer getTicketNumber() { + 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); + + for (int i = 0; i < 5; i++) { + Item item = container.addItem("item " + i); + item.getItemProperty(TEXT_PROPERTY_ID).setValue("Text " + i); + Button b = new Button("Button " + i); + if (description) { + b.setDescription("Button " + i + " description"); + } + item.getItemProperty(WIDGET_PROPERTY_ID).setValue(b); + } + + 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/TreeTableItemDescriptionGeneratorTest.java deleted file mode 100644 index 2864156b03..0000000000 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2012 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 com.vaadin.tests.components.table.TableItemDescriptionGeneratorTest; -import com.vaadin.ui.Table; -import com.vaadin.ui.TreeTable; - -public class TreeTableItemDescriptionGeneratorTest extends - TableItemDescriptionGeneratorTest { - @Override - protected Table createTable() { - return new TreeTable(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java new file mode 100644 index 0000000000..ba057f4c41 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012 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 com.vaadin.tests.components.table.TableItemDescriptionGeneratorUI; +import com.vaadin.ui.Table; +import com.vaadin.ui.TreeTable; + +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); + } + +} -- cgit v1.2.3