summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-07-05 13:37:07 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2016-07-06 10:23:33 +0300
commit9bb15290835800f5cf64ba536aaedf7ea35dd0ca (patch)
tree49cd48dc105fc0d36b9e58cb0fa816bac27b662e /uitest
parent5cdc0c1bb2c02864065f63173a2918e9d9015de4 (diff)
downloadvaadin-framework-9bb15290835800f5cf64ba536aaedf7ea35dd0ca.tar.gz
vaadin-framework-9bb15290835800f5cf64ba536aaedf7ea35dd0ca.zip
Fix navigation to same view with different parameters (#20029)
Change-Id: I0ecc18f0ee5aecac42cfc6c9422932e2e308ab83
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/navigator/NavigationTest.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/navigator/NavigationTest.java b/uitest/src/test/java/com/vaadin/tests/navigator/NavigationTest.java
new file mode 100644
index 0000000000..59f71f3724
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/navigator/NavigationTest.java
@@ -0,0 +1,54 @@
+package com.vaadin.tests.navigator;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.testbench.elements.TableRowElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class NavigationTest extends SingleBrowserTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return NavigatorTest.class;
+ }
+
+ @Test
+ public void testNavigateToSameViewWithDifferentParameters() {
+ openTestURL();
+
+ ButtonElement listButton = $(ButtonElement.class).caption(
+ "Navigate to list").first();
+ listButton.click();
+
+ TableElement table = $(TableElement.class).first();
+ assertEquals("Unexpected navigation message",
+ "2. Navigated to ListView without params", getLogRow(0));
+
+ assertFalse("Table should not have contents",
+ table.isElementPresent(By.vaadin("#row[0]")));
+
+ listButton.click();
+ assertEquals("Should not navigate to same view again.",
+ "2. Navigated to ListView without params", getLogRow(0));
+
+ $(TextFieldElement.class).first().sendKeys("foo=1");
+ listButton.click();
+
+ assertEquals("Should not navigate to same view again.",
+ "3. Navigated to ListView with params foo=1", getLogRow(0));
+
+ assertTrue("Table should have content",
+ table.isElementPresent(By.vaadin("#row[0]")));
+ TableRowElement row = table.getRow(0);
+ assertEquals("Unexpected row content", "foo", row.getCell(0).getText());
+ assertEquals("Unexpected row content", "1", row.getCell(1).getText());
+ }
+}