From bf7d3942570f2a2f4c851739ad5972a721d9f146 Mon Sep 17 00:00:00 2001 From: Garren Smith Date: Mon, 2 Feb 2015 14:26:15 +0200 Subject: [PATCH] Fix new doc page Change new to New Document Fix '<' to use previous link This fixes COUCHDB-2564 --- app/addons/documents/routes-doc-editor.js | 5 +-- .../tests/nightwatch/navigateFromNewDoc.js | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 app/addons/documents/tests/nightwatch/navigateFromNewDoc.js diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js index c23d8e61f..384f0ab2d 100644 --- a/app/addons/documents/routes-doc-editor.js +++ b/app/addons/documents/routes-doc-editor.js @@ -128,8 +128,8 @@ function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { crumbs: function () { var previousPage = Helpers.getPreviousPage(this.database); return [ - { type: 'back', link: 'previousPage' }, - { name: 'New', link: '#' } + { type: 'back', link: previousPage }, + { name: 'New Document', link: '#' } ]; }, @@ -146,4 +146,3 @@ function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { DocEditorRouteObject: DocEditorRouteObject }; }); - diff --git a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js new file mode 100644 index 000000000..79e6ece9e --- /dev/null +++ b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js @@ -0,0 +1,38 @@ +// 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 = { + + // this tests that the user is able to just navigate to and from the New View page without errors [it confirms + // a bug fix for where the Ace Editor threw a JS error preventing the subsequent page from loading] + 'Navigate to and from New Doc Page' : function (client) { + var waitTime = 10000, + newDatabaseName = client.globals.testDatabaseName, + baseUrl = client.globals.test_settings.launch_url; + + var newLink = '#/database/' + newDatabaseName + '/new'; + + client + .loginToGUI() + .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs') + .waitForElementPresent('#new-all-docs-button', waitTime, false) + .click('#new-all-docs-button a') + .waitForElementPresent('#new-all-docs-button a[href="'+ newLink + '"]', waitTime, false) + .click('#new-all-docs-button a[href="' + newLink + '"]') + .waitForElementPresent('.code-region', waitTime, false) + .verify.urlEquals(baseUrl+ '/' + newLink) + + // now redirect back to the all docs page and check it's loaded properly + .click('.fonticon-left-open') + .verify.urlEquals(baseUrl + '/#database/' + newDatabaseName + '/_all_docs'); + } +};