aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/elements/window/WindowButtonsTest.java
blob: 6130d0130388179cb125230c1191e9143721903a (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
49
50
51
52
53
54
55
56
package com.vaadin.tests.elements.window;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Dimension;

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

public class WindowButtonsTest extends MultiBrowserTest {

    private WindowElement windowElement;

    @Override
    protected Class<?> getUIClass() {
        return WindowUI.class;
    }

    @Before
    public void init() {
        openTestURL();
        windowElement = $(WindowElement.class).first();
    }

    @Test
    public void window_clickCloseButton_windowClosed() {
        windowElement.close();

        assertFalse($(WindowElement.class).exists());
    }

    @Test
    public void window_maximizeAndRestore_windowOriginalSize()
            throws IOException, InterruptedException {
        assertFalse(windowElement.isMaximized());
        final Dimension originalSize = windowElement.getSize();

        windowElement.maximize();

        assertTrue(windowElement.isMaximized());
        assertNotEquals(originalSize, windowElement.getSize());

        windowElement.restore();

        assertFalse(windowElement.isMaximized());
        assertEquals(originalSize, windowElement.getSize());
    }

}