Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/136#discussion_r20289398
--- Diff: app/addons/documents/tests/nightwatch/createsDocument.js ---
@@ -0,0 +1,38 @@
+module.exports = {
+ 'Creates a document' : function (client) {
+ /*jshint multistr: true */
+ var waitTime = 10000,
+ newDatabaseName = client.globals.testDatabaseName,
+ newDocumentName = 'create_doc_document',
+ baseUrl = client.globals.baseUrl;
+
+ client
+ .loginToGUI()
+ .url(baseUrl+'/#/database/'+newDatabaseName+'/_all_docs')
+ .waitForElementPresent('#new-all-docs-button', waitTime, false)
+ .click('#new-all-docs-button')
+ .waitForElementPresent('#new-all-docs-button
a[href="#/database/'+newDatabaseName+'/new"]', waitTime, false)
+ .click('#new-all-docs-button
a[href="#/database/'+newDatabaseName+'/new"]')
+ .waitForElementPresent('#doc', waitTime, false)
+ .verify.urlEquals(baseUrl+'/#/database/'+ newDatabaseName+'/new')
+ .execute('\
+ var editor = ace.edit("editor-container");\
+ editor.gotoLine(2,10);\
+ editor.removeWordRight();\
+ editor.insert("'+newDocumentName+'");\
+ ')
+ .waitForElementPresent('#doc button.save-doc.btn.btn-success.save',
waitTime, false)
+ .click('#doc button.save-doc.btn.btn-success.save')
+ .pause(1000)
+ .url(baseUrl+'/'+newDatabaseName+'/_all_docs')
+ .waitForElementPresent('body', waitTime, false)
+ .getText('body', function (result) {
+ var data = result.value,
+ createdDocIsPresent = data.indexOf(newDocumentName);
+
+ this.verify.ok(createdDocIsPresent > 0,
--- End diff --
if the it was found as the first element, it can also be 0. Suggestion:
```
createdDocIsPresent = data.indexOf(newDocumentName) !== -1
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---