couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-fauxton] branch master updated: Gives feedback when database creation failed + tests (#1015)
Date Thu, 02 Nov 2017 12:35:44 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new d61befb  Gives feedback when database creation failed + tests (#1015)
d61befb is described below

commit d61befb7241948112d805cd6f73ef0541fa163d1
Author: Alexis Côté <popojargo@users.noreply.github.com>
AuthorDate: Thu Nov 2 08:35:42 2017 -0400

    Gives feedback when database creation failed + tests (#1015)
---
 app/addons/databases/actions.js                    |  2 +-
 .../databases/tests/nightwatch/createsDatabase.js  | 31 +++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/app/addons/databases/actions.js b/app/addons/databases/actions.js
index 3450e7f..51341e4 100644
--- a/app/addons/databases/actions.js
+++ b/app/addons/databases/actions.js
@@ -158,7 +158,7 @@ export default {
         var route = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName),
'?limit=' + Resources.DocLimit);
         app.router.navigate(route, { trigger: true });
       }
-    ).error(function (xhr) {
+    ).fail(function (xhr) {
         var responseText = JSON.parse(xhr.responseText).reason;
         FauxtonAPI.addNotification({
           msg: 'Create database failed: ' + responseText,
diff --git a/app/addons/databases/tests/nightwatch/createsDatabase.js b/app/addons/databases/tests/nightwatch/createsDatabase.js
index b0bae61..a4185f1 100644
--- a/app/addons/databases/tests/nightwatch/createsDatabase.js
+++ b/app/addons/databases/tests/nightwatch/createsDatabase.js
@@ -13,6 +13,7 @@
 
 
 var newDatabaseName = 'fauxton-selenium-tests-db-create';
+var invalidDatabaseName = 'fauxton-selenium-tests-#####';
 var helpers = require('../../../../../test/nightwatch_tests/helpers/helpers.js');
 module.exports = {
 
@@ -56,5 +57,33 @@ module.exports = {
           'Checking if new database shows up in _all_dbs.');
       })
     .end();
-  }
+  },
+
+  'Creates a Database with invalid name' : function (client) {
+        var waitTime = client.globals.maxWaitTime,
+            baseUrl = client.globals.test_settings.launch_url;
+
+        client
+            .loginToGUI()
+            .checkForDatabaseDeleted(invalidDatabaseName, waitTime)
+            .url(baseUrl)
+
+            // ensure the page has fully loaded
+            .waitForElementPresent('.databases.table', waitTime, false)
+            .clickWhenVisible('.add-new-database-btn')
+            .waitForElementVisible('#js-new-database-name', waitTime, false)
+            .setValue('#js-new-database-name', [invalidDatabaseName])
+            .clickWhenVisible('#js-create-database', waitTime, false)
+            .waitForElementVisible('.global-notification.alert.alert-error', waitTime, false)
+            .url(baseUrl + '/_all_dbs')
+            .waitForElementVisible('html', waitTime, false)
+            .getText('html', function (result) {
+                var data = result.value,
+                    createdDatabaseIsPresent = data.indexOf(invalidDatabaseName);
+
+                this.verify.ok(createdDatabaseIsPresent === -1,
+                    'Checking if new database shows up in _all_dbs.');
+            })
+            .end();
+    }
 };

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message