+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:8888/" />
-<title>DateFieldReadOnly</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">DateFieldReadOnly</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.datefield.DateFieldReadOnly?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>focus</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>readonly</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>focus</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VTime[0]/ListBox[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>readwrite-popup</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>focus</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>readonly</td>
-</tr>
-</tbody></table>
-</body>
-</html>
--- /dev/null
+package com.vaadin.tests.components.datefield;
+
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.DateFieldElement;
+import com.vaadin.tests.tb3.AbstractTB3Test;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+
+import java.io.IOException;
+
+public class DateFieldReadOnlyTest extends MultiBrowserTest {
+
+ @Test
+ public void readOnlyDateFieldPopupShouldNotOpen() throws IOException, InterruptedException {
+ openTestURL();
+
+ compareScreen("readonly");
+ toggleReadOnly();
+
+ openPopup();
+ compareScreen("readwrite-popup");
+
+ closePopup();
+ toggleReadOnly();
+ compareScreen("readonly");
+ }
+
+ private void closePopup() {
+ findElement(By.className("v-datefield-calendarpanel")).sendKeys(Keys.RETURN);
+ }
+
+ private void openPopup() {
+ //waiting for openPopup() in TB4 beta1: http://dev.vaadin.com/ticket/13766
+ $(DateFieldElement.class).first().findElement(By.tagName("button")).click();
+ }
+
+ private void toggleReadOnly() {
+ $(ButtonElement.class).caption("Switch read-only").first().click();
+ }
+}