From 1b0db1106a1da9a682fcba497db658e991014050 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 6 Nov 2015 10:58:31 -0700 Subject: [PATCH] move tryForTime to getFieldsTabCount, speed up test --- .../settings/_index_pattern_results_sort.js | 8 +++----- test/support/pages/SettingsPage.js | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/test/functional/apps/settings/_index_pattern_results_sort.js b/test/functional/apps/settings/_index_pattern_results_sort.js index 4e8bdf95d81c..4234aa57471a 100644 --- a/test/functional/apps/settings/_index_pattern_results_sort.js +++ b/test/functional/apps/settings/_index_pattern_results_sort.js @@ -93,11 +93,9 @@ define(function (require) { }); bdd.it('makelogs data should have expected number of fields', function () { - return common.tryForTime(15000, function () { - return settingsPage.getFieldsTabCount() - .then(function (tabCount) { - expect(tabCount).to.be('' + expectedFieldCount); - }); + return settingsPage.getFieldsTabCount() + .then(function (tabCount) { + expect(tabCount).to.be('' + expectedFieldCount); }) .catch(common.handleError(this)); }); diff --git a/test/support/pages/SettingsPage.js b/test/support/pages/SettingsPage.js index f2c6e6d36439..9c4f41e7c7ab 100644 --- a/test/support/pages/SettingsPage.js +++ b/test/support/pages/SettingsPage.js @@ -121,12 +121,18 @@ define(function (require) { }, getFieldsTabCount: function getFieldsTabCount() { - return this.remote.setFindTimeout(defaultTimeout * 2) - // passing in zero-based index, but adding 1 for css 1-based indexes - .findByCssSelector('li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding').getVisibleText() - .then(function (theText) { - // the value has () around it, remove them - return theText.replace(/\((.*)\)/, '$1'); + var self = this; + var selector = 'li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding'; + + return common.tryForTime(defaultTimeout, function () { + return self.remote.findByCssSelector(selector); + }) + .then(function () { + return self.remote.findByCssSelector(selector).getVisibleText() + .then(function (theText) { + // the value has () around it, remove them + return theText.replace(/\((.*)\)/, '$1'); + }); }); },