aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
blob: 1e5c92d16aea6c02bddf10229b75ffefc35debae (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
package com.vaadin.tests.components.window;

import static org.junit.Assert.assertEquals;

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

import com.vaadin.testbench.By;
import com.vaadin.testbench.commands.TestBenchElementCommands;
import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class ScrollingBodyElementWithModalOpenedTest extends MultiBrowserTest {

    @Test
    public void testWindowScrollbars() throws Exception {
        openTestURL();

        WebElement bodyElement = driver
                .findElement(By.className("v-modal-window-open"));

        Point initial = $(WindowElement.class).first().getLocation();

        TestBenchElementCommands scrollable = testBenchElement(bodyElement);
        scrollable.scroll(1000);

        Thread.sleep(1000);

        Point current = $(WindowElement.class).first().getLocation();

        assertEquals("Window moved along X-axis", initial.getX(),
                current.getX());
        assertEquals("Window moved along Y-axis", initial.getY(),
                current.getY());

        assertEquals("Body was scrolled", 0, getScrollTop(bodyElement));
    }

}