aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/themes/valo/WindowControlButtonFocusTest.java
blob: fb095c07b49bf2b608beeb35979b94707feb1981 (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
package com.vaadin.tests.themes.valo;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

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

import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class WindowControlButtonFocusTest extends MultiBrowserTest {

    @Override
    public List<DesiredCapabilities> getBrowsersToTest() {
        return Arrays.asList(Browser.CHROME.getDesiredCapabilities(),
                Browser.IE11.getDesiredCapabilities());
    }

    @Test
    public void focusMaximize() throws IOException, InterruptedException {
        openTestURL();

        WebElement window = $(WindowElement.class).first();
        WebElement maximize = window
                .findElement(By.className("v-window-maximizebox"));

        executeScript("arguments[0].focus()", maximize);
        compareScreen(window, "maximize-focused");
    }

    @Test
    public void focusClose() throws IOException {
        openTestURL();

        WebElement window = $(WindowElement.class).first();
        WebElement close = window
                .findElement(By.className("v-window-closebox"));

        executeScript("arguments[0].focus()", close);
        compareScreen(window, "close-focused");
    }

}