harden flaky tests

PR: #591
PR-URL: https://github.com/apache/couchdb-fauxton/pull/591
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>
diff --git a/app/addons/documents/tests/nightwatch/deletesDocuments.js b/app/addons/documents/tests/nightwatch/deletesDocuments.js
index 83989e4..3d1dcff 100644
--- a/app/addons/documents/tests/nightwatch/deletesDocuments.js
+++ b/app/addons/documents/tests/nightwatch/deletesDocuments.js
@@ -21,6 +21,8 @@
       .createDocument(newDocumentName, newDatabaseName)
       .createDocument(newDocumentName + '2', newDatabaseName)
       .loginToGUI()
+      .checkForDocumentCreated(newDocumentName)
+      .checkForDocumentCreated(newDocumentName + '2')
       .url(baseUrl)
       .waitForElementPresent('#dashboard-content a[href="#/database/' + newDatabaseName + '/_all_docs"]', waitTime, false)
       .clickWhenVisible('#dashboard-content a[href="#/database/' + newDatabaseName + '/_all_docs"]', waitTime, false)
@@ -108,6 +110,7 @@
 
     client
       .createDocument(newDocumentName, newDatabaseName)
+      .checkForDocumentCreated(newDocumentName)
       .loginToGUI()
       .url(baseUrl + '#/database/' + newDatabaseName + '/' + newDocumentName)
       .waitForElementPresent('#editor-container', waitTime, false)