diff --git a/x-pack/test/api_integration/apis/ml/modules/index.ts b/x-pack/test/api_integration/apis/ml/modules/index.ts index 3cf1c7f7878402..c6a75eccfa4c83 100644 --- a/x-pack/test/api_integration/apis/ml/modules/index.ts +++ b/x-pack/test/api_integration/apis/ml/modules/index.ts @@ -8,6 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, loadTestFile }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); const ml = getService('ml'); const supertest = getService('supertest'); @@ -15,8 +16,12 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { describe('modules', function () { before(async () => { + // use empty_kibana to make sure the fleet setup is removed correctly after the tests + await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); + // Fleet need to be setup to be able to setup packages await supertest.post(`/api/fleet/setup`).set({ 'kbn-xsrf': 'some-xsrf-token' }).expect(200); + for (const fleetPackage of fleetPackages) { await ml.testResources.installFleetPackage(fleetPackage); } @@ -26,6 +31,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { for (const fleetPackage of fleetPackages) { await ml.testResources.removeFleetPackage(fleetPackage); } + await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); }); loadTestFile(require.resolve('./get_module')); diff --git a/x-pack/test/functional/services/ml/anomaly_explorer.ts b/x-pack/test/functional/services/ml/anomaly_explorer.ts index 6ec45204388d7e..4392de7ee55677 100644 --- a/x-pack/test/functional/services/ml/anomaly_explorer.ts +++ b/x-pack/test/functional/services/ml/anomaly_explorer.ts @@ -10,6 +10,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProviderContext) { + const retry = getService('retry'); const testSubjects = getService('testSubjects'); return { @@ -82,12 +83,8 @@ export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProvid }, async addAndEditSwimlaneInDashboard(dashboardTitle: string) { - await this.filterWithSearchString(dashboardTitle); - await testSubjects.isDisplayed('mlDashboardSelectionTable > checkboxSelectAll'); - await testSubjects.clickWhenNotDisabled('mlDashboardSelectionTable > checkboxSelectAll'); - expect(await testSubjects.isChecked('mlDashboardSelectionTable > checkboxSelectAll')).to.be( - true - ); + await this.filterDashboardSearchWithSearchString(dashboardTitle); + await this.selectAllDashboards(); await testSubjects.clickWhenNotDisabled('mlAddAndEditDashboardButton'); // changing to the dashboard app might take sime time const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper', 30 * 1000); @@ -106,11 +103,30 @@ export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProvid await testSubjects.existOrFail('~mlDashboardSelectionTable', { timeout: 60 * 1000 }); }, - async filterWithSearchString(filter: string) { + async filterDashboardSearchWithSearchString(filter: string) { await this.waitForDashboardsToLoad(); const searchBarInput = await testSubjects.find('mlDashboardsSearchBox'); await searchBarInput.clearValueWithKeyboard(); await searchBarInput.type(filter); + await this.assertDashboardSearchInputValue(filter); + }, + + async assertDashboardSearchInputValue(expectedSearchValue: string) { + const searchBarInput = await testSubjects.find('mlDashboardsSearchBox'); + const actualSearchValue = await searchBarInput.getAttribute('value'); + expect(actualSearchValue).to.eql( + expectedSearchValue, + `Dashboard search input value should be '${expectedSearchValue}' (got '${actualSearchValue}')` + ); + }, + + async selectAllDashboards() { + await retry.tryForTime(3000, async () => { + await testSubjects.clickWhenNotDisabled('mlDashboardSelectionTable > checkboxSelectAll'); + expect( + await testSubjects.isChecked('mlDashboardSelectionTable > checkboxSelectAll') + ).to.eql(true, 'Checkbox to select all dashboards should be selected'); + }); }, async assertClearSelectionButtonVisible(expectVisible: boolean) { diff --git a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts index b22748608589ed..ab3692be9288f0 100644 --- a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts +++ b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts @@ -404,42 +404,58 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async assertConfigurationStepActive() { - await testSubjects.existOrFail('mlAnalyticsCreateJobWizardConfigurationStep active'); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardConfigurationStep active', { + timeout: 3000, + }); }, async assertAdditionalOptionsStepActive() { - await testSubjects.existOrFail('mlAnalyticsCreateJobWizardAdvancedStep active'); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardAdvancedStep active', { + timeout: 3000, + }); }, async assertDetailsStepActive() { - await testSubjects.existOrFail('mlAnalyticsCreateJobWizardDetailsStep active'); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardDetailsStep active', { + timeout: 3000, + }); }, async assertCreateStepActive() { - await testSubjects.existOrFail('mlAnalyticsCreateJobWizardCreateStep active'); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardCreateStep active', { + timeout: 3000, + }); }, async assertValidationStepActive() { - await testSubjects.existOrFail('mlAnalyticsCreateJobWizardValidationStepWrapper active'); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardValidationStepWrapper active', { + timeout: 3000, + }); }, async continueToAdditionalOptionsStep() { - await retry.tryForTime(5000, async () => { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await retry.tryForTime(15 * 1000, async () => { + await testSubjects.clickWhenNotDisabled( + 'mlAnalyticsCreateJobWizardConfigurationStep active > mlAnalyticsCreateJobWizardContinueButton' + ); await this.assertAdditionalOptionsStepActive(); }); }, async continueToDetailsStep() { - await retry.tryForTime(5000, async () => { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await retry.tryForTime(15 * 1000, async () => { + await testSubjects.clickWhenNotDisabled( + 'mlAnalyticsCreateJobWizardAdvancedStep active > mlAnalyticsCreateJobWizardContinueButton' + ); await this.assertDetailsStepActive(); }); }, async continueToValidationStep() { - await retry.tryForTime(5000, async () => { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await retry.tryForTime(15 * 1000, async () => { + await testSubjects.clickWhenNotDisabled( + 'mlAnalyticsCreateJobWizardDetailsStep active > mlAnalyticsCreateJobWizardContinueButton' + ); await this.assertValidationStepActive(); }); }, @@ -456,8 +472,10 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async continueToCreateStep() { - await retry.tryForTime(5000, async () => { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await retry.tryForTime(15 * 1000, async () => { + await testSubjects.clickWhenNotDisabled( + 'mlAnalyticsCreateJobWizardValidationStepWrapper active > mlAnalyticsCreateJobWizardContinueButton' + ); await this.assertCreateStepActive(); }); },