blob: 87621c6db731231074b3fd6fb36e1b79a370aee1 (
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
|
package com.vaadin.tests.components.datefield;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.DateFieldElement;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import static org.junit.Assert.assertEquals;
public class DateTextHandlingTest extends SingleBrowserTest {
public static final String Y2K_GB_LOCALE = "01-Jan-2000";
@Test
public void testSpecialValue() throws InterruptedException {
openTestURL();
DateFieldElement dateFieldElement = $(DateFieldElement.class).first();
ButtonElement validate = $(ButtonElement.class).first();
WebElement dateTextbox = dateFieldElement.getInputElement();
dateTextbox.sendKeys("Y2K", Keys.TAB);
validate.click();
assertNotification("Y2K Should be converted to " + Y2K_GB_LOCALE,
Y2K_GB_LOCALE);
dateTextbox.clear();
validate.click();
assertNotification("Null for empty string", "NULL");
}
protected void assertNotification(String message, String expected) {
NotificationElement notification = $(NotificationElement.class).first();
assertEquals(message, expected, notification.getCaption());
notification.close();
}
}
|