Skip to content

Commit

Permalink
[ML] Fix data-test-subj.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Oct 1, 2020
1 parent 819cf7d commit 486511a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface ExpandableSectionProps {
content: ReactNode;
headerItems?: HeaderItem[] | 'loading';
isExpanded?: boolean;
dataTestId: string;
title: ReactNode;
}

Expand All @@ -44,6 +45,7 @@ export const ExpandableSection: FC<ExpandableSectionProps> = ({
// callback.
isExpanded: isExpandedDefault = true,
content,
dataTestId,
title,
}) => {
const [isExpanded, setIsExpanded] = useState(isExpandedDefault);
Expand All @@ -52,7 +54,7 @@ export const ExpandableSection: FC<ExpandableSectionProps> = ({
};

return (
<EuiPanel paddingSize="none" data-test-subj="mlDFAnalyticsOutlierExplorationTablePanel">
<EuiPanel paddingSize="none" data-test-subj={`mlDFExpandableSection-${dataTestId}`}>
<div className="mlExpandableSection">
<EuiButtonEmpty
onClick={toggleExpanded}
Expand All @@ -67,7 +69,11 @@ export const ExpandableSection: FC<ExpandableSectionProps> = ({
{isHeaderItems(headerItems) && (
<EuiFlexGroup>
{headerItems.map(({ label, value, id }) => (
<EuiFlexItem grow={false} key={id}>
<EuiFlexItem
grow={false}
key={id}
data-test-subj={`mlDFExpandableSectionItem-${dataTestId}-${id}`}
>
{label !== undefined && value !== undefined && (
<>
<EuiText size="xs" color="subdued">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export const OutlierExploration: FC<ExplorationProps> = React.memo(({ jobId }) =
)}

<ExpandableSection
dataTestId="analysis"
content={analyticsSectionContent}
headerItems={analyticsSectionHeaderItems}
isExpanded={false}
Expand All @@ -249,6 +250,7 @@ export const OutlierExploration: FC<ExplorationProps> = React.memo(({ jobId }) =
<EuiSpacer size="m" />

<ExpandableSection
dataTestId="results"
content={resultsSectionContent}
headerItems={resultsSectionHeaderItems}
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function MachineLearningDataFrameAnalyticsResultsProvider({
},

async assertOutlierTablePanelExists() {
await testSubjects.existOrFail('mlDFAnalyticsOutlierExplorationTablePanel');
await testSubjects.existOrFail('mlDFExpandableSection-results');
},

async assertResultsTableExists() {
Expand Down

0 comments on commit 486511a

Please sign in to comment.