From b5e634338ddd51103d9a21d9a70421b1727b8fe1 Mon Sep 17 00:00:00 2001 From: "michellephung@gmail.com" Date: Thu, 9 Apr 2015 14:41:12 -0400 Subject: [PATCH] fix for createDatabase Test add global waitTime to waitForAttribute --- app/addons/databases/tests/nightwatch/createsDatabase.js | 7 +++---- test/nightwatch_tests/custom-commands/waitForAttribute.js | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/addons/databases/tests/nightwatch/createsDatabase.js b/app/addons/databases/tests/nightwatch/createsDatabase.js index 09ec328fd..9233aeb03 100644 --- a/app/addons/databases/tests/nightwatch/createsDatabase.js +++ b/app/addons/databases/tests/nightwatch/createsDatabase.js @@ -23,15 +23,14 @@ module.exports = { // ensure the page has fully loaded .waitForElementPresent('.databases.table', waitTime, false) - .waitForElementPresent('#add-new-database', waitTime, false) .clickWhenVisible('#add-new-database', waitTime, false) - .pause(1000) .waitForElementVisible('#js-new-database-name', waitTime, false) .setValue('#js-new-database-name', [newDatabaseName]) - .clickWhenVisible('#js-create-database', waitTime, false) - .waitForElementVisible('#global-notifications .alert.alert-success', waitTime, false) + .waitForAttribute('#global-notifications', 'textContent', function (successAlertText) { + return (/Database created successfully/).test(successAlertText); + }) .url(baseUrl + '/_all_dbs') .waitForElementVisible('html', waitTime, false) .getText('html', function (result) { diff --git a/test/nightwatch_tests/custom-commands/waitForAttribute.js b/test/nightwatch_tests/custom-commands/waitForAttribute.js index beecc6150..a6cc7aa43 100644 --- a/test/nightwatch_tests/custom-commands/waitForAttribute.js +++ b/test/nightwatch_tests/custom-commands/waitForAttribute.js @@ -12,6 +12,7 @@ var util = require('util'); var events = require('events'); +var helpers = require('../helpers/helpers.js'); /* * This custom command allows us to locate an HTML element on the page and then wait until the value of a specified @@ -33,7 +34,7 @@ WaitForAttribute.prototype.command = function (element, attribute, checker, time var message; if (typeof timeoutInMilliseconds !== 'number') { - timeoutInMilliseconds = 8000; + timeoutInMilliseconds = helpers.maxWaitTime; } this.check(element, attribute, checker, function (result, loadedTimeInMilliseconds) {