From c464dcf9217ac6763e4bf7aec18fbf13dff29308 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 23 Oct 2013 00:51:44 +0300 Subject: [PATCH] Convert push test to TB3 so it has a chance to pass Change-Id: I6381ea4bd61b3df19599f2f9d3a303a50c810460 --- .../vaadin/tests/push/PushErrorHandling.html | 41 ---------------- .../vaadin/tests/push/PushErrorHandling.java | 2 + .../tests/push/PushErrorHandlingTest.java | 47 +++++++++++++++++++ 3 files changed, 49 insertions(+), 41 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/push/PushErrorHandling.html create mode 100644 uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java 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 @@ - - - - - - -PushErrorHandling - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PushErrorHandling
open/run/PushErrorHandling?restartApplication
clickvaadin=runPushErrorHandling::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runPushErrorHandling::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
mouseClickvaadin=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]26,7
assertTextvaadin=runPushErrorHandling::Root/VNotification[0]/HTML[0]/domChild[0]Internal error
- - 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()); + } +} -- 2.39.5