summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitrii Rogozin <dmitrii@vaadin.com>2014-06-18 11:37:54 +0300
committerVaadin Code Review <review@vaadin.com>2014-06-26 07:24:41 +0000
commit0ff4e15b96b91becdd6c8e38ad20d8272c5455b7 (patch)
tree3be857fb13bd25b11c9b5d26645936d85a29305b
parent087bf4215b76107d0b4e4c70e678ad7201270b12 (diff)
downloadvaadin-framework-0ff4e15b96b91becdd6c8e38ad20d8272c5455b7.tar.gz
vaadin-framework-0ff4e15b96b91becdd6c8e38ad20d8272c5455b7.zip
Fix problem with IntegerValidator test (#14046)
Change-Id: Iaff310ccd2f25ca2d9a4a1043403a3aa1bde2e1a
-rw-r--r--uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html95
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java62
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java46
3 files changed, 108 insertions, 95 deletions
diff --git a/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html b/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
deleted file mode 100644
index 48d48ede80..0000000000
--- a/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
+++ /dev/null
@@ -1,95 +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="" />
-<title>IntegerRangeValidator</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">IntegerRangeValidator</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.fieldgroup.BasicPersonForm?restartApplication</td>
- <td></td>
-</tr>
-<!--64123 -> age-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>64,20</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>64123</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]</td>
- <td>Must be between 0 and 150, 64123 is not</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]</td>
- <td></td>
-</tr>
-<!--10 -> age-->
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>10</td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<!---1-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>69,11</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>-1</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]</td>
- <td>Must be between 0 and 150, -1 is not</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java
new file mode 100644
index 0000000000..20dc514c10
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.tooltip;
+
+import com.vaadin.data.validator.IntegerRangeValidator;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.TextField;
+
+/**
+ *
+ * UI test class for Tooltip with integer range validator.
+ */
+public class ValidatorCaptionTooltip extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TextField fieldWithError = new TextField();
+ int min = 0;
+ int max = 100;
+ String errorMessage = "Valid value is between " + min + " and " + max
+ + ". {0} is not.";
+ IntegerRangeValidator validator = new IntegerRangeValidator(
+ errorMessage, min, max);
+ fieldWithError.setValue("142");
+
+ fieldWithError.addValidator(validator);
+ fieldWithError.setConverter(Integer.class);
+ fieldWithError.setImmediate(true);
+
+ TextField fieldWithoutError = new TextField();
+ fieldWithoutError.addValidator(validator);
+ fieldWithoutError.setConverter(Integer.class);
+ fieldWithoutError.setValue("42");
+ addComponent(fieldWithError);
+ addComponent(fieldWithoutError);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Valid value is from 0 to 100.When the value is not valid. An error tooltip should appear";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14046;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java
new file mode 100644
index 0000000000..9603b1df36
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.tooltip;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Test to see if validators create error tooltips correctly.
+ *
+ * @author Vaadin Ltd
+ */
+public class ValidatorCaptionTooltipTest extends TooltipTest {
+ @Test
+ public void validatorWithError() throws Exception {
+ openTestURL();
+
+ TextFieldElement field = $(TextFieldElement.class).get(0);
+ String fieldValue = field.getAttribute("value");
+ String expected = "Valid value is between 0 and 100. " + fieldValue
+ + " is not.";
+ checkTooltip(field, expected);
+ }
+
+ @Test
+ public void validatorWithoutError() throws Exception {
+ openTestURL();
+ TextFieldElement field = $(TextFieldElement.class).get(1);
+ checkTooltip(field, null);
+ }
+}