aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/layout/EmptySpaceOnPageAfterExpandedComponentTest.java
blob: 0cff2f36a3dec37fbf8526e558d6692120b206ec (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
package com.vaadin.tests.components.layout;

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

import com.vaadin.tests.tb3.MultiBrowserTest;

/**
 * Test to make sure that there is no any empty space (in Google Chrome) on page
 * after expanded component (#12672)
 *
 * Layout:
 *
 * [ Panel (auto x auto) [ Grid (auto x auto) ]
 *
 * AnyComponent (100% x 100%)
 *
 * <HERE SHOULD NOT BE ANY EMPTY SPACE> ]
 *
 * @author Vaadin Ltd
 */
public class EmptySpaceOnPageAfterExpandedComponentTest
        extends MultiBrowserTest {

    @Test
    public void testNoEmptySpaceOnPageAfterExpandedComponent() {
        openTestURL();

        final WebElement expandedElement = vaadinElementById("expandedElement");
        final WebElement containerElement = vaadinElementById("container");

        waitUntil(input -> {
            int expandedElementBottom = expandedElement.getLocation().getY()
                    + expandedElement.getSize().getHeight();
            int containerElementBottom = containerElement.getLocation().getY()
                    + containerElement.getSize().getHeight();

            return expandedElementBottom + 1 == containerElementBottom;
        });
    }
}