move tryForTime to getFieldsTabCount, speed up test

This commit is contained in:
Joe Fleming 2015-11-06 10:58:31 -07:00
parent 89352cfc38
commit 1b0db1106a
2 changed files with 15 additions and 11 deletions

View file

@ -93,11 +93,9 @@ define(function (require) {
}); });
bdd.it('makelogs data should have expected number of fields', function () { bdd.it('makelogs data should have expected number of fields', function () {
return common.tryForTime(15000, function () { return settingsPage.getFieldsTabCount()
return settingsPage.getFieldsTabCount() .then(function (tabCount) {
.then(function (tabCount) { expect(tabCount).to.be('' + expectedFieldCount);
expect(tabCount).to.be('' + expectedFieldCount);
});
}) })
.catch(common.handleError(this)); .catch(common.handleError(this));
}); });

View file

@ -121,12 +121,18 @@ define(function (require) {
}, },
getFieldsTabCount: function getFieldsTabCount() { getFieldsTabCount: function getFieldsTabCount() {
return this.remote.setFindTimeout(defaultTimeout * 2) var self = this;
// passing in zero-based index, but adding 1 for css 1-based indexes var selector = 'li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding';
.findByCssSelector('li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding').getVisibleText()
.then(function (theText) { return common.tryForTime(defaultTimeout, function () {
// the value has () around it, remove them return self.remote.findByCssSelector(selector);
return theText.replace(/\((.*)\)/, '$1'); })
.then(function () {
return self.remote.findByCssSelector(selector).getVisibleText()
.then(function (theText) {
// the value has () around it, remove them
return theText.replace(/\((.*)\)/, '$1');
});
}); });
}, },