Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PushErrorHandlingTest.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.push;
  17. import org.junit.Assert;
  18. import org.junit.Test;
  19. import org.openqa.selenium.By;
  20. import org.openqa.selenium.WebElement;
  21. import com.vaadin.testbench.elements.LabelElement;
  22. import com.vaadin.testbench.parallel.BrowserUtil;
  23. import com.vaadin.testbench.parallel.TestCategory;
  24. import com.vaadin.tests.tb3.MultiBrowserTest;
  25. @TestCategory("push")
  26. public class PushErrorHandlingTest extends MultiBrowserTest {
  27. @Test
  28. public void testErrorHandling() {
  29. setPush(true);
  30. openTestURL();
  31. vaadinElementById("npeButton").click();
  32. int idx = 1;
  33. if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
  34. // PhantomJS sends an extra event when page gets loaded.
  35. // This results as an extra error label.
  36. ++idx;
  37. }
  38. Assert.assertEquals(
  39. "An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc",
  40. $(LabelElement.class).get(idx).getText());
  41. WebElement table = vaadinElementById("testtable");
  42. WebElement row = table.findElement(By
  43. .xpath("//div[text()='Click for NPE']"));
  44. row.click();
  45. Assert.assertEquals("Internal error",
  46. vaadinElement("Root/VNotification[0]/HTML[0]/domChild[0]")
  47. .getText());
  48. }
  49. }