diff options
3 files changed, 41 insertions, 1 deletions
diff --git a/server/src/com/vaadin/data/RpcDataProviderExtension.java b/server/src/com/vaadin/data/RpcDataProviderExtension.java index 8e119f0d94..e8818aa828 100644 --- a/server/src/com/vaadin/data/RpcDataProviderExtension.java +++ b/server/src/com/vaadin/data/RpcDataProviderExtension.java @@ -698,7 +698,8 @@ public class RpcDataProviderExtension extends AbstractExtension { @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); - if (!clientInitialized) { + + if (initial) { clientInitialized = true; /* diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 91dff944cb..0e339ec0ae 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -121,4 +121,15 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { .findElement( By.xpath("//div[contains(@class, \"v-grid-scroller-vertical\")]")); } + + /** + * Reloads the page without restartApplication. This occasionally breaks + * stuff. + */ + protected void reopenTestURL() { + String testUrl = getTestUrl(); + testUrl = testUrl.replace("?restartApplication", "?"); + testUrl = testUrl.replace("?&", "?"); + driver.get(testUrl); + } } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java index 9a9f85ccb9..97a4fb8f4a 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java @@ -447,4 +447,32 @@ public class GridStructureTest extends GridBasicFeaturesTest { assertEquals("Scroll position should've not have changed", scrollPos, getGridVerticalScrollPos()); } + + @Test + public void testReloadPage() throws InterruptedException { + setDebug(true); + openTestURL(); + + reopenTestURL(); + + // After opening the URL Grid can be stuck in a state where it thinks it + // should wait for something that's not going to happen. + testBench().disableWaitForVaadin(); + + // Wait until page is loaded completely. + int count = 0; + while (!isElementPresent(GridElement.class)) { + if (count == 100) { + fail("Reloading page failed"); + } + sleep(100); + ++count; + } + + // Wait a bit more for notification to occur. + sleep(1000); + + assertFalse("Exception occurred when reloading page", + isElementPresent(NotificationElement.class)); + } } |