From 3a6041998393f7828119c784d24b988588208220 Mon Sep 17 00:00:00 2001 From: Robert Kowalski Date: Tue, 1 Sep 2015 17:47:47 +0200 Subject: [PATCH] use a stricter way to determine if db exists avoids false positives like fauxton-seleniumtest2 code is covered by the testsuite itself :) --- .../custom-commands/checkForDatabaseCreated.js | 3 ++- .../custom-commands/checkForDatabaseDeleted.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/nightwatch_tests/custom-commands/checkForDatabaseCreated.js b/test/nightwatch_tests/custom-commands/checkForDatabaseCreated.js index 91c0941ff..7889f2e4d 100644 --- a/test/nightwatch_tests/custom-commands/checkForDatabaseCreated.js +++ b/test/nightwatch_tests/custom-commands/checkForDatabaseCreated.js @@ -36,7 +36,8 @@ CheckForDatabaseCreated.prototype.command = function (databaseName, timeout) { var intervalId = setInterval(function () { request(couchUrl + '/_all_dbs', function (er, res, body) { if (body) { - if (body.indexOf(databaseName) !== -1) { + var reg = new RegExp('"' + databaseName + '"', 'g'); + if (reg.test(body)) { clearTimeout(timeOutId); console.log('database created: ' + databaseName); clearInterval(intervalId); diff --git a/test/nightwatch_tests/custom-commands/checkForDatabaseDeleted.js b/test/nightwatch_tests/custom-commands/checkForDatabaseDeleted.js index c5c42ce90..2888ea694 100644 --- a/test/nightwatch_tests/custom-commands/checkForDatabaseDeleted.js +++ b/test/nightwatch_tests/custom-commands/checkForDatabaseDeleted.js @@ -36,7 +36,8 @@ CheckForDatabaseDeleted.prototype.command = function (databaseName, timeout) { var intervalId = setInterval(function () { request(couchUrl + '/_all_dbs', function (er, res, body) { if (body) { - if (body.indexOf(databaseName) === -1) { + var reg = new RegExp('"' + databaseName + '"', 'g'); + if (!reg.test(body)) { clearTimeout(timeOutId); console.log('database not there: ' + databaseName); clearInterval(intervalId);