aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/RefreshUITest.java25
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java9
2 files changed, 31 insertions, 3 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/RefreshUITest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/RefreshUITest.java
index 16f279e1e5..db42bc71f8 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/RefreshUITest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/RefreshUITest.java
@@ -1,5 +1,6 @@
package com.vaadin.tests.components.ui;
+import com.vaadin.testbench.elements.ButtonElement;
import org.junit.Test;
import com.vaadin.testbench.elements.LabelElement;
@@ -17,9 +18,31 @@ public class RefreshUITest extends MultiBrowserTest {
$(LabelElement.class).first().getText());
// Reload the page; UI.refresh should be invoked
- openTestURL();
+ reloadPage();
assertEquals("The Label content is not matching",
"This is instance no 1",
$(LabelElement.class).first().getText());
}
+
+ @Test
+ public void testViewNotRecreatedAfterNavigation() {
+ openTestURL();
+ assertEquals("This is instance no 1",
+ $(LabelElement.class).first().getText());
+
+ // Reload the page; UI.refresh should be invoked
+ reloadPage();
+ assertEquals("This is instance no 1",
+ $(LabelElement.class).first().getText());
+
+ // now open the other view using the navigator
+ $(ButtonElement.class).first().click();
+ assertEquals("This is otherview instance no 1",
+ $(LabelElement.class).first().getText());
+
+ // Reload the page; UI.refresh should be invoked
+ reloadPage();
+ assertEquals("This is otherview instance no 1",
+ $(LabelElement.class).first().getText());
+ }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
index 548ac78e78..c835696470 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -31,10 +31,8 @@ import org.junit.rules.TestName;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
-import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
-import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
@@ -254,6 +252,13 @@ public abstract class AbstractTB3Test extends ParallelTest {
openTestURL(uiClass, new HashSet<>(Arrays.asList(parameters)));
}
+ /**
+ * Reloads the current page, as if the user pressed F5.
+ */
+ protected void reloadPage() {
+ driver.navigate().refresh();
+ }
+
private void openTestURL(Class<?> uiClass, Set<String> parameters) {
String url = getTestURL(uiClass);