Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export const Exploration: FC<Props> = React.memo(({ jobId, jobStatus }) => {
const MlInMemoryTableBasic = mlInMemoryTableBasicFactory<TableItem>();

return (
<EuiPanel grow={false}>
<EuiPanel grow={false} data-test-subj="mlDFAnalyticsOutlierExplorationTablePanel">
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" responsive={false}>
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
}, [JSON.stringify(searchQuery)]);

return (
<EuiPanel>
<EuiPanel data-test-subj="mlDFAnalyticsRegressionExplorationEvaluatePanel">
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiTitle size="xs">
Expand Down Expand Up @@ -296,13 +296,15 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
<Fragment>
<EuiFlexItem>
<EvaluateStat
dataTestSubj={'mlDFAnalyticsRegressionGenMSEstat'}
isLoading={isLoadingGeneralization}
title={generalizationEval.meanSquaredError}
isMSE
/>
</EuiFlexItem>
<EuiFlexItem>
<EvaluateStat
dataTestSubj={'mlDFAnalyticsRegressionGenRSquaredStat'}
isLoading={isLoadingGeneralization}
title={generalizationEval.rSquared}
isMSE={false}
Expand Down Expand Up @@ -339,13 +341,15 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
<Fragment>
<EuiFlexItem>
<EvaluateStat
dataTestSubj={'mlDFAnalyticsRegressionTrainingMSEstat'}
isLoading={isLoadingTraining}
title={trainingEval.meanSquaredError}
isMSE
/>
</EuiFlexItem>
<EuiFlexItem>
<EvaluateStat
dataTestSubj={'mlDFAnalyticsRegressionTrainingRSquaredStat'}
isLoading={isLoadingTraining}
title={trainingEval.rSquared}
isMSE={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Props {
isLoading: boolean;
title: number | string;
isMSE: boolean;
dataTestSubj: string;
}

const meanSquaredErrorText = i18n.translate(
Expand Down Expand Up @@ -41,8 +42,8 @@ const rSquaredTooltipContent = i18n.translate(
}
);

export const EvaluateStat: FC<Props> = ({ isLoading, isMSE, title }) => (
<EuiFlexGroup gutterSize="xs">
export const EvaluateStat: FC<Props> = ({ isLoading, isMSE, title, dataTestSubj }) => (
<EuiFlexGroup gutterSize="xs" data-test-subj={dataTestSubj}>
<EuiFlexItem grow={false}>
<EuiStat
reverse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export const ResultsTable: FC<Props> = React.memo(
: searchError;

return (
<EuiPanel grow={false}>
<EuiPanel grow={false} data-test-subj="mlDFAnalyticsRegressionExplorationTablePanel">
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" responsive={false}>
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const AnalyticsViewAction = {
aria-label={i18n.translate('xpack.ml.dataframe.analyticsList.viewAriaLabel', {
defaultMessage: 'View',
})}
data-test-sub="mlAnalyticsJobViewButton"
data-test-subj="mlAnalyticsJobViewButton"
>
{i18n.translate('xpack.ml.dataframe.analyticsList.viewActionName', {
defaultMessage: 'View',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function({ getService }: FtrProviderContext) {
suiteTitle: 'iowa house prices',
jobType: 'outlier_detection',
jobId: `ihp_1_${Date.now()}`,
jobDescription: 'This is the job description',
source: 'ihp_outlier',
get destinationIndex(): string {
return `dest_${this.jobId}`;
Expand Down Expand Up @@ -76,6 +77,11 @@ export default function({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.setJobId(testData.jobId);
});

it('inputs the job description', async () => {
await ml.dataFrameAnalyticsCreation.assertJobDescriptionInputExists();
await ml.dataFrameAnalyticsCreation.setJobDescription(testData.jobDescription);
});

it('selects the source index', async () => {
await ml.dataFrameAnalyticsCreation.assertSourceIndexInputExists();
await ml.dataFrameAnalyticsCreation.selectSourceIndex(testData.source);
Expand Down Expand Up @@ -151,6 +157,11 @@ export default function({ getService }: FtrProviderContext) {
await ml.api.assertIndicesExist(testData.destinationIndex);
await ml.api.assertIndicesNotEmpty(testData.destinationIndex);
});

it('displays the results view for created job', async () => {
await ml.dataFrameAnalyticsTable.openResultsView();
await ml.dataFrameAnalytics.assertOutlierTablePanelExists();
});
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function({ getService }: FtrProviderContext) {
suiteTitle: 'electrical grid stability',
jobType: 'regression',
jobId: `egs_1_${Date.now()}`,
jobDescription: 'This is the job description',
source: 'egs_regression',
get destinationIndex(): string {
return `dest_${this.jobId}`;
Expand Down Expand Up @@ -70,6 +71,11 @@ export default function({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.setJobId(testData.jobId);
});

it('inputs the job description', async () => {
await ml.dataFrameAnalyticsCreation.assertJobDescriptionInputExists();
await ml.dataFrameAnalyticsCreation.setJobDescription(testData.jobDescription);
});

it('selects the source index', async () => {
await ml.dataFrameAnalyticsCreation.assertSourceIndexInputExists();
await ml.dataFrameAnalyticsCreation.selectSourceIndex(testData.source);
Expand Down Expand Up @@ -155,6 +161,12 @@ export default function({ getService }: FtrProviderContext) {
await ml.api.assertIndicesExist(testData.destinationIndex);
await ml.api.assertIndicesNotEmpty(testData.destinationIndex);
});

it('displays the results view for created job', async () => {
await ml.dataFrameAnalyticsTable.openResultsView();
await ml.dataFrameAnalytics.assertRegressionEvaluatePanelElementsExists();
await ml.dataFrameAnalytics.assertRegressionTablePanelExists();
});
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ export function MachineLearningDataFrameAnalyticsProvider(
await testSubjects.existOrFail('mlAnalyticsButtonCreate');
},

async assertRegressionEvaluatePanelElementsExists() {
await testSubjects.existOrFail('mlDFAnalyticsRegressionExplorationEvaluatePanel');
await testSubjects.existOrFail('mlDFAnalyticsRegressionGenMSEstat');
await testSubjects.existOrFail('mlDFAnalyticsRegressionGenRSquaredStat');
await testSubjects.existOrFail('mlDFAnalyticsRegressionTrainingMSEstat');
await testSubjects.existOrFail('mlDFAnalyticsRegressionTrainingRSquaredStat');
},

async assertRegressionTablePanelExists() {
await testSubjects.existOrFail('mlDFAnalyticsRegressionExplorationTablePanel');
},

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

async assertAnalyticsStatsBarExists() {
await testSubjects.existOrFail('mlAnalyticsStatsBar');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export function MachineLearningDataFrameAnalyticsCreationProvider({
await testSubjects.existOrFail('mlAnalyticsCreateJobFlyoutJobIdInput');
},

async assertJobDescriptionInputExists() {
await testSubjects.existOrFail('mlDFAnalyticsJobCreationJobDescription');
},

async assertJobIdValue(expectedValue: string) {
const actualJobId = await testSubjects.getAttribute(
'mlAnalyticsCreateJobFlyoutJobIdInput',
Expand All @@ -69,13 +73,31 @@ export function MachineLearningDataFrameAnalyticsCreationProvider({
);
},

async assertJobDescriptionValue(expectedValue: string) {
const actualJobDescription = await testSubjects.getAttribute(
'mlDFAnalyticsJobCreationJobDescription',
'value'
);
expect(actualJobDescription).to.eql(
expectedValue,
`Job description should be '${expectedValue}' (got '${actualJobDescription}')`
);
},

async setJobId(jobId: string) {
await testSubjects.setValue('mlAnalyticsCreateJobFlyoutJobIdInput', jobId, {
clearWithKeyboard: true,
});
await this.assertJobIdValue(jobId);
},

async setJobDescription(jobDescription: string) {
await testSubjects.setValue('mlDFAnalyticsJobCreationJobDescription', jobDescription, {
clearWithKeyboard: true,
});
await this.assertJobDescriptionValue(jobDescription);
},

async assertSourceIndexInputExists() {
await testSubjects.existOrFail('mlAnalyticsCreateJobFlyoutSourceIndexSelect > comboBoxInput');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export function MachineLearningDataFrameAnalyticsTableProvider({ getService }: F
return await tableListContainer.findByClassName('euiFieldSearch');
}

async assertJobViewButtonExists() {
await testSubjects.existOrFail('mlAnalyticsJobViewButton');
}

async assertAnalyticsSearchInputValue(expectedSearchValue: string) {
const searchBarInput = await this.getAnalyticsSearchInput();
const actualSearchValue = await searchBarInput.getAttribute('value');
Expand All @@ -80,6 +84,11 @@ export function MachineLearningDataFrameAnalyticsTableProvider({ getService }: F
);
}

public async openResultsView() {
await this.assertJobViewButtonExists();
await testSubjects.click('mlAnalyticsJobViewButton');
}

public async filterWithSearchString(filter: string) {
await this.waitForAnalyticsToLoad();
const searchBarInput = await this.getAnalyticsSearchInput();
Expand Down