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

import org.junit.Assert;
import org.junit.Test;

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

public class ExtraWindowShownTest extends MultiBrowserTest {

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

        openWindow();
        closeWindow();
        assertNoWindow();

        openWindow();
        closeWindow();
        assertNoWindow();
    }

    private void openWindow() {
        $(ButtonElement.class).first().click();
    }

    private void closeWindow() {
        $(WindowElement.class).$(ButtonElement.class).first().click();
    }

    private void assertNoWindow() {
        Assert.assertFalse("Window found when there should be none.",
                $(WindowElement.class).exists());
    }
}