Repository: couchdb-fauxton Updated Branches: refs/heads/master 90c07fae8 -> e9f433030
fix for DB typeahead link This adds a test to confirm the db name typeahead field in the header of the Database page works as expected, and that the URL it redirects to doesn't include an invalid 'undefined' string at the end of it. Closes COUCHDB-2671 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/e9f43303 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/e9f43303 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/e9f43303 Branch: refs/heads/master Commit: e9f43303042b7339b83b503deec3d926b212d81c Parents: 90c07fa Author: Ben Keen <[email protected]> Authored: Wed Apr 22 11:53:29 2015 -0700 Committer: Ben Keen <[email protected]> Committed: Tue May 5 06:57:46 2015 -0700 ---------------------------------------------------------------------- .../tests/nightwatch/switchDatabase.js | 33 ++++++++++++++++++++ app/addons/databases/views.js | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e9f43303/app/addons/databases/tests/nightwatch/switchDatabase.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/tests/nightwatch/switchDatabase.js b/app/addons/databases/tests/nightwatch/switchDatabase.js new file mode 100644 index 0000000..137bb92 --- /dev/null +++ b/app/addons/databases/tests/nightwatch/switchDatabase.js @@ -0,0 +1,33 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy of +// the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + +module.exports = { + 'Confirm selecting database via typeahead redirects properly': function (client) { + var waitTime = client.globals.maxWaitTime, + newDatabaseName = client.globals.testDatabaseName; + + client + .loginToGUI() + + // wait for the DB name typeahead field to appear in the header + .waitForElementPresent('#jump-to-db .search-autocomplete', waitTime, false) + .setValue('#jump-to-db .search-autocomplete', [newDatabaseName, client.Keys.ENTER]) + .waitForElementPresent('.index-pagination', waitTime, false) + + // now check we've redirected and the URL ends with /_all_docs + .url(function (result) { + var endsWithAllDocs = /all_docs$/.test(result.value); + this.assert.ok(endsWithAllDocs, 'Redirected properly'); + }) + .end(); + } +}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e9f43303/app/addons/databases/views.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/views.js b/app/addons/databases/views.js index eedf358..cbbebb1 100644 --- a/app/addons/databases/views.js +++ b/app/addons/databases/views.js @@ -151,7 +151,7 @@ function (app, Components, FauxtonAPI, Databases) { // TODO: switch to using a model, or Databases.databaseUrl() // Neither of which are in scope right now // var db = new Database.Model({id: dbname}); - var url = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(dbname)); + var url = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(dbname), ''); FauxtonAPI.navigate(url); } else { FauxtonAPI.addNotification({
