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

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;

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

public class CloseWindowAsyncTest extends MultiBrowserTest {

    @Test
    public void testOpeningAndClosing() throws Exception {
        openTestURL();
        List<ButtonElement> buttons = $(ButtonElement.class).all();
        int index = 1;
        for (ButtonElement button : buttons) {
            button.click();
            List<NotificationElement> notifications = $(
                    NotificationElement.class).all();
            if (!notifications.isEmpty()) {
                notifications.get(0).close();
            }
            assertEquals("Unexpected log contents,",
                    index + ". closed " + index, getLogRow(0));
            ++index;
        }
    }
}