You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RefreshUITest.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package com.vaadin.tests.components.ui;
  2. import com.vaadin.testbench.elements.ButtonElement;
  3. import org.junit.Test;
  4. import com.vaadin.testbench.elements.LabelElement;
  5. import com.vaadin.tests.tb3.MultiBrowserTest;
  6. import static org.junit.Assert.assertEquals;
  7. public class RefreshUITest extends MultiBrowserTest {
  8. @Test
  9. public void testUIRefresh_viewNotRecreated() {
  10. openTestURL();
  11. assertEquals("The Label content is not matching",
  12. "This is instance no 1",
  13. $(LabelElement.class).first().getText());
  14. // Reload the page; UI.refresh should be invoked
  15. reloadPage();
  16. assertEquals("The Label content is not matching",
  17. "This is instance no 1",
  18. $(LabelElement.class).first().getText());
  19. }
  20. @Test
  21. public void testViewNotRecreatedAfterNavigation() {
  22. openTestURL();
  23. assertEquals("This is instance no 1",
  24. $(LabelElement.class).first().getText());
  25. // Reload the page; UI.refresh should be invoked
  26. reloadPage();
  27. assertEquals("This is instance no 1",
  28. $(LabelElement.class).first().getText());
  29. // now open the other view using the navigator
  30. $(ButtonElement.class).first().click();
  31. assertEquals("This is otherview instance no 1",
  32. $(LabelElement.class).first().getText());
  33. // Reload the page; UI.refresh should be invoked
  34. reloadPage();
  35. assertEquals("This is otherview instance no 1",
  36. $(LabelElement.class).first().getText());
  37. }
  38. }