mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] AIOps: Enable Change point detection tests (#177324)
## Summary Closes #172984 Enables Change point detection functional tests ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed
This commit is contained in:
parent
84889d0399
commit
af86fc3d80
3 changed files with 32 additions and 14 deletions
|
@ -16,8 +16,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
// aiops lives in the ML UI so we need some related services.
|
||||
const ml = getService('ml');
|
||||
|
||||
// Failing ES Promotion: https://github.com/elastic/kibana/issues/172984
|
||||
describe.skip('change point detection', async function () {
|
||||
describe('change point detection', async function () {
|
||||
before(async () => {
|
||||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce');
|
||||
await ml.testResources.createDataViewIfNeeded('ft_ecommerce', 'order_date');
|
||||
|
@ -43,10 +42,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
|
||||
const result = await aiops.changePointDetectionPage.getTable(0).parseTable();
|
||||
expect(result.length).to.eql(1);
|
||||
expect(parseInt(result[0].pValue, 10)).to.eql(0);
|
||||
expect(Number(result[0].pValue)).to.be.lessThan(1);
|
||||
expect(result[0].type).to.eql('distribution_change');
|
||||
|
||||
await elasticChart.waitForRenderComplete('aiopChangePointPreviewChart > xyVisChart');
|
||||
await ml.testExecution.logTestStep('Check the change point chart is rendered');
|
||||
await elasticChart.waitForRenderComplete('aiopChangePointPreviewChart > xyVisChart', 5000);
|
||||
const chartState = await elasticChart.getChartDebugData(
|
||||
'aiopChangePointPreviewChart > xyVisChart',
|
||||
0,
|
||||
|
@ -64,8 +64,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
await aiops.changePointDetectionPage.clickUseFullDataButton();
|
||||
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
|
||||
await aiops.changePointDetectionPage.selectSplitField(0, 'geoip.city_name');
|
||||
await aiops.changePointDetectionPage.getTable(0).waitForTableToLoad();
|
||||
const result = await aiops.changePointDetectionPage.getTable(0).parseTable();
|
||||
|
||||
const tableService = aiops.changePointDetectionPage.getTable(0);
|
||||
await tableService.waitForTableToLoad();
|
||||
const result = await tableService.parseTable();
|
||||
// the aggregation may return different results (+-1)
|
||||
expect(result.length).to.be.above(4);
|
||||
// assert asc sorting by p_value is applied
|
||||
|
@ -73,20 +75,23 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('allows change point selection for detailed view', async () => {
|
||||
await aiops.changePointDetectionPage.getTable(0).selectAllRows();
|
||||
const tableService = aiops.changePointDetectionPage.getTable(0);
|
||||
|
||||
await tableService.selectAllRows();
|
||||
await aiops.changePointDetectionPage.viewSelected();
|
||||
await aiops.changePointDetectionPage.assertDetailedView(5);
|
||||
await aiops.changePointDetectionPage.closeFlyout();
|
||||
// deselect
|
||||
await aiops.changePointDetectionPage.getTable(0).selectAllRows();
|
||||
await tableService.selectAllRows();
|
||||
});
|
||||
|
||||
it('supports a quick filter actions', async () => {
|
||||
await aiops.changePointDetectionPage
|
||||
.getTable(0)
|
||||
.invokeAction(0, 'aiopsChangePointFilterForValue');
|
||||
await aiops.changePointDetectionPage.getTable(0).waitForTableToLoad();
|
||||
const resultFor = await aiops.changePointDetectionPage.getTable(0).parseTable();
|
||||
const tableService = aiops.changePointDetectionPage.getTable(0);
|
||||
await tableService.invokeAction(0, 'aiopsChangePointFilterForValue', async () => {
|
||||
await aiops.changePointDetectionPage.assertFiltersApplied();
|
||||
await tableService.waitForTableToStartLoading();
|
||||
});
|
||||
const resultFor = await tableService.parseTable();
|
||||
expect(resultFor.length).to.eql(1);
|
||||
});
|
||||
|
||||
|
|
|
@ -252,6 +252,12 @@ export function ChangePointDetectionPageProvider(
|
|||
await this.completeSaveToDashboardForm({ createNew: true });
|
||||
},
|
||||
|
||||
async assertFiltersApplied() {
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
await testSubjects.existOrFail('filter-items-group');
|
||||
});
|
||||
},
|
||||
|
||||
getTable(index: number) {
|
||||
return tableService.getServiceInstance(
|
||||
'ChangePointResultsTable',
|
||||
|
|
|
@ -147,7 +147,11 @@ export function MlTableServiceProvider({ getPageObject, getService }: FtrProvide
|
|||
});
|
||||
}
|
||||
|
||||
public async invokeAction(rowIndex: number, actionSubject: string) {
|
||||
public async invokeAction(
|
||||
rowIndex: number,
|
||||
actionSubject: string,
|
||||
postActionCallback: () => Promise<void>
|
||||
) {
|
||||
const rows = await testSubjects.findAll(
|
||||
`${this.parentSubj ? `${this.parentSubj} > ` : ''}~${this.tableTestSubj} > ~${
|
||||
this.tableRowSubj
|
||||
|
@ -159,6 +163,9 @@ export function MlTableServiceProvider({ getPageObject, getService }: FtrProvide
|
|||
|
||||
await retry.tryForTime(5000, async () => {
|
||||
await actionButton.click();
|
||||
if (postActionCallback) {
|
||||
await postActionCallback();
|
||||
}
|
||||
await this.waitForTableToLoad();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue