summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2014-08-04 11:34:11 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-05 07:56:27 +0000
commit103d6c856a916de642b49a377f668926a61ed837 (patch)
tree68f5da2691a63fbaf6254f5e27d0795ddfb95439
parent4466651d75bbec5339d5a5e45ed093db8d60ae84 (diff)
downloadvaadin-framework-103d6c856a916de642b49a377f668926a61ed837.tar.gz
vaadin-framework-103d6c856a916de642b49a377f668926a61ed837.zip
TreeTableOutOfSync test upgrade (#14292)
Change-Id: Idf9b509c63290fca75cb67aeaa8ec981c8fa5b71
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html37
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java61
3 files changed, 69 insertions, 43 deletions
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html
deleted file mode 100644
index b8d6cdb22e..0000000000
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html
+++ /dev/null
@@ -1,37 +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>TreeTableOutOfSync</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TreeTableOutOfSync</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.treetable.TreeTableOutOfSync?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableOutOfSync::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>10,7</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableOutOfSync::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>verifyTextNotPresent</td>
- <td>Something has caused us to be out of sync with the server.<br />Take note of any unsaved data, and click here to re-sync.</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
index 7f4aa7f671..b8a0ac61c2 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
@@ -15,16 +15,18 @@
*/
package com.vaadin.tests.components.treetable;
-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.Notification;
import com.vaadin.ui.Table;
import com.vaadin.ui.TreeTable;
-public class TreeTableOutOfSync extends TestBase {
+public class TreeTableOutOfSync extends AbstractTestUI {
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
TreeTable tt = new TreeTable();
tt.addContainerProperty("i", Integer.class, null);
tt.addGeneratedColumn("text", new Table.ColumnGenerator() {
@@ -35,10 +37,10 @@ public class TreeTableOutOfSync extends TestBase {
Button button = new Button("text "
+ source.getContainerDataSource().getItem(itemId)
.getItemProperty("i").getValue());
- button.addListener(new Button.ClickListener() {
+ button.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- getMainWindow().showNotification("click");
+ Notification.show("click");
}
});
return button;
@@ -56,7 +58,7 @@ public class TreeTableOutOfSync extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "When a root node is expanded, components created by a column generator go out of sync";
}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java
new file mode 100644
index 0000000000..0831232df7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.treetable;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that opening the root node and clicking a generated component doesn't
+ * cause out of sync (or any other system notifications).
+ *
+ * @author Vaadin Ltd
+ */
+public class TreeTableOutOfSyncTest extends MultiBrowserTest {
+
+ @Test
+ public void testNotification() throws InterruptedException {
+ openTestURL();
+
+ TreeTableElement treeTable = $(TreeTableElement.class).first();
+ List<WebElement> rows = treeTable.findElement(
+ By.className("v-table-body")).findElements(By.tagName("tr"));
+
+ WebElement treeSpacer = rows.get(0).findElement(
+ By.className("v-treetable-treespacer"));
+ treeSpacer.click();
+
+ sleep(100);
+
+ rows = treeTable.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ WebElement button = rows.get(2).findElement(By.className("v-button"));
+ button.click();
+
+ List<WebElement> notifications = findElements(By
+ .className("v-Notification-system"));
+ assertTrue(notifications.isEmpty());
+ }
+
+}