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 () {
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));
});

View file

@ -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');
});
});
},