summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-29 16:03:05 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-31 09:47:29 +0200
commit756189ef29dd8236ab42168ee3c041c65754ae7b (patch)
tree0aeec37d372003f41b5c83f5a7da6054a7964a51
parent464cab6680a18bcac5fce702e8b1a1b87af4051e (diff)
downloadvaadin-framework-756189ef29dd8236ab42168ee3c041c65754ae7b.tar.gz
vaadin-framework-756189ef29dd8236ab42168ee3c041c65754ae7b.zip
Fix RpcDataProviderExtension to send initial data on reload (#15465)
Change-Id: I0a2edc9a9ba1f48299e165d398adf7b73972349f
-rw-r--r--server/src/com/vaadin/data/RpcDataProviderExtension.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java28
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));
+ }
}
.filter_by_team_repositories"}} </div> <div class="scrolling menu items"> <a class="{{if not $.Team}}active selected{{end}} item" title="{{.i18n.Tr "all"}}" href="{{AppSubUrl}}/org/{{$.Org.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> {{.i18n.Tr "all"}} </a> {{range .Org.Teams}} {{if not .IncludesAllRepositories}} <a class="{{if $.Team}}{{if eq $.Team.ID .ID}}active selected{{end}}{{end}} item" title="{{.Name}}" href="{{AppSubUrl}}/org/{{$.Org.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}/{{.Name}}"> {{.Name}} </a> {{end}} {{end}} </div> </div> </div> </div> <a class="{{if .PageIsNews}}active{{end}} item" style="margin-left: auto" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/dashboard{{if .Team}}/{{.Team.Name}}{{end}}"> {{svg "octicon-rss"}}&nbsp;{{.i18n.Tr "activities"}} </a> {{if not .UnitIssuesGlobalDisabled}} <a class="{{if .PageIsIssues}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/issues{{if .Team}}/{{.Team.Name}}{{end}}"> {{svg "octicon-issue-opened"}}&nbsp;{{.i18n.Tr "issues"}} </a> {{end}} {{if not .UnitPullsGlobalDisabled}} <a class="{{if .PageIsPulls}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/pulls{{if .Team}}/{{.Team.Name}}{{end}}"> {{svg "octicon-git-pull-request"}}&nbsp;{{.i18n.Tr "pull_requests"}} </a> {{end}} {{if and .ShowMilestonesDashboardPage (not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled))}} <a class="{{if .PageIsMilestonesDashboard}}active{{end}} item" href="{{AppSubUrl}}/org/{{.ContextUser.Name}}/milestones{{if .Team}}/{{.Team.Name}}{{end}}"> {{svg "octicon-milestone"}}&nbsp;{{.i18n.Tr "milestones"}} </a> {{end}} <div class="item"> <a class="ui blue basic button" href="{{.ContextUser.HomeLink}}" title='{{.i18n.Tr "home.view_home" .ContextUser.Name}}'> {{.i18n.Tr "home.view_home" (.ContextUser.ShortName 20)}} </a> </div> </div> {{end}} </div> </div> <div class="ui divider"></div>