1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
package com.vaadin.tests.components.table;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.TableElement;
import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
/**
* Tests Table Header ClickListener
*
* @author Vaadin Ltd
*/
public class HeaderClickTest extends MultiBrowserTest {
@Test
public void testFooter() throws IOException {
openTestURL();
TableElement table = $(TableElement.class).first();
TestBenchElement header0 = table.getHeaderCell(0);
header0.click();
TextFieldElement tf = $(TextFieldElement.class).first();
assertEquals("col1", tf.getValue());
table = $(TableElement.class).first();
TestBenchElement header1 = table.getHeaderCell(1);
header1.click();
tf = $(TextFieldElement.class).first();
assertEquals("col2", tf.getValue());
table = $(TableElement.class).first();
TestBenchElement header2 = table.getHeaderCell(2);
header2.click();
tf = $(TextFieldElement.class).first();
assertEquals("col3", tf.getValue());
CheckBoxElement cb = $(CheckBoxElement.class).first();
cb.click();
table = $(TableElement.class).first();
header0 = table.getHeaderCell(0);
header0.click();
tf = $(TextFieldElement.class).first();
assertEquals("col1", tf.getValue());
table = $(TableElement.class).first();
header1 = table.getHeaderCell(1);
header1.click();
tf = $(TextFieldElement.class).first();
assertEquals("col2", tf.getValue());
table = $(TableElement.class).first();
header2 = table.getHeaderCell(2);
header2.click();
tf = $(TextFieldElement.class).first();
assertEquals("col3", tf.getValue());
cb = $(CheckBoxElement.class).get(1);
cb.click();
table = $(TableElement.class).first();
header0 = table.getHeaderCell(0);
header0.click();
tf = $(TextFieldElement.class).first();
assertEquals("col1", tf.getValue());
table = $(TableElement.class).first();
header1 = table.getHeaderCell(1);
header1.click();
tf = $(TextFieldElement.class).first();
assertEquals("col2", tf.getValue());
table = $(TableElement.class).first();
header2 = table.getHeaderCell(2);
header2.click();
tf = $(TextFieldElement.class).first();
assertEquals("col3", tf.getValue());
cb = $(CheckBoxElement.class).get(2);
cb.click();
table = $(TableElement.class).first();
header0 = table.getHeaderCell(0);
header0.click();
tf = $(TextFieldElement.class).first();
assertEquals("col1", tf.getValue());
table = $(TableElement.class).first();
header1 = table.getHeaderCell(1);
header1.click();
tf = $(TextFieldElement.class).first();
assertEquals("col2", tf.getValue());
table = $(TableElement.class).first();
header2 = table.getHeaderCell(2);
header2.click();
tf = $(TextFieldElement.class).first();
assertEquals("col3", tf.getValue());
cb = $(CheckBoxElement.class).get(2);
cb.click();
tf = $(TextFieldElement.class).first();
assertEquals("col3", tf.getValue());
}
}
|