diff --git a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts index d345aabc4fabe7..24a3874eddec0e 100644 --- a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts +++ b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts @@ -440,9 +440,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await transform.wizard.assertTransformDescriptionValue(''); await transform.wizard.setTransformDescription(testData.transformDescription); - await transform.testExecution.logTestStep('inputs the destination index'); + await transform.testExecution.logTestStep( + 'should default the set destination index to job id switch to true' + ); + await transform.wizard.assertDestIndexSameAsIdSwitchExists(); + await transform.wizard.assertDestIndexSameAsIdCheckState(true); + + await transform.testExecution.logTestStep('should input the destination index'); + await transform.wizard.setDestIndexSameAsIdCheckState(false); await transform.wizard.assertDestinationIndexInputExists(); - await transform.wizard.assertDestinationIndexValue(''); + await transform.wizard.assertDestinationIndexValue(testData.transformId); await transform.wizard.setDestinationIndex(testData.destinationIndex); await transform.testExecution.logTestStep('displays the create data view switch'); diff --git a/x-pack/test/functional/apps/transform/creation/index_pattern/creation_index_pattern.ts b/x-pack/test/functional/apps/transform/creation/index_pattern/creation_index_pattern.ts index 0f461150166f6a..9e5c1e4f1b0818 100644 --- a/x-pack/test/functional/apps/transform/creation/index_pattern/creation_index_pattern.ts +++ b/x-pack/test/functional/apps/transform/creation/index_pattern/creation_index_pattern.ts @@ -727,9 +727,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await transform.wizard.assertTransformDescriptionValue(''); await transform.wizard.setTransformDescription(testData.transformDescription); - await transform.testExecution.logTestStep('inputs the destination index'); + await transform.testExecution.logTestStep( + 'should default the set destination index to job id switch to true' + ); + await transform.wizard.assertDestIndexSameAsIdSwitchExists(); + await transform.wizard.assertDestIndexSameAsIdCheckState(true); + + await transform.testExecution.logTestStep('should input the destination index'); + await transform.wizard.setDestIndexSameAsIdCheckState(false); await transform.wizard.assertDestinationIndexInputExists(); - await transform.wizard.assertDestinationIndexValue(''); + await transform.wizard.assertDestinationIndexValue(testData.transformId); await transform.wizard.setDestinationIndex(testData.destinationIndex); await transform.testExecution.logTestStep('displays the create data view switch'); diff --git a/x-pack/test/functional/apps/transform/edit_clone/cloning.ts b/x-pack/test/functional/apps/transform/edit_clone/cloning.ts index 1645547443c04e..3146548b8bbccf 100644 --- a/x-pack/test/functional/apps/transform/edit_clone/cloning.ts +++ b/x-pack/test/functional/apps/transform/edit_clone/cloning.ts @@ -517,9 +517,16 @@ export default function ({ getService }: FtrProviderContext) { ); await transform.wizard.setTransformDescription(testData.transformDescription); + await transform.testExecution.logTestStep( + 'should default the set destination index to job id switch to true' + ); + await transform.wizard.assertDestIndexSameAsIdSwitchExists(); + await transform.wizard.assertDestIndexSameAsIdCheckState(true); + await transform.testExecution.logTestStep('should input the destination index'); + await transform.wizard.setDestIndexSameAsIdCheckState(false); await transform.wizard.assertDestinationIndexInputExists(); - await transform.wizard.assertDestinationIndexValue(''); + await transform.wizard.assertDestinationIndexValue(testData.transformId); await transform.wizard.setDestinationIndex(testData.destinationIndex); await transform.testExecution.logTestStep('should display the create data view switch'); 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 1f054a73735c4d..6b8f0581035f95 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 @@ -259,13 +259,13 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( async assertDestIndexInputExists() { await retry.tryForTime(4000, async () => { - await testSubjects.existOrFail('mlAnalyticsCreateJobFlyoutDestinationIndexInput'); + await testSubjects.existOrFail('mlCreationWizardUtilsDestinationIndexInput'); }); }, async assertDestIndexValue(expectedValue: string) { const actualDestIndex = await testSubjects.getAttribute( - 'mlAnalyticsCreateJobFlyoutDestinationIndexInput', + 'mlCreationWizardUtilsDestinationIndexInput', 'value' ); expect(actualDestIndex).to.eql( @@ -275,13 +275,9 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async setDestIndex(destIndex: string) { - await mlCommonUI.setValueWithChecks( - 'mlAnalyticsCreateJobFlyoutDestinationIndexInput', - destIndex, - { - clearWithKeyboard: true, - } - ); + await mlCommonUI.setValueWithChecks('mlCreationWizardUtilsDestinationIndexInput', destIndex, { + clearWithKeyboard: true, + }); await this.assertDestIndexValue(destIndex); }, @@ -656,7 +652,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( async getDestIndexSameAsIdSwitchCheckState(): Promise { const state = await testSubjects.getAttribute( - 'mlAnalyticsCreateJobWizardDestIndexSameAsIdSwitch', + 'mlCreationWizardUtilsJobIdAsDestIndexNameSwitch', 'aria-checked' ); return state === 'true'; @@ -671,14 +667,14 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async assertDestIndexSameAsIdSwitchExists() { - await testSubjects.existOrFail(`mlAnalyticsCreateJobWizardDestIndexSameAsIdSwitch`, { + await testSubjects.existOrFail(`mlCreationWizardUtilsJobIdAsDestIndexNameSwitch`, { allowHidden: true, }); }, async setDestIndexSameAsIdCheckState(checkState: boolean) { if ((await this.getDestIndexSameAsIdSwitchCheckState()) !== checkState) { - await testSubjects.click('mlAnalyticsCreateJobWizardDestIndexSameAsIdSwitch'); + await testSubjects.click('mlCreationWizardUtilsJobIdAsDestIndexNameSwitch'); } await this.assertDestIndexSameAsIdCheckState(checkState); }, diff --git a/x-pack/test/functional/services/transform/wizard.ts b/x-pack/test/functional/services/transform/wizard.ts index bd07857eade241..5e00904ab8a27f 100644 --- a/x-pack/test/functional/services/transform/wizard.ts +++ b/x-pack/test/functional/services/transform/wizard.ts @@ -700,13 +700,42 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi await this.assertTransformDescriptionValue(transformDescription); }, + async getDestIndexSameAsIdSwitchCheckState(): Promise { + const state = await testSubjects.getAttribute( + 'mlCreationWizardUtilsJobIdAsDestIndexNameSwitch', + 'aria-checked' + ); + return state === 'true'; + }, + + async assertDestIndexSameAsIdCheckState(expectedCheckState: boolean) { + const actualCheckState = await this.getDestIndexSameAsIdSwitchCheckState(); + expect(actualCheckState).to.eql( + expectedCheckState, + `Destination index same as job id check state should be '${expectedCheckState}' (got '${actualCheckState}')` + ); + }, + + async assertDestIndexSameAsIdSwitchExists() { + await testSubjects.existOrFail(`mlCreationWizardUtilsJobIdAsDestIndexNameSwitch`, { + allowHidden: true, + }); + }, + + async setDestIndexSameAsIdCheckState(checkState: boolean) { + if ((await this.getDestIndexSameAsIdSwitchCheckState()) !== checkState) { + await testSubjects.click('mlCreationWizardUtilsJobIdAsDestIndexNameSwitch'); + } + await this.assertDestIndexSameAsIdCheckState(checkState); + }, + async assertDestinationIndexInputExists() { - await testSubjects.existOrFail('transformDestinationIndexInput'); + await testSubjects.existOrFail('mlCreationWizardUtilsDestinationIndexInput'); }, async assertDestinationIndexValue(expectedValue: string) { const actualDestinationIndex = await testSubjects.getAttribute( - 'transformDestinationIndexInput', + 'mlCreationWizardUtilsDestinationIndexInput', 'value' ); expect(actualDestinationIndex).to.eql( @@ -716,9 +745,13 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi }, async setDestinationIndex(destinationIndex: string) { - await ml.commonUI.setValueWithChecks('transformDestinationIndexInput', destinationIndex, { - clearWithKeyboard: true, - }); + await ml.commonUI.setValueWithChecks( + 'mlCreationWizardUtilsDestinationIndexInput', + destinationIndex, + { + clearWithKeyboard: true, + } + ); await this.assertDestinationIndexValue(destinationIndex); },