aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/panel/PanelSetScrollTopWithLargeNumberTest.java
blob: 5400207f78ea36ac3e57747624c68567c9ca77f3 (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
package com.vaadin.tests.components.panel;

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

import com.vaadin.testbench.elements.PanelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class PanelSetScrollTopWithLargeNumberTest extends MultiBrowserTest {
    private PanelElement panel;

    @Override
    public void setup() throws Exception {
        super.setup();
        openTestURL();
        waitForElementPresent(By.className("v-panel"));
        panel = $(PanelElement.class).first();
    }

    @Test
    public void testSetScrollTopWithLargeNumber() {
        WebElement contentNode = panel
                .findElement(By.className("v-panel-content"));
        int panelContentScrollTop = ((Number) executeScript(
                "return arguments[0].scrollTop", contentNode)).intValue();
        assertGreater(
                "Panel should scroll when scrollTop is set to a number larger than panel height",
                panelContentScrollTop, 0);
    }

}