diff --git a/public/components/ContentPanel/ContentPanel.tsx b/public/components/ContentPanel/ContentPanel.tsx index 3be303b9..466ee02e 100644 --- a/public/components/ContentPanel/ContentPanel.tsx +++ b/public/components/ContentPanel/ContentPanel.tsx @@ -20,7 +20,7 @@ import { EuiTitle, EuiSpacer, } from '@elastic/eui'; -import { isEmpty } from 'lodash'; +import { isEmpty, get } from 'lodash'; type ContentPanelProps = { // keep title string part for backwards compatibility @@ -39,96 +39,109 @@ type ContentPanelProps = { children: React.ReactNode | React.ReactNode[]; contentPanelClassName?: string; hideBody?: boolean; + titleDataTestSubj?: string; }; -const ContentPanel = (props: ContentPanelProps) => ( - - { + const titleDataTestSubj = get( + props, + 'titleDataTestSubj', + 'contentPanelTitle' + ); + return ( + - - {typeof props.title === 'string' ? ( - -

{props.title}

-
- ) : ( - - {Array.isArray(props.title) ? ( - props.title.map( - (titleComponent: React.ReactNode, idx: number) => ( - - {titleComponent} + + + {typeof props.title === 'string' ? ( + +

{props.title}

+
+ ) : ( + + {Array.isArray(props.title) ? ( + props.title.map( + (titleComponent: React.ReactNode, idx: number) => ( + + {titleComponent} + + ) + ) + ) : ( + {props.title} + )} + + )} + + {Array.isArray(props.subTitle) ? ( + props.subTitle.map( + (subTitleComponent: React.ReactNode, idx: number) => ( + + {subTitleComponent} ) ) ) : ( - {props.title} + + {props.subTitle} + )} - )} - - {Array.isArray(props.subTitle) ? ( - props.subTitle.map( - (subTitleComponent: React.ReactNode, idx: number) => ( - - {subTitleComponent} - - ) - ) - ) : ( - - {props.subTitle} - - )} - -
+
- - - {Array.isArray(props.actions) ? ( - props.actions.map((action: React.ReactNode, idx: number) => ( - {action} - )) - ) : ( - {props.actions} - )} - - -
- {!isEmpty(props.actions) ? : null} - {props.title != '' && props.hideBody !== true ? ( -
- -
- {props.children} + + + {Array.isArray(props.actions) ? ( + props.actions.map((action: React.ReactNode, idx: number) => ( + {action} + )) + ) : ( + {props.actions} + )} + + + + {!isEmpty(props.actions) ? : null} + {props.title != '' && props.hideBody !== true ? ( +
+ +
+ {props.children} +
-
- ) : null} - -); + ) : null} + + ); +}; export default ContentPanel; diff --git a/public/components/ContentPanel/__snapshots__/ContentPanel.test.tsx.snap b/public/components/ContentPanel/__snapshots__/ContentPanel.test.tsx.snap index 05498d81..f83c028e 100644 --- a/public/components/ContentPanel/__snapshots__/ContentPanel.test.tsx.snap +++ b/public/components/ContentPanel/__snapshots__/ContentPanel.test.tsx.snap @@ -14,6 +14,7 @@ exports[` spec renders the component 1`] = ` >

Testing

diff --git a/public/pages/AnomalyCharts/components/FeatureChart/FeatureChart.tsx b/public/pages/AnomalyCharts/components/FeatureChart/FeatureChart.tsx index 12a6a932..1c4c46f8 100644 --- a/public/pages/AnomalyCharts/components/FeatureChart/FeatureChart.tsx +++ b/public/pages/AnomalyCharts/components/FeatureChart/FeatureChart.tsx @@ -156,6 +156,7 @@ export const FeatureChart = (props: FeatureChartProps) => { ? props.feature.featureName : `${props.feature.featureName} (disabled)` } + titleDataTestSubj="featureNameHeader" bodyStyles={ !props.feature.featureEnabled ? { backgroundColor: getDisabledChartBackground() } diff --git a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx index 32e2ceb1..d6dc9c91 100644 --- a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx @@ -357,6 +357,7 @@ export const AnomalyDetailsChart = React.memo( { error={getError(field.name, form)} > spec Empty results renders component with aggre aria-expanded="false" aria-haspopup="listbox" class="euiComboBox" + data-test-subj="featureFieldTextInput-undefined" name="featureList.undefined.aggregationOf" role="combobox" > diff --git a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap index 93d55e83..39031bf0 100644 --- a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap +++ b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap @@ -18,6 +18,7 @@ exports[` spec renders the component when disabled 1`] = ` >
spec renders the component when enabled 1`] = ` >
{ error={getError(field.name, form)} > - +

{props.isEdit ? 'Edit model configuration' diff --git a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap index 6a8060b1..e837b26a 100644 --- a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap +++ b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap @@ -16,6 +16,7 @@ exports[` spec creating model configuration renders the compon >

Configure model @@ -65,6 +66,7 @@ exports[` spec creating model configuration renders the compon >

Features

@@ -229,6 +231,7 @@ exports[` spec creating model configuration renders the compon spec creating model configuration renders the compon aria-expanded="false" aria-haspopup="listbox" class="euiComboBox" + data-test-subj="featureFieldTextInput-0" name="featureList.0.aggregationOf" role="combobox" > @@ -576,6 +580,7 @@ exports[` spec creating model configuration renders the compon >
spec creating model configuration renders the compon >
spec creating model configuration renders the compon >

Sample anomalies

@@ -919,6 +926,7 @@ exports[` spec editing model configuration renders the compone >

Edit model configuration @@ -972,6 +980,7 @@ exports[` spec editing model configuration renders the compone >

Features

@@ -1145,6 +1154,7 @@ exports[` spec editing model configuration renders the compone spec editing model configuration renders the compone aria-expanded="false" aria-haspopup="listbox" class="euiComboBox" + data-test-subj="featureFieldTextInput-0" name="featureList.0.aggregationOf" role="combobox" > @@ -1507,6 +1518,7 @@ exports[` spec editing model configuration renders the compone >
spec editing model configuration renders the compone >
{ onClick={() => setIsFullScreen((isFullScreen) => !isFullScreen)} iconType={isFullScreen ? 'exit' : 'fullScreen'} aria-label="View full screen" + data-test-subj="dashboardFullScreenButton" > {isFullScreen ? 'Exit full screen' : 'View full screen'} @@ -217,7 +218,7 @@ export const AnomaliesLiveChart = (props: AnomaliesLiveChartProps) => { return ( +

Live anomalies{' '} diff --git a/public/pages/Dashboard/Components/AnomalousDetectorsList.tsx b/public/pages/Dashboard/Components/AnomalousDetectorsList.tsx index 35b1abe3..5f3d21b4 100644 --- a/public/pages/Dashboard/Components/AnomalousDetectorsList.tsx +++ b/public/pages/Dashboard/Components/AnomalousDetectorsList.tsx @@ -79,6 +79,7 @@ export const AnomalousDetectorsList = (props: AnomalousDetectorsListProps) => {
+ data-test-subj="dashboardDetectorTable" items={getOrderedDetectorsForPage( props.selectedDetectors, indexOfPage, diff --git a/public/pages/Dashboard/Components/EmptyDashboard/EmptyDashboard.tsx b/public/pages/Dashboard/Components/EmptyDashboard/EmptyDashboard.tsx index b7314408..f430b7a1 100644 --- a/public/pages/Dashboard/Components/EmptyDashboard/EmptyDashboard.tsx +++ b/public/pages/Dashboard/Components/EmptyDashboard/EmptyDashboard.tsx @@ -18,6 +18,7 @@ export class EmptyDashboard extends Component<{}, {}> { render() { return ( You have no detectors

} body={ diff --git a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap index 0d8fc2ba..ab71ba64 100644 --- a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap +++ b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap @@ -3,6 +3,7 @@ exports[` spec Empty results renders component with empty message 1`] = `
spec renders the component 1`] = ` >

Detector details

@@ -88,6 +89,7 @@ exports[` spec renders the component 1`] = ` spec renders the component 1`] = ` >