From afaff1b7991ad2863b01d2316c5e559247d8d525 Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Tue, 1 May 2018 09:12:36 -0400 Subject: [PATCH] Expand coverage of dashboard tests (#17703) * Expand coverage of dashboard tests and decrease time * Fix timing error when sub urls fail to save from too fast app link clicking * discover doesn't have breadcrumbs * Check top nav text so it works on both listing and saved object edit/view pages * need to do the add panel operations one at a time * Need both types of input in filter * Give test data a title * Remove incorrect and unnecessary comment * Move data around and get rid of 6_3 specific naming as we will end up migrating the data as we progress * Remove code accidentally checked in --- .../dashboard_panel.test.js.snap | 9 +- .../dashboard/panel/dashboard_panel.test.js | 3 + .../panel/panel_header/panel_header.js | 2 +- .../public/dashboard/top_nav/add_panel.html | 2 +- .../metrics/public/components/no_data.js | 2 +- .../components/vis_types/markdown/vis.js | 2 +- .../visualizations/components/metric.js | 8 +- .../public/visualizations/components/top_n.js | 2 +- .../lib/create_legend_series.js | 1 + .../public/tag_cloud_visualization.js | 1 + .../public/filter_editor/filter_editor.html | 1 + src/ui/public/flot-charts/jquery.flot.js | 8 +- src/ui/public/partials/paginate_controls.html | 2 + .../dashboard/_create_and_add_embeddables.js | 46 ++ test/functional/apps/dashboard/_dashboard.js | 266 -------- .../apps/dashboard/_dashboard_filter_bar.js | 115 +++- .../apps/dashboard/_dashboard_filtering.js | 198 ++++++ .../apps/dashboard/_dashboard_grid.js | 42 +- .../apps/dashboard/_dashboard_options.js | 32 + .../apps/dashboard/_dashboard_queries.js | 152 ----- .../apps/dashboard/_dashboard_state.js | 20 +- .../apps/dashboard/_dashboard_time.js | 8 +- ...tributes.js => _data_shared_attributes.js} | 64 +- test/functional/apps/dashboard/_embed_mode.js | 41 ++ .../apps/dashboard/_embeddable_rendering.js | 119 ++++ .../apps/dashboard/_full_screen_mode.js | 60 ++ .../apps/dashboard/_panel_controls.js | 5 +- .../apps/dashboard/_panel_expand_toggle.js | 67 ++ test/functional/apps/dashboard/_view_edit.js | 9 +- test/functional/apps/dashboard/index.js | 68 +- .../functional/apps/dashboard/set_up_tests.js | 0 test/functional/config.js | 4 + .../dashboard/current/data/data.json.gz | Bin 0 -> 8917117 bytes .../dashboard/current/data/mappings.json | 617 ++++++++++++++++++ .../dashboard/current/kibana/data.json.gz | Bin 0 -> 15273 bytes .../dashboard/current/kibana/mappings.json | 274 ++++++++ .../dashboard/{ => legacy}/data.json.gz | Bin .../dashboard/{ => legacy}/mappings.json | 0 test/functional/page_objects/common_page.js | 4 + .../functional/page_objects/dashboard_page.js | 168 ++--- test/functional/page_objects/header_page.js | 11 + .../functional/page_objects/visualize_page.js | 13 +- .../services/dashboard/add_panel.js | 144 ++++ .../services/dashboard/expectations.js | 173 ++++- test/functional/services/dashboard/index.js | 1 + .../services/dashboard/visualizations.js | 11 +- test/functional/services/filter_bar.js | 11 +- test/functional/services/index.js | 2 + test/functional/services/test_subjects.js | 4 +- .../services/visualize_listing_table.js | 36 + 50 files changed, 2167 insertions(+), 661 deletions(-) create mode 100644 test/functional/apps/dashboard/_create_and_add_embeddables.js delete mode 100644 test/functional/apps/dashboard/_dashboard.js create mode 100644 test/functional/apps/dashboard/_dashboard_filtering.js create mode 100644 test/functional/apps/dashboard/_dashboard_options.js delete mode 100644 test/functional/apps/dashboard/_dashboard_queries.js rename test/functional/apps/dashboard/{_dashboard_shared_attributes.js => _data_shared_attributes.js} (50%) create mode 100644 test/functional/apps/dashboard/_embed_mode.js create mode 100644 test/functional/apps/dashboard/_embeddable_rendering.js create mode 100644 test/functional/apps/dashboard/_full_screen_mode.js create mode 100644 test/functional/apps/dashboard/_panel_expand_toggle.js delete mode 100644 test/functional/apps/dashboard/set_up_tests.js create mode 100644 test/functional/fixtures/es_archiver/dashboard/current/data/data.json.gz create mode 100644 test/functional/fixtures/es_archiver/dashboard/current/data/mappings.json create mode 100644 test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json.gz create mode 100644 test/functional/fixtures/es_archiver/dashboard/current/kibana/mappings.json rename test/functional/fixtures/es_archiver/dashboard/{ => legacy}/data.json.gz (100%) rename test/functional/fixtures/es_archiver/dashboard/{ => legacy}/mappings.json (100%) create mode 100644 test/functional/services/dashboard/add_panel.js create mode 100644 test/functional/services/visualize_listing_table.js diff --git a/src/core_plugins/kibana/public/dashboard/panel/__snapshots__/dashboard_panel.test.js.snap b/src/core_plugins/kibana/public/dashboard/panel/__snapshots__/dashboard_panel.test.js.snap index 67e0af5a90ecc..9f60aa5bc8f1c 100644 --- a/src/core_plugins/kibana/public/dashboard/panel/__snapshots__/dashboard_panel.test.js.snap +++ b/src/core_plugins/kibana/public/dashboard/panel/__snapshots__/dashboard_panel.test.js.snap @@ -10,13 +10,16 @@ exports[`DashboardPanel matches snapshot 1`] = ` >
+ title="my embeddable title" + > + my embeddable title +
diff --git a/src/core_plugins/kibana/public/dashboard/panel/dashboard_panel.test.js b/src/core_plugins/kibana/public/dashboard/panel/dashboard_panel.test.js index c0f363181881c..787c688a0ac16 100644 --- a/src/core_plugins/kibana/public/dashboard/panel/dashboard_panel.test.js +++ b/src/core_plugins/kibana/public/dashboard/panel/dashboard_panel.test.js @@ -11,6 +11,7 @@ import { updateViewMode, setPanels, updateTimeRange, + embeddableIsInitialized, } from '../actions'; import { Provider } from 'react-redux'; @@ -37,6 +38,8 @@ beforeAll(() => { store.dispatch(updateTimeRange({ to: 'now', from: 'now-15m' })); store.dispatch(updateViewMode(DashboardViewMode.EDIT)); store.dispatch(setPanels({ 'foo1': { panelIndex: 'foo1' } })); + const metadata = { title: 'my embeddable title', editUrl: 'editme' }; + store.dispatch(embeddableIsInitialized({ metadata, panelId: 'foo1' })); }); test('DashboardPanel matches snapshot', () => { diff --git a/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header.js b/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header.js index b61f3b4a77688..593a523feab1c 100644 --- a/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header.js +++ b/src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header.js @@ -13,7 +13,7 @@ export function PanelHeader({ title, actions, isViewOnlyMode, hidePanelTitles }) } return ( -
+
-

+

Add Panels

diff --git a/src/core_plugins/metrics/public/components/no_data.js b/src/core_plugins/metrics/public/components/no_data.js index b7040b8c85f6b..6a7c1985f4c72 100644 --- a/src/core_plugins/metrics/public/components/no_data.js +++ b/src/core_plugins/metrics/public/components/no_data.js @@ -2,7 +2,7 @@ import React from 'react'; function NoDataComponent() { return ( -
+
No data to display for the selected metrics .
); diff --git a/src/core_plugins/metrics/public/components/vis_types/markdown/vis.js b/src/core_plugins/metrics/public/components/vis_types/markdown/vis.js index 81eebed3a1718..487d09fe4ab7c 100644 --- a/src/core_plugins/metrics/public/components/vis_types/markdown/vis.js +++ b/src/core_plugins/metrics/public/components/vis_types/markdown/vis.js @@ -34,7 +34,7 @@ function MarkdownVisualization(props) { if (reversed) className += ' reversed'; const markdownError = markdownSource instanceof Error ? markdownSource : null; markdown = ( -
+
{markdownError && }
diff --git a/src/core_plugins/metrics/public/visualizations/components/metric.js b/src/core_plugins/metrics/public/visualizations/components/metric.js index eead38f5303b7..0194ecda447f7 100644 --- a/src/core_plugins/metrics/public/visualizations/components/metric.js +++ b/src/core_plugins/metrics/public/visualizations/components/metric.js @@ -135,7 +135,13 @@ class Metric extends Component {
this.inner = el} className="rhythm_metric__inner" style={styles.inner}>
{ primaryLabel } -
{ primaryValue }
+
+ { primaryValue } +
{ secondarySnippet } {additionalLabel} diff --git a/src/core_plugins/metrics/public/visualizations/components/top_n.js b/src/core_plugins/metrics/public/visualizations/components/top_n.js index a1c3ebd6bfedc..abe10949314e6 100644 --- a/src/core_plugins/metrics/public/visualizations/components/top_n.js +++ b/src/core_plugins/metrics/public/visualizations/components/top_n.js @@ -47,7 +47,7 @@ class TopN extends Component { style={styles.innerBar} /> - { value } + { value } ); }; diff --git a/src/core_plugins/metrics/public/visualizations/lib/create_legend_series.js b/src/core_plugins/metrics/public/visualizations/lib/create_legend_series.js index 5f3beb38f9335..a8cf51f4c834c 100644 --- a/src/core_plugins/metrics/public/visualizations/lib/create_legend_series.js +++ b/src/core_plugins/metrics/public/visualizations/lib/create_legend_series.js @@ -17,6 +17,7 @@ export default props => (row, i) => {