2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.components.treetable;
18 import static org.junit.Assert.assertEquals;
20 import java.util.List;
22 import org.junit.Test;
24 import com.vaadin.testbench.By;
25 import com.vaadin.testbench.TestBenchElement;
26 import com.vaadin.testbench.elements.CheckBoxElement;
27 import com.vaadin.tests.tb3.TooltipTest;
28 import com.vaadin.v7.testbench.customelements.TreeTableElement;
31 * Tests TreeTable tooltips with various settings.
35 public class TreeTableItemDescriptionGeneratorUITest extends TooltipTest {
38 public void testDescriptions() throws Exception {
41 checkTooltipNotPresent();
43 TreeTableElement treeTable = $(TreeTableElement.class).first();
44 List<CheckBoxElement> checkboxes = $(CheckBoxElement.class).all();
45 assertEquals(3, checkboxes.size());
47 // check text description
48 TestBenchElement cell_1_0 = treeTable.getCell(1, 0);
49 checkTooltip(cell_1_0, "Cell description item 1, Text");
51 // move somewhere without a description
52 checkTooltip(checkboxes.get(2), null);
54 // check button description
55 TestBenchElement cell_1_1 = treeTable.getCell(1, 1);
56 checkTooltip(cell_1_1, "Button 1 description");
58 // move somewhere without a description
59 checkTooltip(checkboxes.get(2), null);
61 // check textfield's description
62 TestBenchElement cell_1_2 = treeTable.getCell(1, 2);
63 checkTooltip(cell_1_2, "Textfield's own description");
65 // move somewhere without a description
66 checkTooltip(checkboxes.get(2), null);
68 // uncheck component tooltips
69 checkboxes.get(0).findElement(By.tagName("input")).click();
71 // check text description
72 cell_1_0 = treeTable.getCell(1, 0);
73 checkTooltip(cell_1_0, "Cell description item 1, Text");
75 // move somewhere without a description
76 checkTooltip(checkboxes.get(2), null);
78 // check button description
79 cell_1_1 = treeTable.getCell(1, 1);
80 checkTooltip(cell_1_1, "Cell description item 1, Component");
82 // move somewhere without a description
83 checkTooltip(checkboxes.get(2), null);
85 // check textfield's description
86 cell_1_2 = treeTable.getCell(1, 2);
87 checkTooltip(cell_1_2, "Cell description item 1, Generated component");
89 // move somewhere without a description
90 checkTooltip(checkboxes.get(2), null);
92 // check component tooltips
93 checkboxes.get(0).findElement(By.tagName("input")).click();
94 // uncheck cell tooltips
95 checkboxes.get(1).findElement(By.tagName("input")).click();
97 // check text description
98 cell_1_0 = treeTable.getCell(1, 0);
99 checkTooltip(cell_1_0, "Row description item 1");
101 // move somewhere without a description
102 checkTooltip(checkboxes.get(2), null);
104 // check button description
105 cell_1_1 = treeTable.getCell(1, 1);
106 checkTooltip(cell_1_1, "Button 1 description");
108 // move somewhere without a description
109 checkTooltip(checkboxes.get(2), null);
111 // check textfield's description
112 cell_1_2 = treeTable.getCell(1, 2);
113 checkTooltip(cell_1_2, "Textfield's own description");
115 // move somewhere without a description
116 checkTooltip(checkboxes.get(2), null);
118 // uncheck component tooltips
119 checkboxes.get(0).findElement(By.tagName("input")).click();
121 // check text description
122 cell_1_0 = treeTable.getCell(1, 0);
123 checkTooltip(cell_1_0, "Row description item 1");
125 // move somewhere without a description
126 checkTooltip(checkboxes.get(2), null);
128 // check button description
129 cell_1_1 = treeTable.getCell(1, 1);
130 checkTooltip(cell_1_1, "Row description item 1");
132 // move somewhere without a description
133 checkTooltip(checkboxes.get(2), null);
135 // check textfield's description
136 cell_1_2 = treeTable.getCell(1, 2);
137 checkTooltip(cell_1_2, "Row description item 1");
139 // move somewhere without a description
140 checkTooltip(checkboxes.get(2), null);