mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.6] [ML] Anomaly Detection: Adds functional tests for filtering by influencers in the Anomaly Explorer (#146085) (#146215)
# Backport This will backport the following commits from `main` to `8.6`: - [[ML] Anomaly Detection: Adds functional tests for filtering by influencers in the Anomaly Explorer (#146085)](https://github.com/elastic/kibana/pull/146085) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Melissa Alvarez","email":"melissa.alvarez@elastic.co"},"sourceCommit":{"committedDate":"2022-11-23T19:00:34Z","message":"[ML] Anomaly Detection: Adds functional tests for filtering by influencers in the Anomaly Explorer (#146085)\n\n## Summary\r\n\r\nRelated meta issue: https://github.com/elastic/kibana/issues/142456\r\nAdds functional tests for filtering by influencers in the Anomaly\r\nExplorer\r\n\r\nFlaky test build\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1592\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"395fe5a0919d190cd8333af96c787efc36e4a389","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","test_ui_functional","release_note:skip","v8.6.0","v8.7.0"],"number":146085,"url":"https://github.com/elastic/kibana/pull/146085","mergeCommit":{"message":"[ML] Anomaly Detection: Adds functional tests for filtering by influencers in the Anomaly Explorer (#146085)\n\n## Summary\r\n\r\nRelated meta issue: https://github.com/elastic/kibana/issues/142456\r\nAdds functional tests for filtering by influencers in the Anomaly\r\nExplorer\r\n\r\nFlaky test build\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1592\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"395fe5a0919d190cd8333af96c787efc36e4a389"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146085","number":146085,"mergeCommit":{"message":"[ML] Anomaly Detection: Adds functional tests for filtering by influencers in the Anomaly Explorer (#146085)\n\n## Summary\r\n\r\nRelated meta issue: https://github.com/elastic/kibana/issues/142456\r\nAdds functional tests for filtering by influencers in the Anomaly\r\nExplorer\r\n\r\nFlaky test build\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1592\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"395fe5a0919d190cd8333af96c787efc36e4a389"}}]}] BACKPORT--> Co-authored-by: Melissa Alvarez <melissa.alvarez@elastic.co>
This commit is contained in:
parent
22e9eacbc8
commit
c929f357fa
4 changed files with 78 additions and 0 deletions
|
@ -41,6 +41,7 @@ function getAddFilter({ entityName, entityValue, filter }: EntityCellProps) {
|
|||
>
|
||||
<EuiButtonIcon
|
||||
size="s"
|
||||
data-test-subj={`mlAnomaliesTableEntityCellAddFilterButton-${entityValue}`}
|
||||
className="filter-button"
|
||||
onClick={blurButtonOnClick(() => {
|
||||
filter(entityName, entityValue, ENTITY_FIELD_OPERATIONS.ADD);
|
||||
|
@ -68,6 +69,7 @@ function getRemoveFilter({ entityName, entityValue, filter }: EntityCellProps) {
|
|||
>
|
||||
<EuiButtonIcon
|
||||
size="s"
|
||||
data-test-subj={`mlAnomaliesTableEntityCellRemoveFilterButton-${entityValue}`}
|
||||
className="filter-button"
|
||||
onClick={blurButtonOnClick(() => {
|
||||
filter(entityName, entityValue, ENTITY_FIELD_OPERATIONS.REMOVE);
|
||||
|
|
|
@ -151,6 +151,46 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await ml.anomaliesTable.assertTableNotEmpty();
|
||||
});
|
||||
|
||||
it('should allow filtering by influencer', async () => {
|
||||
const fieldName = testData.expected.influencers[0].field;
|
||||
const fieldValue = testData.expected.influencers[0].labelsContained[0];
|
||||
|
||||
await ml.testExecution.logTestStep(
|
||||
'adds influencer filter by clicking on the influencer add filter button'
|
||||
);
|
||||
await ml.anomalyExplorer.addFilterForInfluencer(fieldName, fieldValue);
|
||||
await ml.testExecution.logTestStep('query bar and table rows reflect filter');
|
||||
await ml.anomalyExplorer.assertQueryBarContent(`${fieldName}:"${fieldValue}"`);
|
||||
await ml.anomaliesTable.assertInfluencersCellsContainFilter(
|
||||
`${fieldName}: ${fieldValue}`
|
||||
);
|
||||
await ml.testExecution.logTestStep('influencers list and swimlane reflect filter');
|
||||
await ml.swimLane.assertAxisLabels(viewBySwimLaneTestSubj, 'y', [fieldValue]);
|
||||
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 1);
|
||||
await ml.testExecution.logTestStep(
|
||||
'removes influencer filter by clicking on the influencer remove filter button'
|
||||
);
|
||||
await ml.anomalyExplorer.removeFilterForInfluencer(fieldName, fieldValue);
|
||||
await ml.testExecution.logTestStep('query bar reflects filter removal');
|
||||
await ml.anomalyExplorer.assertQueryBarContent('');
|
||||
await ml.testExecution.logTestStep(
|
||||
'influencers list and swimlane reflect filter removal'
|
||||
);
|
||||
await ml.swimLane.assertAxisLabels(viewBySwimLaneTestSubj, 'y', [
|
||||
'AAL',
|
||||
'EGF',
|
||||
'VRD',
|
||||
'SWR',
|
||||
'JZA',
|
||||
'AMX',
|
||||
'TRS',
|
||||
'ACA',
|
||||
'BAW',
|
||||
'ASA',
|
||||
]);
|
||||
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10);
|
||||
});
|
||||
|
||||
it('has enabled Single Metric Viewer button', async () => {
|
||||
await ml.anomalyExplorer.assertSingleMetricViewerButtonEnabled(true);
|
||||
});
|
||||
|
|
|
@ -56,6 +56,14 @@ export function MachineLearningAnomaliesTableProvider({ getService }: FtrProvide
|
|||
);
|
||||
},
|
||||
|
||||
async assertInfluencersCellsContainFilter(filterString: string) {
|
||||
const tableRows = await testSubjects.findAll('mlAnomaliesListColumnInfluencers');
|
||||
for (const row of tableRows) {
|
||||
const influencerColumnCellText = await row.getVisibleText();
|
||||
expect(influencerColumnCellText).to.eql(filterString);
|
||||
}
|
||||
},
|
||||
|
||||
async assertAnomalyActionsMenuButtonExists(rowIndex: number) {
|
||||
const rowSubj = await this.getRowSubjByRowIndex(rowIndex);
|
||||
await testSubjects.existOrFail(`${rowSubj} > mlAnomaliesListRowActionsButton`);
|
||||
|
|
|
@ -44,6 +44,20 @@ export function MachineLearningAnomalyExplorerProvider(
|
|||
return influencerFieldLabels;
|
||||
},
|
||||
|
||||
async getQueryBarText() {
|
||||
const queryBarElement = await testSubjects.find('explorerQueryInput');
|
||||
const queryBarText = await queryBarElement.getVisibleText();
|
||||
return queryBarText;
|
||||
},
|
||||
|
||||
async assertQueryBarContent(contentString: string) {
|
||||
const queryBarText = await this.getQueryBarText();
|
||||
expect(queryBarText).to.eql(
|
||||
contentString,
|
||||
`Expected influencer filter to be '${contentString}' (got '${queryBarText}')`
|
||||
);
|
||||
},
|
||||
|
||||
async assertInfluencerListContainsLabel(influencerField: string, label: string) {
|
||||
const influencerFieldLabels = await this.getInfluencerFieldLabels(influencerField);
|
||||
expect(influencerFieldLabels).to.contain(
|
||||
|
@ -84,6 +98,20 @@ export function MachineLearningAnomalyExplorerProvider(
|
|||
});
|
||||
},
|
||||
|
||||
async addFilterForInfluencer(influencerField: string, influencerValue: string) {
|
||||
await testSubjects.existOrFail(
|
||||
`mlAnomaliesTableEntityCellAddFilterButton-${influencerValue}`
|
||||
);
|
||||
await testSubjects.click(`mlAnomaliesTableEntityCellAddFilterButton-${influencerValue}`);
|
||||
},
|
||||
|
||||
async removeFilterForInfluencer(influencerField: string, influencerValue: string) {
|
||||
await testSubjects.existOrFail(
|
||||
`mlAnomaliesTableEntityCellRemoveFilterButton-${influencerValue}`
|
||||
);
|
||||
await testSubjects.click(`mlAnomaliesTableEntityCellRemoveFilterButton-${influencerValue}`);
|
||||
},
|
||||
|
||||
async openAddToDashboardControl() {
|
||||
await testSubjects.click('mlAnomalyTimelinePanelMenu');
|
||||
await testSubjects.click('mlAnomalyTimelinePanelAddToDashboardButton');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue