diff --git a/x-pack/plugins/ml/public/components/nav_menu/nav_menu.html b/x-pack/plugins/ml/public/components/nav_menu/nav_menu.html index b0a38b8144945..32cd3a2f83537 100644 --- a/x-pack/plugins/ml/public/components/nav_menu/nav_menu.html +++ b/x-pack/plugins/ml/public/components/nav_menu/nav_menu.html @@ -14,35 +14,35 @@
- - - - - } + data-test-subj="mlDataVisualizerCardImportData" /> @@ -149,6 +150,7 @@ export const DatavisualizerSelector = injectI18n(function (props) { /> } + data-test-subj="mlDataVisualizerCardIndexData" /> diff --git a/x-pack/plugins/ml/public/datavisualizer/selector/directive.js b/x-pack/plugins/ml/public/datavisualizer/selector/directive.js index 3242cc6eb9708..c847fd86a7001 100644 --- a/x-pack/plugins/ml/public/datavisualizer/selector/directive.js +++ b/x-pack/plugins/ml/public/datavisualizer/selector/directive.js @@ -15,7 +15,10 @@ import { checkFindFileStructurePrivilege } from 'plugins/ml/privilege/check_priv import uiRoutes from 'ui/routes'; -const template = ``; +const template = ` + + +`; uiRoutes .when('/datavisualizer', { diff --git a/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap b/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap index ef12112934cd9..0990c82f530ea 100644 --- a/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap +++ b/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap @@ -17,6 +17,7 @@ exports[`ExplorerNoInfluencersFound snapshot 1`] = ` /> } + data-test-subj="mlNoJobsFound" iconColor="subdued" iconType="alert" title={ diff --git a/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js b/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js index 1e82ef664d257..5cce2e1eece95 100644 --- a/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js +++ b/x-pack/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js @@ -29,5 +29,6 @@ export const ExplorerNoJobsFound = () => ( /> } + data-test-subj="mlNoJobsFound" /> ); diff --git a/x-pack/plugins/ml/public/explorer/explorer.html b/x-pack/plugins/ml/public/explorer/explorer.html index 9fff39b76deeb..d984ff2b9baea 100644 --- a/x-pack/plugins/ml/public/explorer/explorer.html +++ b/x-pack/plugins/ml/public/explorer/explorer.html @@ -1,6 +1,6 @@ -
+
diff --git a/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js b/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js index b89e34adc9b10..407988e90f62e 100644 --- a/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js +++ b/x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js @@ -255,6 +255,7 @@ class JobsListUI extends Component { return ( { const stats = Object.keys(jobStats).map(k => jobStats[k]); return ( -
+
{ stats.filter(s => (s.show)).map(s => ) } diff --git a/x-pack/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js b/x-pack/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js index 6c56b4c8b1076..381c9fb0f2671 100644 --- a/x-pack/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js +++ b/x-pack/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js @@ -24,6 +24,7 @@ export function NewJobButton() { const buttonEnabled = (checkPermission('canCreateJob') && mlNodesAvailable()); return ( `; +const template = ``; uiRoutes .when('/jobs/?', { diff --git a/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap b/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap index 7de30a916576d..1808596137267 100644 --- a/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap +++ b/x-pack/plugins/ml/public/settings/__snapshots__/settings.test.js.snap @@ -3,6 +3,7 @@ exports[`Settings Renders settings page 1`] = ` + { ); - const button = wrapper.find('[data-testid="ml_filter_lists_button"]'); + const button = wrapper.find('[data-test-subj="ml_filter_lists_button"]'); const filterButton = button.find('EuiButtonEmpty'); expect(filterButton.prop('isDisabled')).toBe(true); }); @@ -41,7 +41,7 @@ describe('Settings', () => { ); - const button = wrapper.find('[data-testid="ml_calendar_mng_button"]'); + const button = wrapper.find('[data-test-subj="ml_calendar_mng_button"]'); const calendarButton = button.find('EuiButtonEmpty'); expect(calendarButton.prop('isDisabled')).toBe(true); }); diff --git a/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html b/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html index c475a86247b11..783b6224165cf 100644 --- a/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html +++ b/x-pack/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.html @@ -1,6 +1,6 @@ -
+
-
+
- + { + before(async () => { + await esArchiver.load('empty_kibana'); + }); + + after(async () => { + await esArchiver.unload('empty_kibana'); + }); + + it('loads the home page', async () => { + await ml.navigateTo(); + }); + + it('loads the job management page', async () => { + await ml.navigateToJobManagement(); + await ml.assertJobStatsBarExists(); + await ml.assertJobTableExists(); + await ml.assertCreateNewJobButtonExists(); + }); + + it('loads the anomaly explorer page', async () => { + await ml.navigateToAnomalyExplorert(); + await ml.assertAnomalyExplorerEmptyListMessageExists(); + }); + + it('loads the single metric viewer page', async () => { + await ml.navigateToSingleMetricViewer(); + await ml.assertSingleMetricViewerEmptyListMessageExsist(); + }); + + it('loads the data visualizer page', async () => { + await ml.navigateToDataVisualizer(); + await ml.assertDataVisualizerImportDataCardExists(); + await ml.assertDataVisualizerIndexDataCardExists(); + }); + + it('loads the settings page', async () => { + await ml.navigateToSettings(); + await ml.assertSettingsCalendarLinkExists(); + await ml.assertSettingsFilterlistLinkExists(); + }); + }); +} diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 581230aced693..13e4b50701fe6 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -54,6 +54,7 @@ import { AceEditorProvider, GrokDebuggerProvider, UptimeProvider, + MachineLearningProvider, } from './services'; @@ -87,7 +88,8 @@ export default async function ({ readConfigFile }) { resolve(__dirname, './apps/maps'), resolve(__dirname, './apps/status_page'), resolve(__dirname, './apps/upgrade_assistant'), - resolve(__dirname, './apps/uptime') + resolve(__dirname, './apps/uptime'), + resolve(__dirname, './apps/ml'), ], // define the name and providers for services that should be @@ -124,6 +126,7 @@ export default async function ({ readConfigFile }) { grokDebugger: GrokDebuggerProvider, uptime: UptimeProvider, rollup: RollupPageProvider, + ml: MachineLearningProvider, }, // just like services, PageObjects are defined as a map of @@ -213,7 +216,10 @@ export default async function ({ readConfigFile }) { rollupJob: { pathname: '/app/kibana', hash: '/management/elasticsearch/rollup_jobs/' - } + }, + ml: { + pathname: '/app/ml' + }, }, // choose where esArchiver should load archives from diff --git a/x-pack/test/functional/services/index.js b/x-pack/test/functional/services/index.js index 1c88c993d2b56..23d12aafbd331 100644 --- a/x-pack/test/functional/services/index.js +++ b/x-pack/test/functional/services/index.js @@ -11,3 +11,4 @@ export { RandomProvider } from './random'; export { AceEditorProvider } from './ace_editor'; export { GrokDebuggerProvider } from './grok_debugger'; export { UptimeProvider } from './uptime'; +export { MachineLearningProvider } from './ml'; diff --git a/x-pack/test/functional/services/ml.ts b/x-pack/test/functional/services/ml.ts new file mode 100644 index 0000000000000..43ef997be7db0 --- /dev/null +++ b/x-pack/test/functional/services/ml.ts @@ -0,0 +1,82 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { KibanaFunctionalTestDefaultProviders } from '../../types/providers'; + +export function MachineLearningProvider({ + getService, + getPageObjects, +}: KibanaFunctionalTestDefaultProviders) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common']); + + return { + async navigateTo() { + return await PageObjects.common.navigateToApp('ml'); + }, + + async navigateToJobManagement() { + await testSubjects.click('mlTabJobManagement'); + await testSubjects.exists('mlPageJobManagement'); + }, + + async navigateToAnomalyExplorert() { + await testSubjects.click('mlTabAnomalyExplorer'); + await testSubjects.exists('mlPageAnomalyExplorer'); + }, + + async navigateToSingleMetricViewer() { + await testSubjects.click('mlTabSingleMetricViewer'); + await testSubjects.exists('mlPageSingleMetricViewer'); + }, + + async navigateToDataVisualizer() { + await testSubjects.click('mlTabDataVisualizer'); + await testSubjects.exists('mlPageDataVisualizerSelector'); + }, + + async navigateToSettings() { + await testSubjects.click('mlTabSettings'); + await testSubjects.exists('mlPageSettings'); + }, + + async assertJobTableExists() { + await testSubjects.existOrFail('mlJobListTable'); + }, + + async assertCreateNewJobButtonExists() { + await testSubjects.existOrFail('mlCreateNewJobButton'); + }, + + async assertJobStatsBarExists() { + await testSubjects.existOrFail('mlJobStatsBar'); + }, + + async assertAnomalyExplorerEmptyListMessageExists() { + await testSubjects.existOrFail('mlNoJobsFound'); + }, + + async assertSingleMetricViewerEmptyListMessageExsist() { + await testSubjects.existOrFail('mlNoSingleMetricJobsFound'); + }, + + async assertDataVisualizerImportDataCardExists() { + await testSubjects.existOrFail('mlDataVisualizerCardImportData'); + }, + + async assertDataVisualizerIndexDataCardExists() { + await testSubjects.existOrFail('mlDataVisualizerCardIndexData'); + }, + + async assertSettingsCalendarLinkExists() { + await testSubjects.existOrFail('ml_calendar_mng_button'); + }, + + async assertSettingsFilterlistLinkExists() { + await testSubjects.existOrFail('ml_filter_lists_button'); + }, + }; +}