Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timepicker button behavior in "No Results" page for timeseries data #6543

Merged
merged 9 commits into from
Jun 2, 2016
Prev Previous commit
[test] Fix test fixtures.
  • Loading branch information
bevacqua committed May 31, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 496b8a998eb1a9e37d199066d0cc17bd6ffe9e91
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>

@@ -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>

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

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

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