blob: 93ac72fa4d6a5048335b50af8b7756b9718e68f8 (
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
|
package com.vaadin.tests.elements.notification;
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;
import static org.junit.Assert.assertTrue;
public class NotificationCloseTest extends MultiBrowserTest {
@Override
protected Class<?> getUIClass() {
return NotificationGetTypeAndDescription.class;
}
@Test
public void testWarning() {
testClose(0);
}
@Test
public void testError() {
testClose(1);
}
@Test
public void testHumanized() {
testClose(2);
}
@Test
public void testTrayNotification() {
testClose(3);
}
private void testClose(int index) {
openTestURL();
String id = "button" + index;
ButtonElement btn = $(ButtonElement.class).id(id);
// show notification
btn.click();
sleep(100);
$(NotificationElement.class).get(0).close();
List<NotificationElement> notifications = $(NotificationElement.class)
.all();
// check that all notifications are closed
assertTrue("There are open notifications", notifications.isEmpty());
}
}
|