aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/splitpanel/HorizontalSplitPanelHeightTest.java
blob: 5fb1845fb99abc6cd8afc269e968041554e6d194 (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
package com.vaadin.tests.components.splitpanel;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.tests.tb3.MultiBrowserTest;

/**
 * Test for horizontal split panel height in case when only second component is
 * set.
 *
 * @author Vaadin Ltd
 */
public class HorizontalSplitPanelHeightTest extends MultiBrowserTest {

    @Override
    public void setup() throws Exception {
        super.setup();

        openTestURL();
    }

    @Test
    public void testHorizontalWithoutFirstComponent() {
        testSplitPanel("Horizontal 1");
    }

    @Test
    public void testHorizontalWithFirstComponent() {
        testSplitPanel("Horizontal 2");
    }

    @Test
    public void testHorizontalWithFixedHeight() {
        testSplitPanel("Horizontal 3");
    }

    @Test
    public void testVerticalWithoutFirstComponent() {
        testSplitPanel("Vertical 1");
    }

    private void testSplitPanel(String id) {
        WebElement splitPanel = findElement(By.id(id));
        WebElement label = splitPanel.findElement(By.className("target"));
        assertTrue(
                id + ": split panel height (" + splitPanel.getSize().getHeight()
                        + ") is less than " + "height of second component ("
                        + label.getSize().getHeight() + ")",
                splitPanel.getSize().getHeight() >= label.getSize()
                        .getHeight());
        assertEquals("Label text in the second panel is not visible", "Label",
                label.getText());
    }
}