Show pagination on saved searches in dashboard read mode. (#26224) (#26429)

This commit is contained in:
Luke Elmers 2018-11-29 11:13:21 -07:00 committed by GitHub
parent f00d37fcc5
commit f8651a8077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View file

@ -1,3 +1,3 @@
<div class="kuiToolBarText">
<div class="kuiToolBarText" data-test-subj="toolBarPagerText">
{{ toolBarPagerText.startItem | number }}&ndash;{{ toolBarPagerText.endItem | number }} of {{ toolBarPagerText.totalItems | number }}
</div>

View file

@ -182,6 +182,19 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
}
}
/**
* Asserts that the toolbar pagination (count and arrows) is either displayed or not displayed.
* @param { displayed: boolean }
*/
async expectToolbarPaginationDisplayed({ displayed }) {
const subjects = ['btnPrevPage', 'btnNextPage', 'toolBarPagerText'];
if (displayed) {
return await Promise.all(subjects.map(async subj => await testSubjects.existOrFail(subj)));
} else {
return await Promise.all(subjects.map(async subj => await testSubjects.missingOrFail(subj)));
}
}
async switchToEditMode() {
log.debug('Switching to edit mode');
await testSubjects.click('dashboardEditMode');

View file

@ -36,6 +36,7 @@ import 'ui/agg_response';
import 'ui/agg_types';
import 'ui/timepicker';
import 'ui/pager';
import 'ui/pager_control';
import 'leaflet';
import { showAppRedirectNotification } from 'ui/notify';

View file

@ -13,14 +13,18 @@ export default function ({ getService, getPageObjects }) {
const log = getService('log');
const find = getService('find');
const testSubjects = getService('testSubjects');
const dashboardAddPanel = getService('dashboardAddPanel');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects([
'security',
'common',
'discover',
'dashboard',
'header',
'settings']);
'settings',
]);
const dashboardName = 'Dashboard View Mode Test Dashboard';
const savedSearchName = 'Saved search for dashboard';
describe('Dashboard View Mode', () => {
@ -35,9 +39,14 @@ export default function ({ getService, getPageObjects }) {
await kibanaServer.uiSettings.disableToastAutohide();
remote.setWindowSize(1600, 1000);
await PageObjects.common.navigateToApp('discover');
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
await PageObjects.discover.saveSearch(savedSearchName);
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.addVisualizations(PageObjects.dashboard.getTestVisualizationNames());
await dashboardAddPanel.addSavedSearch(savedSearchName);
await PageObjects.dashboard.saveDashboard(dashboardName);
});
@ -175,6 +184,10 @@ export default function ({ getService, getPageObjects }) {
expect(timePickerExists).to.be(true);
});
it('can paginate on a saved search', async () => {
await PageObjects.dashboard.expectToolbarPaginationDisplayed({ displayed: true });
});
it('is loaded for a user who is assigned a non-dashboard mode role', async () => {
await PageObjects.security.logout();
await PageObjects.security.login('mixeduser', '123456');
@ -190,6 +203,7 @@ export default function ({ getService, getPageObjects }) {
const managementAppExists = await find.existsByLinkText('Management');
expect(managementAppExists).to.be(true);
});
});
});
}