From f06a4787554fcfb984c7825d30c5f3554a0d2dd9 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Mon, 16 Dec 2024 12:08:33 -0800 Subject: [PATCH] Add missing data-test-subj tags for discover plugin (#9049) * Add data-test-subj for discover Signed-off-by: Anan Zhuang * fix comment Signed-off-by: Anan Zhuang --------- Signed-off-by: Anan Zhuang --- .../public/application/components/chart/chart.tsx | 13 ++++++++++--- .../components/chart/histogram/histogram.tsx | 1 + .../components/chart/hits_counter/hits_counter.tsx | 1 + .../data_grid/data_grid_table_cell_value.test.tsx | 1 + .../data_grid/data_grid_table_cell_value.tsx | 5 ++++- .../default_discover_table/pagination.tsx | 7 ++++++- .../default_discover_table/table_cell.tsx | 3 ++- .../components/default_discover_table/table_row.tsx | 12 ++++++++++-- .../__snapshots__/doc_viewer.test.tsx.snap | 1 + .../components/doc_viewer/doc_viewer.tsx | 2 +- .../components/doc_views/context_app.tsx | 2 +- .../components/doc_views/single_doc_app.tsx | 2 +- .../components/doc_views/surrounding_docs_view.tsx | 4 ++-- .../components/loading_spinner/loading_spinner.tsx | 8 +++++++- .../components/no_results/no_results.tsx | 5 ++++- .../components/sidebar/discover_field.tsx | 8 +++++++- .../components/sidebar/discover_field_bucket.tsx | 7 ++++++- .../sidebar/discover_field_data_frame.tsx | 2 ++ .../components/sidebar/discover_field_search.tsx | 5 ++++- .../components/sidebar/discover_sidebar.tsx | 1 + .../public/application/components/table/table.tsx | 2 +- .../application/components/table/table_row.tsx | 4 ++-- .../application/view_components/canvas/index.tsx | 8 +++++++- .../embeddable/search_embeddable_component.tsx | 6 +++++- 24 files changed, 87 insertions(+), 23 deletions(-) diff --git a/src/plugins/discover/public/application/components/chart/chart.tsx b/src/plugins/discover/public/application/components/chart/chart.tsx index 95beacc239c6..341eec05b81f 100644 --- a/src/plugins/discover/public/application/components/chart/chart.tsx +++ b/src/plugins/discover/public/application/components/chart/chart.tsx @@ -72,7 +72,7 @@ export const DiscoverChart = ({ const [isCollapsed, setIsCollapsed] = useState(false); const hitsCounter = ( -
+
0 ? hits : 0} showResetButton={showResetButton} @@ -82,7 +82,7 @@ export const DiscoverChart = ({ ); const timeChartHeader = ( -
+
+ {toggle} {hitsCounter} @@ -138,6 +143,7 @@ export const DiscoverChart = ({ direction="column" gutterSize="none" className={isEnhancementsEnabled ? 'dscChart__wrapper' : ''} + data-test-subj="dscChartWrapper" > {isEnhancementsEnabled ? queryEnhancedHistogramHeader : histogramHeader} {isTimeBased && chartData && showHistogram && ( @@ -147,6 +153,7 @@ export const DiscoverChart = ({ defaultMessage: 'Histogram of found documents', })} className="dscTimechart" + data-test-subj="dscTimechart" >
diff --git a/src/plugins/discover/public/application/components/chart/hits_counter/hits_counter.tsx b/src/plugins/discover/public/application/components/chart/hits_counter/hits_counter.tsx index 28fd96169a58..6b96dd33f444 100644 --- a/src/plugins/discover/public/application/components/chart/hits_counter/hits_counter.tsx +++ b/src/plugins/discover/public/application/components/chart/hits_counter/hits_counter.tsx @@ -55,6 +55,7 @@ export function HitsCounter({ hits, showResetButton, onResetQuery }: HitsCounter { > order_date: diff --git a/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx b/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx index 210f8d1674bc..f6a92c98a73c 100644 --- a/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx +++ b/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx @@ -36,7 +36,10 @@ export function fetchSourceTypeDataCell( {keys.map((key, index) => ( - + {key + ':'} { return ( - + {endItem >= sampleSize && ( diff --git a/src/plugins/discover/public/application/components/default_discover_table/table_cell.tsx b/src/plugins/discover/public/application/components/default_discover_table/table_cell.tsx index 7d5b5682a726..9b781bcbe192 100644 --- a/src/plugins/discover/public/application/components/default_discover_table/table_cell.tsx +++ b/src/plugins/discover/public/application/components/default_discover_table/table_cell.tsx @@ -36,10 +36,11 @@ const TableCellUI = ({ <> - + - + - + diff --git a/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap b/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap index 40cbee8e114a..4010797f3e44 100644 --- a/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap +++ b/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap @@ -3,6 +3,7 @@ exports[`Render with 3 different tabs 1`] = `
+
); diff --git a/src/plugins/discover/public/application/components/doc_views/context_app.tsx b/src/plugins/discover/public/application/components/doc_views/context_app.tsx index da06db6417b6..746d637019f5 100644 --- a/src/plugins/discover/public/application/components/doc_views/context_app.tsx +++ b/src/plugins/discover/public/application/components/doc_views/context_app.tsx @@ -88,7 +88,7 @@ export function ContextApp({ onChangeCount={onChangeCount} type={SurrDocType.PREDECESSORS} /> -
+
+
- - + + {contextAppMemoized} diff --git a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx index dc12ba4581fc..b662785a2a33 100644 --- a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx +++ b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx @@ -35,7 +35,13 @@ import { FormattedMessage } from '@osd/i18n/react'; export function LoadingSpinner() { return ( - + } title={ diff --git a/src/plugins/discover/public/application/components/no_results/no_results.tsx b/src/plugins/discover/public/application/components/no_results/no_results.tsx index 24a4b80c7204..fc8c1d0fd806 100644 --- a/src/plugins/discover/public/application/components/no_results/no_results.tsx +++ b/src/plugins/discover/public/application/components/no_results/no_results.tsx @@ -301,7 +301,10 @@ export const DiscoverNoResults = ({ queryString, query, savedQuery, timeFieldNam } /> {tabs.length && ( -
+
)} diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx index f2048e8ade1d..b7b7ec050e40 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx @@ -198,7 +198,13 @@ export const DiscoverField = ({ } return ( - + - + {bucket.display === '' ? emptyTxt : bucket.display} diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_data_frame.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_data_frame.tsx index 26260635a303..c700c4a29a58 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field_data_frame.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_data_frame.tsx @@ -21,6 +21,7 @@ export function DiscoverFieldDataFrame({ onCreateIndexPattern, onNormalizeIndexP onClick={onNormalizeIndexPattern} size="xs" className="dscSideBar_normalizeIndexPattern" + data-test-subj="dscSideBarNormalizeIndexPatternButton" > {i18n.translate('discover.fieldChooser.dataFrame.normalizeIndexPattern', { defaultMessage: 'Normalize', @@ -33,6 +34,7 @@ export function DiscoverFieldDataFrame({ onCreateIndexPattern, onNormalizeIndexP onClick={onCreateIndexPattern} size="xs" className="dscSideBar_createIndexPattern" + data-test-subj="dscSideBarCreateIndexPatternButton" > {i18n.translate('discover.fieldChooser.dataFrame.createIndexPattern', { defaultMessage: 'Create index pattern', diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx index c93352d43589..e2fee970f2e3 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx @@ -315,7 +315,10 @@ export function DiscoverFieldSearch({ if (isEnhancementsEnabledOverride) { return ( -
+
{compressedFieldSearch} {fieldPopover}
diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index bc55a3fe4a7d..a9c4bf01eaf5 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -312,6 +312,7 @@ const FieldList = ({ onClick={() => setExpanded(!expanded)} size="xs" className="dscSideBar_fieldGroup" + data-test-subj="dscSideBarFieldGroupButton" aria-label={title} isLoading={!!selectedIndexPattern.fieldsLoading} > diff --git a/src/plugins/discover/public/application/components/table/table.tsx b/src/plugins/discover/public/application/components/table/table.tsx index 3ef8e026702e..62161444a1f2 100644 --- a/src/plugins/discover/public/application/components/table/table.tsx +++ b/src/plugins/discover/public/application/components/table/table.tsx @@ -56,7 +56,7 @@ export function DocViewTable({ } return ( - +
{Object.keys(flattened) .sort() diff --git a/src/plugins/discover/public/application/components/table/table_row.tsx b/src/plugins/discover/public/application/components/table/table_row.tsx index c59210338586..67449aa6338d 100644 --- a/src/plugins/discover/public/application/components/table/table_row.tsx +++ b/src/plugins/discover/public/application/components/table/table_row.tsx @@ -81,7 +81,7 @@ export function DocViewTableRow({ return ( {typeof onFilter === 'function' && ( - )} -
+ onFilter(fieldMapping, valueRaw, '+')} @@ -100,7 +100,7 @@ export function DocViewTableRow({ /> + ) : ( - + diff --git a/src/plugins/discover/public/embeddable/search_embeddable_component.tsx b/src/plugins/discover/public/embeddable/search_embeddable_component.tsx index ecf0f1bc2b30..858791ae11a8 100644 --- a/src/plugins/discover/public/embeddable/search_embeddable_component.tsx +++ b/src/plugins/discover/public/embeddable/search_embeddable_component.tsx @@ -58,7 +58,11 @@ export function SearchEmbeddableComponent({ searchProps }: SearchEmbeddableProps className="eui-xScrollWithShadows eui-yScrollWithShadows" > {discoverEmbeddableProps.hits !== 0 ? ( - + ) : (