summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rwxr-xr-xuitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__initial-date.pngbin13511 -> 0 bytes
-rwxr-xr-xuitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readonly-date.pngbin13679 -> 0 bytes
-rwxr-xr-xuitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readwrite-popup-date.pngbin27799 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__initial-date.pngbin12180 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readonly-date.pngbin12333 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readwrite-popup-date.pngbin26387 -> 0 bytes
-rwxr-xr-xuitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_initial-date.pngbin10270 -> 0 bytes
-rwxr-xr-xuitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readonly-date.pngbin10423 -> 0 bytes
-rwxr-xr-xuitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readwrite-popup-date.pngbin20178 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_initial-date.pngbin11216 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readonly-date.pngbin11216 -> 0 bytes
-rw-r--r--uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readwrite-popup-date.pngbin22745 -> 0 bytes
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldReadOnlyTest.java61
13 files changed, 45 insertions, 16 deletions
diff --git a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__initial-date.png b/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__initial-date.png
deleted file mode 100755
index 9b173021f9..0000000000
--- a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__initial-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readonly-date.png b/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readonly-date.png
deleted file mode 100755
index d815c3ba2c..0000000000
--- a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readonly-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readwrite-popup-date.png b/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readwrite-popup-date.png
deleted file mode 100755
index 2b3c5e7474..0000000000
--- a/uitest/reference-screenshots/chrome/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Chrome__readwrite-popup-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__initial-date.png b/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__initial-date.png
deleted file mode 100644
index 575cebb5ab..0000000000
--- a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__initial-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readonly-date.png b/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readonly-date.png
deleted file mode 100644
index 78e41f0c94..0000000000
--- a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readonly-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readwrite-popup-date.png b/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readwrite-popup-date.png
deleted file mode 100644
index 8c43c5b11a..0000000000
--- a/uitest/reference-screenshots/firefox/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_ANY_Firefox__readwrite-popup-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_initial-date.png b/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_initial-date.png
deleted file mode 100755
index 50b5d4a242..0000000000
--- a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_initial-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readonly-date.png b/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readonly-date.png
deleted file mode 100755
index 0c5e3be974..0000000000
--- a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readonly-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readwrite-popup-date.png b/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readwrite-popup-date.png
deleted file mode 100755
index 4d7c5191cf..0000000000
--- a/uitest/reference-screenshots/internetexplorer/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_Windows_InternetExplorer_11_readwrite-popup-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_initial-date.png b/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_initial-date.png
deleted file mode 100644
index 29cc972d51..0000000000
--- a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_initial-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readonly-date.png b/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readonly-date.png
deleted file mode 100644
index 29cc972d51..0000000000
--- a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readonly-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readwrite-popup-date.png b/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readwrite-popup-date.png
deleted file mode 100644
index c51903b9e1..0000000000
--- a/uitest/reference-screenshots/phantomjs/DateTimeFieldReadOnlyTest-readOnlyDateFieldPopupShouldNotOpen_LINUX_PhantomJS_1_readwrite-popup-date.png
+++ /dev/null
Binary files differ
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldReadOnlyTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldReadOnlyTest.java
index 668c0a6123..37e5694930 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldReadOnlyTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldReadOnlyTest.java
@@ -1,13 +1,18 @@
package com.vaadin.tests.components.datefield;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.junit.Test;
-import org.openqa.selenium.Keys;
+import org.openqa.selenium.ElementNotInteractableException;
+import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.AbstractDateFieldElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.DateTimeFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class DateTimeFieldReadOnlyTest extends MultiBrowserTest {
@@ -17,27 +22,51 @@ public class DateTimeFieldReadOnlyTest extends MultiBrowserTest {
throws IOException, InterruptedException {
openTestURL();
- compareScreen("initial-date");
+ DateTimeFieldElement df = $(DateTimeFieldElement.class).first();
+ WebElement dfButton = df
+ .findElement(By.className("v-datefield-button"));
+
+ // ensure initial read-only state works and pop-up cannot be opened
+ assertTrue(df.hasClassName("v-readonly"));
+ assertEquals("none", dfButton.getCssValue("display"));
+ assertTrue(findElements(By.className("v-datefield-calendarpanel"))
+ .isEmpty());
+
+ assertFalse(openPopup(df));
+ assertTrue(findElements(By.className("v-datefield-calendarpanel"))
+ .isEmpty());
+
+ // ensure read-only state can be removed and the component is still
+ // functional
toggleReadOnly();
+ assertFalse(df.hasClassName("v-readonly"));
+ assertEquals("inline-block", dfButton.getCssValue("display"));
- openPopup();
- compareScreen("readwrite-popup-date");
+ assertTrue(openPopup(df));
+ assertEquals(1,
+ findElements(By.className("v-datefield-calendarpanel")).size());
- closePopup();
+ // ensure read-only state can be re-applied, pop-up is closed and cannot
+ // be re-opened
toggleReadOnly();
- compareScreen("readonly-date");
- }
+ assertTrue(df.hasClassName("v-readonly"));
+ assertEquals("none", dfButton.getCssValue("display"));
+ assertTrue(findElements(By.className("v-datefield-calendarpanel"))
+ .isEmpty());
- private void closePopup() {
- findElement(By.className("v-datefield-calendarpanel"))
- .sendKeys(Keys.RETURN);
+ assertFalse(openPopup(df));
+ assertTrue(findElements(By.className("v-datefield-calendarpanel"))
+ .isEmpty());
}
- private void openPopup() {
- // waiting for openPopup() in TB4 beta1:
- // http://dev.vaadin.com/ticket/13766
- $(AbstractDateFieldElement.class).first()
- .findElement(By.tagName("button")).click();
+ private boolean openPopup(DateTimeFieldElement df) {
+ // ensure the hidden button cannot be interacted with
+ try {
+ df.openPopup();
+ return true;
+ } catch (ElementNotInteractableException e) {
+ return false;
+ }
}
private void toggleReadOnly() {