diff options
author | Artur Signell <artur@vaadin.com> | 2013-10-23 00:51:44 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-10-23 12:05:20 +0000 |
commit | c464dcf9217ac6763e4bf7aec18fbf13dff29308 (patch) | |
tree | c597984787b7160718988fb083ea2c2f9b6b584a /uitest/src/com | |
parent | 51a46a038fe0353f4babfd8218153eb68e2602ca (diff) | |
download | vaadin-framework-c464dcf9217ac6763e4bf7aec18fbf13dff29308.tar.gz vaadin-framework-c464dcf9217ac6763e4bf7aec18fbf13dff29308.zip |
Convert push test to TB3 so it has a chance to pass
Change-Id: I6381ea4bd61b3df19599f2f9d3a303a50c810460
Diffstat (limited to 'uitest/src/com')
3 files changed, 49 insertions, 41 deletions
diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandling.html b/uitest/src/com/vaadin/tests/push/PushErrorHandling.html deleted file mode 100644 index afd3e70771..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushErrorHandling.html +++ /dev/null @@ -1,41 +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>PushErrorHandling</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">PushErrorHandling</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/PushErrorHandling?restartApplication</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runPushErrorHandling::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runPushErrorHandling::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]</td> - <td>An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runPushErrorHandling::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>26,7</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runPushErrorHandling::Root/VNotification[0]/HTML[0]/domChild[0]</td> - <td>Internal error</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandling.java b/uitest/src/com/vaadin/tests/push/PushErrorHandling.java index 3074bd3851..a1182c0daf 100644 --- a/uitest/src/com/vaadin/tests/push/PushErrorHandling.java +++ b/uitest/src/com/vaadin/tests/push/PushErrorHandling.java @@ -42,9 +42,11 @@ public class PushErrorHandling extends AbstractTestUI { ((String) null).length(); // Null-pointer exception } }); + button.setId("npeButton"); addComponent(button); final Table view = new Table("testtable"); + view.setId("testtable"); view.setSelectable(true); view.setMultiSelect(false); view.setImmediate(true); diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java b/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java new file mode 100644 index 0000000000..a4b94b0573 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2013 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.push; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class PushErrorHandlingTest extends MultiBrowserTest { + + @Test + public void testErrorHandling() { + setPush(true); + openTestURL(); + vaadinElementById("npeButton").click(); + Assert.assertEquals( + "An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc", + vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]") + .getText()); + + WebElement table = vaadinElementById("testtable"); + WebElement row = table.findElement(By + .xpath("//div[text()='Click for NPE']")); + row.click(); + + Assert.assertEquals("Internal error", + vaadinElement("Root/VNotification[0]/HTML[0]/domChild[0]") + .getText()); + } +} |