fix replication tests

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

Branch: refs/heads/new-replication
Commit: 4a9d3bdbdddc500deaf38c3ecd764b736b6c929f
Parents: 9a0e59f
Author: Garren Smith <garren.sm...@gmail.com>
Authored: Mon Aug 15 15:44:37 2016 +0200
Committer: Garren Smith <garren.sm...@gmail.com>
Committed: Wed Sep 14 17:22:30 2016 +0200

----------------------------------------------------------------------
 app/addons/replication/route.js                 | 10 +++---
 .../replication/tests/nightwatch/replication.js | 33 +++++++++-----------
 2 files changed, 18 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4a9d3bdb/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js
index 6947045..6ec414d 100644
--- a/app/addons/replication/route.js
+++ b/app/addons/replication/route.js
@@ -15,8 +15,7 @@ import FauxtonAPI from '../../core/api';
 import Actions from './actions';
 import Components from './components.react';
 
-
-var ReplicationRouteObject = FauxtonAPI.RouteObject.extend({
+const ReplicationRouteObject = FauxtonAPI.RouteObject.extend({
   layout: 'one_pane',
   routes: {
     'replication': 'defaultView',
@@ -37,7 +36,6 @@ var ReplicationRouteObject = FauxtonAPI.RouteObject.extend({
   }
 });
 
-var Replication = {};
-Replication.RouteObjects = [ReplicationRouteObject];
-
-export default Replication;
+export default {
+  RouteObjects: [ReplicationRouteObject]
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4a9d3bdb/app/addons/replication/tests/nightwatch/replication.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/tests/nightwatch/replication.js 
b/app/addons/replication/tests/nightwatch/replication.js
index d70356a..a344a0b 100644
--- a/app/addons/replication/tests/nightwatch/replication.js
+++ b/app/addons/replication/tests/nightwatch/replication.js
@@ -19,7 +19,6 @@ const replicatedDBName = 'replicated-db';
 const docName1 = 'doc-name1';
 const docName2 = 'doc-name2';
 const pwd = 'testerpass';
-const longWaitTime = 120000;
 
 const destroyDBs = (client, done) => {
   var nano = helpers.getNanoInstance(client.globals.test_settings.db_url);
@@ -33,8 +32,7 @@ const destroyDBs = (client, done) => {
 };
 
 module.exports = {
-  before: destroyDBs, // just in case the test failed on prev execution
-  after: destroyDBs,
+  before: destroyDBs,
 
   'Replicates existing local db to new local db' : function (client) {
     var waitTime = client.globals.maxWaitTime,
@@ -42,7 +40,7 @@ module.exports = {
 
     client
       .createDatabase(newDatabaseName1)
-      .checkForDatabaseCreated(newDatabaseName1, longWaitTime)
+      .checkForDatabaseCreated(newDatabaseName1, waitTime)
       .createDocument(docName1, newDatabaseName1)
       .loginToGUI()
       .url(baseUrl + '/#replication')
@@ -51,15 +49,14 @@ module.exports = {
 
       // select LOCAL as the source
       .click('#replication-source')
-      .click('#replication-source option[value="REPLICATION_SOURCE_LOCAL"]')
+      .keys(['\uE015', '\uE006'])
       .waitForElementPresent('.replication-source-name-row', waitTime, true)
 
       // enter our source DB
-      .setValue('.replication-source-name-row .Select-input input', 
[newDatabaseName1])
-      .keys(['\uE015', '\uE015', '\uE006'])
+      .setValue('.replication-source-name-row .Select-input input', 
[newDatabaseName1, client.Keys.ENTER])
 
       // enter a new target name
-      .click('#replication-target')
+      .waitForElementPresent('#replication-target', waitTime, true)
       .click('option[value="REPLICATION_TARGET_NEW_LOCAL_DATABASE"]')
       .setValue('.new-local-db', replicatedDBName)
 
@@ -71,10 +68,10 @@ module.exports = {
       .waitForElementNotPresent('.enter-password-modal', waitTime, true)
 
       // now check the database was created
-      .checkForDatabaseCreated(replicatedDBName, longWaitTime)
+      .checkForDatabaseCreated(replicatedDBName, waitTime)
 
       // lastly, check the doc was replicated as well
-      .checkForDocumentCreated(docName1, longWaitTime, replicatedDBName)
+      .checkForDocumentCreated(docName1, waitTime, replicatedDBName)
       .end();
   },
 
@@ -87,10 +84,10 @@ module.exports = {
 
       // create two databases, each with a single (different) doc
       .createDatabase(newDatabaseName1)
-      .checkForDatabaseCreated(newDatabaseName1, longWaitTime)
+      .checkForDatabaseCreated(newDatabaseName1, waitTime)
       .createDocument(docName1, newDatabaseName1)
       .createDatabase(newDatabaseName2)
-      .checkForDatabaseCreated(newDatabaseName2, longWaitTime)
+      .checkForDatabaseCreated(newDatabaseName2, waitTime)
       .createDocument(docName2, newDatabaseName2)
 
       // now login and fill in the replication form
@@ -101,16 +98,14 @@ module.exports = {
 
       // select the LOCAL db as the source
       .click('#replication-source')
-      .click('#replication-source option[value="REPLICATION_SOURCE_LOCAL"]')
+      .keys(['\uE015', '\uE006'])
       .waitForElementPresent('.replication-source-name-row', waitTime, true)
-      .setValue('.replication-source-name-row .Select-input input', 
[newDatabaseName1])
-      .keys(['\uE015', '\uE015', '\uE006'])
+      .setValue('.replication-source-name-row .Select-input input', 
[newDatabaseName1, client.Keys.ENTER])
 
       // select existing local as the target
-      .click('#replication-target')
+      .waitForElementPresent('#replication-target', waitTime, true)
       .click('#replication-target 
option[value="REPLICATION_TARGET_EXISTING_LOCAL_DATABASE"]')
-      .setValue('.replication-target-name-row .Select-input input', 
[newDatabaseName2])
-      .keys(['\uE015', '\uE015', '\uE006'])
+      .setValue('.replication-target-name-row .Select-input input', 
[newDatabaseName2, client.Keys.ENTER])
 
       .getAttribute('#replicate', 'disabled', function (result) {
         // confirm it's not disabled
@@ -123,7 +118,7 @@ module.exports = {
       .click('.enter-password-modal button.save')
 
       // now check the target database contains the doc from the original db
-      .checkForDocumentCreated(docName1, longWaitTime, newDatabaseName2)
+      .checkForDocumentCreated(docName1, waitTime, newDatabaseName2)
       .end();
   }
 };

Reply via email to