]> source.dussan.org Git - vaadin-framework.git/commitdiff
TextFieldValueGoesMissing test rewrite to TB3
authorHeikki Ohinmaa <heikki@vaadin.com>
Wed, 6 Aug 2014 11:00:08 +0000 (14:00 +0300)
committerLeif Åstrand <leif@vaadin.com>
Sat, 30 Aug 2014 10:37:57 +0000 (13:37 +0300)
Change-Id: Icd665baa9a9fd40b913a462ae0563ac3dcb368da

uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html [deleted file]
uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java
uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html
deleted file mode 100644 (file)
index caaa15f..0000000
+++ /dev/null
@@ -1,47 +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>TextFieldValueGoesMissing</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TextFieldValueGoesMissing</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>73,10</td>
-</tr>
-<tr>
-       <td>enterCharacter</td>
-       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>test</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>contextmenu</td>
-       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>assertValue</td>
-       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>test</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
index 9ffad7f1e4c3362d5476f4e230dcf70474e024d1..89c905036109aa841cf8454e0330d01bb3c14e49 100644 (file)
@@ -1,6 +1,7 @@
 package com.vaadin.tests.components.table;
 
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
@@ -8,17 +9,18 @@ import com.vaadin.ui.Table;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.VerticalLayout;
 
-public class TextFieldValueGoesMissing extends TestBase {
+public class TextFieldValueGoesMissing extends AbstractTestUI {
 
+    @SuppressWarnings("unchecked")
     @Override
-    protected void setup() {
+    protected void setup(VaadinRequest request) {
         final VerticalLayout verticalLayout = new VerticalLayout();
 
         final Label label1 = new Label("1");
         final Label label2 = new Label("2");
 
         Button button = new Button("Replace label");
-        button.addListener(new Button.ClickListener() {
+        button.addClickListener(new Button.ClickListener() {
 
             @Override
             public void buttonClick(ClickEvent event) {
@@ -45,7 +47,7 @@ public class TextFieldValueGoesMissing extends TestBase {
     }
 
     @Override
-    protected String getDescription() {
+    protected String getTestDescription() {
         return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java
new file mode 100644 (file)
index 0000000..3336baf
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.components.table;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that a text field's value isn't cleared after a label in the same
+ * layout is changed.
+ * 
+ * @since 7.3
+ * @author Vaadin Ltd
+ */
+public class TextFieldValueGoesMissingTest extends MultiBrowserTest {
+
+    /* This test was rewritten from a TB2 test. */
+    @Test
+    public void valueMissingTest() throws Exception {
+        openTestURL();
+
+        Thread.sleep(2000);
+        // No waitForElementVisible in 7.2
+        // waitForElementVisible(By.className("v-textfield"));
+
+        TextFieldElement textfield = $(TextFieldElement.class).first();
+        textfield.focus();
+        textfield.sendKeys("test");
+
+        $(ButtonElement.class).first().click();
+
+        new Actions(getDriver()).contextClick(textfield).perform();
+
+        Assert.assertEquals("test", textfield.getValue());
+    }
+}