forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Add functional tests for Index data visualizer's random sampler …
…controls (elastic#142278) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
f2e630c
commit 36f330e
Showing
5 changed files
with
181 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_random_sampler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
import { farequoteDataViewTestData, farequoteLuceneSearchTestData } from './index_test_data'; | ||
|
||
export default function ({ getPageObject, getService }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const ml = getService('ml'); | ||
const browser = getService('browser'); | ||
async function goToSourceForIndexBasedDataVisualizer(sourceIndexOrSavedSearch: string) { | ||
await ml.testExecution.logTestStep(`navigates to Data Visualizer page`); | ||
await ml.navigation.navigateToDataVisualizer(); | ||
|
||
await ml.testExecution.logTestStep(`loads the saved search selection page`); | ||
await ml.dataVisualizer.navigateToIndexPatternSelection(); | ||
|
||
await ml.testExecution.logTestStep(`loads the index data visualizer page`); | ||
await ml.jobSourceSelection.selectSourceForIndexBasedDataVisualizer(sourceIndexOrSavedSearch); | ||
} | ||
describe('index based random sampler controls', function () { | ||
this.tags(['ml']); | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/module_sample_logs'); | ||
|
||
await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); | ||
await ml.testResources.createIndexPatternIfNeeded('ft_module_sample_logs', '@timestamp'); | ||
await ml.testResources.createSavedSearchFarequoteLuceneIfNeeded(); | ||
await ml.testResources.setKibanaTimeZoneToUTC(); | ||
|
||
await ml.securityUI.loginAsMlPowerUser(); | ||
// Start navigation from the base of the ML app. | ||
await ml.navigation.navigateToMl(); | ||
}); | ||
|
||
after(async () => { | ||
await ml.testResources.deleteSavedSearches(); | ||
await ml.testResources.deleteIndexPatternByTitle('ft_farequote'); | ||
await ml.testResources.deleteIndexPatternByTitle('ft_module_sample_logs'); | ||
await browser.removeLocalStorageItem('dataVisualizer.randomSamplerPreference'); | ||
}); | ||
|
||
describe('with small data sets', function () { | ||
it(`has random sampler 'on - automatic' by default`, async () => { | ||
await goToSourceForIndexBasedDataVisualizer( | ||
farequoteDataViewTestData.sourceIndexOrSavedSearch | ||
); | ||
|
||
await ml.dataVisualizerIndexBased.assertRandomSamplingOption( | ||
'dvRandomSamplerOptionOnAutomatic', | ||
100 | ||
); | ||
}); | ||
|
||
it(`retains random sampler 'off' setting`, async () => { | ||
await ml.dataVisualizerIndexBased.setRandomSamplingOption('dvRandomSamplerOptionOff'); | ||
|
||
await goToSourceForIndexBasedDataVisualizer( | ||
farequoteLuceneSearchTestData.sourceIndexOrSavedSearch | ||
); | ||
await ml.dataVisualizerIndexBased.assertRandomSamplingOption('dvRandomSamplerOptionOff'); | ||
}); | ||
|
||
it(`retains random sampler 'on - manual' setting`, async () => { | ||
await ml.dataVisualizerIndexBased.setRandomSamplingOption('dvRandomSamplerOptionOnManual'); | ||
|
||
await goToSourceForIndexBasedDataVisualizer('ft_module_sample_logs'); | ||
await ml.dataVisualizerIndexBased.assertRandomSamplingOption( | ||
'dvRandomSamplerOptionOnManual', | ||
50 | ||
); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters