Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/136#discussion_r20289469
--- Diff: app/addons/databases/tests/nightwatch/createsDatabase.js ---
@@ -0,0 +1,29 @@
+module.exports = {
+ 'Creates a Database' : function (client) {
+ var waitTime = 10000,
+ newDatabaseName = client.globals.testDatabaseName,
+ baseUrl = client.globals.baseUrl;
+
+ client
+ .loginToGUI()
+ .deleteDatabase(newDatabaseName) //need to delete the automatic
database 'fauxton-selenium-tests' that has been set up before each test
+ .url(baseUrl)
+ .waitForElementPresent('#add-new-database', waitTime, false)
+ .click('#add-new-database')
+ .pause(1000)
+ .waitForElementVisible('#js-new-database-name', waitTime, false)
+ .setValue('#js-new-database-name', [newDatabaseName])
+ .click('#js-create-database')
+ .waitForElementVisible('#global-notifications div.alert-success',
waitTime, false)
+ .url(baseUrl+'/_all_dbs')
+ .waitForElementVisible('html', waitTime, false)
+ .getText('html', function (result) {
+ var data = result.value,
+ createdDatabaseIsPresent = data.indexOf(newDatabaseName);
+
+ this.verify.ok(createdDatabaseIsPresent > 0,
--- End diff --
if the element was found as the first element, it can also be 0. Suggestion:
```
createdDatabaseIsPresent = 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.
---