]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convert DateFieldReadOnlyTest TB2 -> TB4.
authorSauli Tähkäpää <sauli@vaadin.com>
Mon, 26 May 2014 13:06:06 +0000 (16:06 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 27 May 2014 07:31:44 +0000 (07:31 +0000)
Change-Id: Iab81b1e5992d47c956f9d0440ece98fa546ee927

uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html [deleted file]
uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html
deleted file mode 100644 (file)
index ee19b52..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java
new file mode 100644 (file)
index 0000000..96e1734
--- /dev/null
@@ -0,0 +1,43 @@
+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();
+    }
+}