[test] Fix test fixtures.

This commit is contained in:
Nicolás Bevacqua 2016-05-31 18:49:12 -03:00
parent b3b31288e6
commit 496b8a998e
4 changed files with 32 additions and 12 deletions

View file

@ -1,5 +1,5 @@
<div data-test-subj="discoverNoResults">
<div class="col-md-10 col-md-offset-1">
<div>
<div class="col-md-10 col-md-offset-1" data-test-subj="discoverNoResults">
<h1>No results found <i aria-hidden="true" class="fa fa-meh-o"></i></h1>
@ -20,7 +20,7 @@
<div ng-show="opts.timefield">
<p>
<h3>Expand your time range</h3>
<p>I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the <a class="btn btn-xs navbtn" ng-click="configTemplate.toggle('filter')" aria-expanded="configTemplate.is('filter')" aria-label="time picker" data-test-subj="discoverNoResultsTimefilter"><i aria-hidden="true" class="fa fa-clock-o"></i> time picker</a> button in the top right corner of your screen.
<p>I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the <a class="btn btn-xs navbtn" ng-click="kbnTopNav.toggle('filter')" aria-expanded="kbnTopNav.is('filter')" aria-label="time picker" data-test-subj="discoverNoResultsTimefilter"><i aria-hidden="true" class="fa fa-clock-o"></i> time picker</a> button in the top right corner of your screen.
</p>
</div>

View file

@ -244,7 +244,8 @@ import {
bdd.it('should not show "no results"', () => {
return discoverPage.hasNoResults().then(visible => {
expect(visible).to.be(false);
});
})
.catch(common.handleError(this));
});
function verifyChartData(expectedBarChartData) {
@ -303,17 +304,36 @@ import {
});
bdd.it('should open and close the time picker', () => {
return isTimepickerOpen(false)
.click()
.then(() => isTimepickerOpen(true))
.click()
.then(() => isTimepickerOpen(false))
.catch(common.handleError(this));
let i = 0;
return closeTimepicker() // close
.then(() => isTimepickerOpen(false)
.then(el => el.click()) // open
.then(() => isTimepickerOpen(true))
.then(el => el.click()) // close
.then(() => isTimepickerOpen(false))
.catch(common.handleError(this))
);
function closeTimepicker() {
return headerPage.isTimepickerOpen().then(shown => {
if (!shown) {
return;
}
return discoverPage
.getNoResultsTimepicker()
.click(); // close
});
}
function isTimepickerOpen(expected) {
return headerPage.isTimepickerOpen().then(shown => {
common.debug(`expect (#${++i}) timepicker to be ${peek(expected)} (is ${peek(shown)}).`);
expect(shown).to.be(expected);
return discoverPage.getNoResultsTimepicker();
function peek(state) {
return state ? 'open' : 'closed';
}
});
}
});

View file

@ -215,7 +215,7 @@ export default (function () {
hasNoResults: function hasNoResults() {
return common
.findTestSubject('discoverNoResult')
.findTestSubject('discoverNoResults')
.then(() => true)
.catch(() => false);
},

View file

@ -50,7 +50,7 @@ export default (function () {
isTimepickerOpen: function isTimepickerOpen() {
return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByClassName('config')
.findDisplayedByCssSelector('.kbn-timepicker')
.then(() => true)
.catch(() => false);
},