Skip to content

Commit

Permalink
[test] Fix test fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
bevacqua committed May 31, 2016
1 parent b3b3128 commit 496b8a9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/plugins/kibana/public/discover/partials/no_results.html
Original file line number Diff line number Diff line change
@@ -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>

Expand All @@ -20,7 +20,7 @@ <h3>Shard Failures</h3>
<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>

Expand Down
34 changes: 27 additions & 7 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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';
}
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/support/pages/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export default (function () {

hasNoResults: function hasNoResults() {
return common
.findTestSubject('discoverNoResult')
.findTestSubject('discoverNoResults')
.then(() => true)
.catch(() => false);
},
Expand Down
2 changes: 1 addition & 1 deletion test/support/pages/header_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default (function () {

isTimepickerOpen: function isTimepickerOpen() {
return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByClassName('config')
.findDisplayedByCssSelector('.kbn-timepicker')
.then(() => true)
.catch(() => false);
},
Expand Down

0 comments on commit 496b8a9

Please sign in to comment.