You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2016/02/02 18:21:13 UTC

fauxton commit: updated refs/heads/master to 478a3b3

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 1aaf6f240 -> 478a3b3ef


fix flaky test / race condition

we init with an empty array, but the code expects a backbone
collection. if the connection is slow, we run into race conditions
as the store was not updated yet with a valid backbone collection.

PR: #638
PR-URL: https://github.com/apache/couchdb-fauxton/pull/638
Reviewed-By: Benjamin Keen <be...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/478a3b3e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/478a3b3e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/478a3b3e

Branch: refs/heads/master
Commit: 478a3b3efaf97dbfed42f9075d2272d980c43a93
Parents: 1aaf6f2
Author: Robert Kowalski <ro...@apache.org>
Authored: Tue Feb 2 14:37:49 2016 +0000
Committer: Robert Kowalski <ro...@apache.org>
Committed: Tue Feb 2 17:20:54 2016 +0000

----------------------------------------------------------------------
 app/addons/documents/index-results/stores.js     | 19 +++++++++++++------
 .../documents/tests/nightwatch/tableView.js      |  2 ++
 2 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/478a3b3e/app/addons/documents/index-results/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/stores.js b/app/addons/documents/index-results/stores.js
index 384f457..13918dd 100644
--- a/app/addons/documents/index-results/stores.js
+++ b/app/addons/documents/index-results/stores.js
@@ -20,10 +20,12 @@ define([
   'addons/documents/resources',
   'addons/documents/mango/mango.helper',
   'addons/documents/resources',
+  'addons/databases/resources',
+
 ],
 
 function (app, FauxtonAPI, ActionTypes, HeaderActionTypes, PaginationActionTypes,
-  Documents, MangoHelper, Resources) {
+  Documents, MangoHelper, Resources, DatabaseResources) {
 
   var Stores = {};
 
@@ -36,9 +38,14 @@ function (app, FauxtonAPI, ActionTypes, HeaderActionTypes, PaginationActionTypes
     },
 
     reset: function () {
-      this._collection = [];
+      this._collection = new Resources.AllDocs([], {
+        database: {
+          safeID: function () { return ''; }
+        }, params: {limit: 5}
+      });
+
       this._filteredCollection = [];
-      this._bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {}),
+      this._bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {});
 
       this.clearSelectedItems();
       this._isLoading = false;
@@ -489,11 +496,11 @@ function (app, FauxtonAPI, ActionTypes, HeaderActionTypes, PaginationActionTypes
     getTableViewData: function () {
       var res;
       var schema;
-      var database;
       var hasIdOrRev;
       var hasIdOrRev;
       var prioritizedFields;
       var hasBulkDeletableDoc;
+      var database = this.getDatabase();
       var isView = !!this._collection.view;
 
       // softmigration remove backbone
@@ -578,14 +585,14 @@ function (app, FauxtonAPI, ActionTypes, HeaderActionTypes, PaginationActionTypes
       this._notSelectedFields = notSelectedFields;
       this._tableSchema = schema;
 
-      database = this.getDatabase().safeID();
+      var dbId = database.safeID();
 
       res = data.map(function (doc) {
         var safeId = app.utils.getSafeIdForDoc(doc._id || doc.id); // inconsistent apis for GET between mango and views
         var url;
 
         if (safeId) {
-          url = FauxtonAPI.urls('document', 'app', database, safeId);
+          url = FauxtonAPI.urls('document', 'app', database, dbId);
         }
 
         return {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/478a3b3e/app/addons/documents/tests/nightwatch/tableView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/tableView.js b/app/addons/documents/tests/nightwatch/tableView.js
index 4939e05..21644cd 100644
--- a/app/addons/documents/tests/nightwatch/tableView.js
+++ b/app/addons/documents/tests/nightwatch/tableView.js
@@ -28,6 +28,7 @@ module.exports = {
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs?include_docs=true')
 
       .clickWhenVisible('.alternative-header .two-sides-toggle-button button:last-child')
+      .waitForElementVisible('.tableview-checkbox-cell', client.globals.maxWaitTime, false)
       .getText('.table', function (result) {
         var data = result.value;
 
@@ -58,6 +59,7 @@ module.exports = {
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
 
       .clickWhenVisible('.alternative-header .two-sides-toggle-button button:last-child')
+      .waitForElementVisible('.tableview-checkbox-cell', client.globals.maxWaitTime, false)
       .getText('.table', function (result) {
         var data = result.value;