blob: 787d9e7f7f8fff460e530baf6669c46fa74b3d71 (
plain)
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
|
package com.vaadin.tests.components.splitpanel;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class GridLayoutWithCheckboxTest extends MultiBrowserTest {
private TextFieldElement tf;
private WebElement tfSlot;
private CheckBoxElement cb;
private WebElement cbSlot;
private Dimension tfSize;
private Dimension tfSlotSize;
private Dimension cbSize;
private Dimension cbSlotSize;
@Test
public void layoutShouldStayTheSame() {
openTestURL();
tf = $(TextFieldElement.class).first();
tfSlot = tf.findElement(By.xpath(".."));
cb = $(CheckBoxElement.class).first();
cbSlot = cb.findElement(By.xpath(".."));
// Doing anything with the textfield or checkbox should not affect
// layout
tf.setValue("a");
assertSizes();
cb.click();
assertSizes();
tf.setValue("b");
assertSizes();
cb.click();
assertSizes();
}
private void assertSizes() {
if (tfSize == null) {
tfSize = tf.getSize();
tfSlotSize = tfSlot.getSize();
cbSize = cb.getSize();
cbSlotSize = cbSlot.getSize();
} else {
assertEquals(tfSize, tf.getSize());
assertEquals(tfSlotSize, tfSlot.getSize());
assertEquals(cbSize, cb.getSize());
assertEquals(cbSlotSize, cbSlot.getSize());
}
}
}
|