Skip to content

Commit

Permalink
[Sample data] Use Lens in flights dashboard (#104780)
Browse files Browse the repository at this point in the history
* [Sample data] Use Lens in flights sample data

* Fix test issues

* Fix functional tests

* Fix a11y test names

* Fix tests again

* Fix test

* Update from comments

* Fix sizing from feedback

* Fix typo

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Wylie Conlon and kibanamachine authored Jul 16, 2021
1 parent 26c3362 commit 8ad443a
Show file tree
Hide file tree
Showing 13 changed files with 363 additions and 538 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,16 @@ export class SampleDataRegistry {
reference.type = embeddableType;
reference.id = embeddableId;

const referenceName = reference.name.includes(':')
? reference.name.split(':')[1]
: reference.name;

const panels = JSON.parse(dashboard.attributes.panelsJSON);
const panel = panels.find((panelItem: any) => {
return panelItem.panelRefName === reference.name;
return panelItem.panelRefName === referenceName;
});
if (!panel) {
throw new Error(`Unable to find panel for reference: ${reference.name}`);
throw new Error(`Unable to find panel for reference: ${referenceName}`);
}
panel.embeddableConfig = embeddableConfig;
dashboard.attributes.panelsJSON = JSON.stringify(panels);
Expand Down
2 changes: 1 addition & 1 deletion test/accessibility/apps/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Add one more saved object to cancel it', async () => {
await testSubjects.click('savedObjectTitle[Flights]-Average-Ticket-Price');
await testSubjects.click('savedObjectTitle[Flights]-Destination-Weather');
await a11y.testAppSnapshot();
});

Expand Down
7 changes: 3 additions & 4 deletions test/accessibility/apps/dashboard_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('dashboard panel open ', async () => {
const header = await dashboardPanelActions.getPanelHeading('[Flights] Airline Carrier');
const header = await dashboardPanelActions.getPanelHeading('[Flights] Flight count');
await dashboardPanelActions.toggleContextMenu(header);
await a11y.testAppSnapshot();
// doing this again will close the Context Menu, so that next snapshot can start clean.
await dashboardPanelActions.toggleContextMenu(header);
});

it('dashboard panel inspect', async () => {
await dashboardPanelActions.openInspectorByTitle('[Flights] Airline Carrier');
await dashboardPanelActions.openInspectorByTitle('[Flights] Flight count');
await a11y.testAppSnapshot();
});

Expand All @@ -61,9 +61,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('dashboard panel full screen', async () => {
const header = await dashboardPanelActions.getPanelHeading('[Flights] Airline Carrier');
const header = await dashboardPanelActions.getPanelHeading('[Flights] Flight count');
await dashboardPanelActions.toggleContextMenu(header);
await dashboardPanelActions.clickContextMenuMoreItem();

await testSubjects.click('embeddablePanelAction-togglePanel');
await a11y.testAppSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/home/sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function ({ getService }: FtrProviderContext) {

expect(resp.body).to.eql({
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13059 },
kibanaSavedObjectsLoaded: 23,
kibanaSavedObjectsLoaded: 11,
});
});

Expand Down
13 changes: 5 additions & 8 deletions test/functional/apps/home/_sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const find = getService('find');
const log = getService('log');
const security = getService('security');
const pieChart = getService('pieChart');
const elasticChart = getService('elasticChart');
const renderable = getService('renderable');
const dashboardExpect = getService('dashboardExpect');
const PageObjects = getPageObjects(['common', 'header', 'home', 'dashboard', 'timePicker']);
Expand Down Expand Up @@ -89,26 +89,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const toTime = `${todayYearMonthDay} @ 23:59:59.999`;
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.be(18);
expect(panelCount).to.be(17);
});

it('should render visualizations', async () => {
await PageObjects.home.launchSampleDashboard('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
log.debug('Checking pie charts rendered');
await pieChart.expectPieSliceCount(4);
log.debug('Checking area, bar and heatmap charts rendered');
await dashboardExpect.seriesElementCount(15);
log.debug('Checking charts rendered');
await elasticChart.waitForRenderComplete('lnsVisualizationContainer');
log.debug('Checking saved searches rendered');
await dashboardExpect.savedSearchRowCount(10);
log.debug('Checking input controls rendered');
await dashboardExpect.inputControlItemCount(3);
log.debug('Checking tag cloud rendered');
await dashboardExpect.tagCloudWithValuesFound(['Sunny', 'Rain', 'Clear', 'Cloudy', 'Hail']);
log.debug('Checking vega chart rendered');
const tsvb = await find.existsByCssSelector('.vgaVis__view');
expect(tsvb).to.be(true);
expect(await find.existsByCssSelector('.vgaVis__view')).to.be(true);
});

it('should launch sample logs data set dashboard', async () => {
Expand Down
Loading

0 comments on commit 8ad443a

Please sign in to comment.