aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutInfiniteLayoutPassesTest.java
blob: 247d3b140ada3ccf8bc995892cd3867a440c8718 (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
package com.vaadin.tests.components.orderedlayout;

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

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

public class OrderedLayoutInfiniteLayoutPassesTest extends MultiBrowserTest {

    @Override
    protected boolean requireWindowFocusForIE() {
        return true;
    }

    @Test
    public void ensureFiniteLayoutPhase() throws Exception {
        openTestURL("debug");
        zoomBrowserIn();
        try {
            $(ButtonElement.class).first().click();
            assertNoErrorNotifications();
            resetZoom();
            assertNoErrorNotifications();
        } finally {
            // Reopen test to ensure that modal window does not prevent zoom
            // reset from taking place
            openTestURL();
            resetZoom();
        }
    }

    private void zoomBrowserIn() {
        WebElement html = driver.findElement(By.tagName("html"));
        html.sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
    }

    private void resetZoom() {
        WebElement html = driver.findElement(By.tagName("html"));
        html.sendKeys(Keys.chord(Keys.CONTROL, "0"));
    }
}