couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to 1a505b1
Date Tue, 07 Apr 2015 20:38:47 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 6c0431583 -> 1a505b15b


Nightwatch test updates

This PR includes a number of small changes to the nightwatch
tests to improve stability.

Specific changes:

navigateAfterEditingDocShouldShowAConfirmationBox.js
- this now looks for the activetasks nav item instead of config,
because it’s more likely to be there for all environments.

paginateAllDocs.js
- the header, results + all docs nav load at slightly different
orders. This now ensures all are available before running the
3 tests. click()’s replaced with clickWhenVisible()’s to
ensure they’re robust.

General changes:
- replaced several click()’s with clickWhenVisible();
- added a few extra waitForElementPresent()’s to ensure the
whole page (not just a chunk of it) has been loaded before
continuing


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

Branch: refs/heads/master
Commit: 1a505b15b064a0a2919274e31d55e60f6c2c9fa0
Parents: 6c04315
Author: Ben Keen <ben.keen@gmail.com>
Authored: Tue Apr 7 12:59:50 2015 -0700
Committer: Ben Keen <ben.keen@gmail.com>
Committed: Tue Apr 7 13:18:59 2015 -0700

----------------------------------------------------------------------
 .../tests/nightwatch/deletesDocument.js         |  4 +--
 ...AfterEditingDocShouldShowAConfirmationBox.js |  4 +--
 .../tests/nightwatch/paginateAllDocs.js         | 32 +++++++++++++----
 .../documents/tests/nightwatch/paginateView.js  | 38 ++++++++++++++------
 .../documents/tests/nightwatch/viewCreate.js    | 16 ++++++---
 .../tests/nightwatch/viewCreateBadView.js       |  1 +
 .../documents/tests/nightwatch/viewEdit.js      |  3 ++
 7 files changed, 72 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/deletesDocument.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/deletesDocument.js b/app/addons/documents/tests/nightwatch/deletesDocument.js
index 37da9f9..ca633ae 100644
--- a/app/addons/documents/tests/nightwatch/deletesDocument.js
+++ b/app/addons/documents/tests/nightwatch/deletesDocument.js
@@ -22,9 +22,9 @@ module.exports = {
       .createDocument(newDocumentName, newDatabaseName)
       .url(baseUrl)
       .waitForElementPresent('#dashboard-content a[href="#/database/' + newDatabaseName +
'/_all_docs"]', waitTime, false)
-      .click('#dashboard-content a[href="#/database/' + newDatabaseName + '/_all_docs"]')
+      .clickWhenVisible('#dashboard-content a[href="#/database/' + newDatabaseName + '/_all_docs"]',
waitTime, false)
       .waitForElementVisible('label[for="checkbox-' + newDocumentName + '"]', waitTime, false)
-      .click('label[for="checkbox-' + newDocumentName + '"]')
+      .clickWhenVisible('label[for="checkbox-' + newDocumentName + '"]', waitTime, false)
       .waitForElementPresent('.control-select-all', waitTime, false)
       .clickWhenVisible('.control-delete')
       .acceptAlert()

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
index 5bd0557..1983bf8 100644
--- a/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
+++ b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
@@ -30,8 +30,8 @@ module.exports = {
       .verify.urlEquals(baseUrl + '/' + newLink)
 
       .keys(['.ace_variable', 'v'])
-      .click('a[href="#_config"]')
+      .click('a[href="#/activetasks"]')
       .accept_alert()
-      .verify.urlEquals(baseUrl + '/#_config');
+      .verify.urlEquals(baseUrl + '/#/activetasks');
   }
 };

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/paginateAllDocs.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/paginateAllDocs.js b/app/addons/documents/tests/nightwatch/paginateAllDocs.js
index 7af1362..024911b 100644
--- a/app/addons/documents/tests/nightwatch/paginateAllDocs.js
+++ b/app/addons/documents/tests/nightwatch/paginateAllDocs.js
@@ -22,8 +22,16 @@ module.exports = {
       .populateDatabase(newDatabaseName)
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+
+      // ensures the header has been rendered
       .waitForElementPresent('.control-toggle-alternative-header', waitTime, false)
-      .click('#select-per-page')
+
+      // ensures the main body (results list) has been rendered
+      .waitForElementPresent('.prettyprint', waitTime, false)
+
+      // ensures the select dropdown is rendered
+      .clickWhenVisible('#select-per-page', waitTime, false)
+
       // hack to get select working by clicking on it and using keyboard to select
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
@@ -46,14 +54,20 @@ module.exports = {
       .populateDatabase(newDatabaseName)
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+
+      // ensures the header is rendered
       .waitForElementPresent('.control-toggle-alternative-header', waitTime, false)
-      .click('#select-per-page')
+
+      // ensures the main body (results list) has been rendered
+      .waitForElementPresent('.prettyprint', waitTime, false)
+
+      .clickWhenVisible('#select-per-page', waitTime, false)
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
       .waitForElementNotPresent('div[data-id="document_16"]', waitTime)
-      .click('#next')
+      .clickWhenVisible('#next', waitTime, false)
       .waitForElementPresent('div[data-id="document_17"]', waitTime)
-      .click('#previous')
+      .clickWhenVisible('#previous', waitTime, false)
       .waitForElementPresent('div[data-id="document_1"]', waitTime)
       .end();
   },
@@ -69,13 +83,17 @@ module.exports = {
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
       .waitForElementPresent('.control-toggle-alternative-header', waitTime, false)
-      .click('#select-per-page')
+
+      // ensures the main body (results list) has been rendered
+      .waitForElementPresent('.prettyprint', waitTime, false)
+
+      .clickWhenVisible('#select-per-page', waitTime, false)
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
       .waitForElementNotPresent('div[data-id="document_16"]', waitTime)
-      .click('#next')
+      .clickWhenVisible('#next', waitTime, false)
       .waitForElementPresent('div[data-id="document_17"]', waitTime)
-      .click('#select-per-page')
+      .clickWhenVisible('#select-per-page', waitTime, false)
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
       .waitForElementPresent('div[data-id="document_1"]', waitTime)

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/paginateView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/paginateView.js b/app/addons/documents/tests/nightwatch/paginateView.js
index 6353e13..18bd9ab 100644
--- a/app/addons/documents/tests/nightwatch/paginateView.js
+++ b/app/addons/documents/tests/nightwatch/paginateView.js
@@ -13,7 +13,6 @@
 module.exports = {
 
 	'change number of items per page': function (client) {
-    /*jshint multistr: true */
     var waitTime = 10000,
         newDatabaseName = client.globals.testDatabaseName,
         baseUrl = client.globals.test_settings.launch_url;
@@ -23,7 +22,12 @@ module.exports = {
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/keyview/_view/keyview')
       .waitForElementPresent('#toggle-query', waitTime, false)
-      .click('#select-per-page')
+
+      // ensure the page content has loaded
+      .waitForElementPresent('.prettyprint', waitTime, false)
+
+      .clickWhenVisible('#select-per-page', waitTime, false)
+
       // hack to get select working by clicking on it and using keyboard to select
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
@@ -38,7 +42,6 @@ module.exports = {
   },
 
   'paginate to page two and back': function (client) {
-    /*jshint multistr: true */
     var waitTime = 10000,
         newDatabaseName = client.globals.testDatabaseName,
         baseUrl = client.globals.test_settings.launch_url;
@@ -48,20 +51,26 @@ module.exports = {
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/keyview/_view/keyview')
       .waitForElementPresent('#toggle-query', waitTime, false)
-      .click('#select-per-page')
+
+      // ensure the page content has loaded
+      .waitForElementPresent('.prettyprint', waitTime, false)
+
+      .clickWhenVisible('#select-per-page', waitTime, false)
+
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
-      .click('#next')
+      .clickWhenVisible('#next', waitTime, false)
       .waitForElementNotPresent('div[data-id="document_1"]', waitTime)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .waitForElementPresent('div[data-id="document_19"]', waitTime)
-      .click('#previous')
+      .clickWhenVisible('#previous', waitTime, false)
       .waitForElementNotPresent('div[data-id="document_19"]', waitTime)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .waitForElementPresent('div[data-id="document_1"]', waitTime)
       .end();
   },
 
   'PerPage change resets to page 1': function (client) {
-    /*jshint multistr: true */
     var waitTime = 10000,
         newDatabaseName = client.globals.testDatabaseName,
         baseUrl = client.globals.test_settings.launch_url;
@@ -71,14 +80,23 @@ module.exports = {
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_design/keyview/_view/keyview')
       .waitForElementPresent('#toggle-query', waitTime, false)
-      .click('#select-per-page')
+
+      // ensure the page content has loaded
+      .waitForElementPresent('.prettyprint', waitTime, false)
+      .clickWhenVisible('#select-per-page', waitTime, false)
+
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
-      .click('#next')
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
+
+      .clickWhenVisible('#next', waitTime, false)
       .waitForElementNotPresent('div[data-id="document_1"]', waitTime)
-      .click('#select-per-page')
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
+
+      .clickWhenVisible('#select-per-page', waitTime, false)
       // http://www.w3.org/TR/2012/WD-webdriver-20120710/
       .keys(['\uE013', '\uE006'])
+
       .waitForElementPresent('div[data-id="document_1"]', waitTime)
       .end();
   }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/viewCreate.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewCreate.js b/app/addons/documents/tests/nightwatch/viewCreate.js
index f1b1692..5b6fc47 100644
--- a/app/addons/documents/tests/nightwatch/viewCreate.js
+++ b/app/addons/documents/tests/nightwatch/viewCreate.js
@@ -31,6 +31,7 @@ var tests = {
       .execute('$(".save")[0].scrollIntoView();')
       .click('button.btn.btn-success.save')
       .waitForElementPresent('.prettyprint', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'hasehase')
     .end();
   },
@@ -49,6 +50,7 @@ var tests = {
       .execute('$(".save")[0].scrollIntoView();')
       .click('button.btn-success.save')
       .waitForElementPresent('.prettyprint', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'gansgans')
     .end();
   },
@@ -64,20 +66,24 @@ var tests = {
         editor.getSession().setValue("function (doc) { emit(\'enteente\', 1); }");\
       ')
       .execute('$(".save")[0].scrollIntoView();')
-      .clickWhenVisible('button.btn-success.save')
-      .waitForElementPresent('.prettyprint', waitTime, false)
+      .click('button.btn-success.save')
+      .waitForAttribute('#global-notifications', 'textContent', function (notification) {
+        return (/View Saved./).test(notification.trim());
+      })
+      //go back to all docs
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
-      .clickWhenVisible('[data-target="#testdesigndoc"]')
+      .clickWhenVisible('[data-target="#testdesigndoc"]', waitTime, false)
       .clickWhenVisible('[data-target="#testdesigndocviews"]', waitTime, false)
       .clickWhenVisible('#testdesigndoc_testnewview', waitTime, false)
       .waitForElementPresent('.prettyprint', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'enteente')
     .end();
-  },
+  }
 };
 
 function openDifferentDropdownsAndClick (client, dropDownElement) {
-  modifier =  + dropDownElement.slice(1);
+  modifier = dropDownElement.slice(1);
   newDatabaseName = client.globals.testDatabaseName;
   newDocumentName = 'create_view_doc' + modifier;
   baseUrl = client.globals.test_settings.launch_url;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/viewCreateBadView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewCreateBadView.js b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
index d89edc6..bd0ca3f 100644
--- a/app/addons/documents/tests/nightwatch/viewCreateBadView.js
+++ b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
@@ -23,6 +23,7 @@ module.exports = {
       .loginToGUI()
       .populateDatabase(newDatabaseName)
       .url(baseUrl + '/#/database/' + newDatabaseName + '/new_view')
+      .waitForElementVisible('#new-ddoc', waitTime, false)
       .setValue('#new-ddoc', 'test_design_doc-selenium-bad-reduce')
       .clearValue('#index-name')
       .setValue('#index-name', 'hasenindex')

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1a505b15/app/addons/documents/tests/nightwatch/viewEdit.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewEdit.js b/app/addons/documents/tests/nightwatch/viewEdit.js
index a0ef94e..b18faab 100644
--- a/app/addons/documents/tests/nightwatch/viewEdit.js
+++ b/app/addons/documents/tests/nightwatch/viewEdit.js
@@ -34,6 +34,7 @@ module.exports = {
       .click('button.btn-success.save')
 
       .waitForElementNotVisible('.global-notification', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'hasehase5000')
     .end();
   },
@@ -59,6 +60,7 @@ module.exports = {
       .click('button.btn-success.save')
 
       .waitForElementNotVisible('.global-notification', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'hasehase5000')
     .end();
   },
@@ -82,6 +84,7 @@ module.exports = {
       ')
       .execute('$("button.save")[0].scrollIntoView();')
       .clickWhenVisible('button.save', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
       .waitForAttribute('.prettyprint', 'textContent', function (docContents) {
         return (/40/).test(docContents);
       })


Mime
View raw message