[ML] Transform: Fix data view error on cloning due to missing indices (#138756)

* [ML] Fix data view fetch fields error due to index not yet existing by setting allowNoIndex to true

* Add functional tests

* Remove toast check for deletion

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Quynh Nguyen 2022-08-16 10:04:24 -05:00 committed by GitHub
parent 08210170bd
commit b6fce4df84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 0 deletions

View file

@ -244,6 +244,7 @@ export const StepCreateForm: FC<StepCreateFormProps> = React.memo(
...(isPopulatedObject(runtimeMappings) && isLatestTransform(transformConfig)
? { runtimeFieldMap: runtimeMappings }
: {}),
allowNoIndex: true,
},
false,
true

View file

@ -565,6 +565,7 @@ export default function ({ getService }: FtrProviderContext) {
'should start the transform and finish processing'
);
await transform.wizard.startTransform();
await transform.wizard.assertErrorToastsNotExist();
await transform.wizard.waitForProgressBarComplete();
await transform.testExecution.logTestStep('should return to the management page');

View file

@ -664,6 +664,7 @@ export default function ({ getService }: FtrProviderContext) {
await transform.testExecution.logTestStep('starts the transform and finishes processing');
await transform.wizard.startTransform();
await transform.wizard.assertErrorToastsNotExist();
await transform.wizard.waitForProgressBarComplete();
await transform.testExecution.logTestStep('returns to the management page');

View file

@ -430,6 +430,7 @@ export default function ({ getService }: FtrProviderContext) {
await transform.testExecution.logTestStep('starts the transform and finishes processing');
await transform.wizard.startTransform();
await transform.wizard.assertErrorToastsNotExist();
await transform.wizard.waitForProgressBarComplete();
await transform.testExecution.logTestStep('redirects to Discover page');

View file

@ -261,6 +261,7 @@ export default function ({ getService }: FtrProviderContext) {
await transform.testExecution.logTestStep('starts the transform and finishes processing');
await transform.wizard.startTransform();
await transform.wizard.assertErrorToastsNotExist();
await transform.wizard.waitForProgressBarComplete();
await transform.testExecution.logTestStep('returns to the management page');

View file

@ -27,6 +27,8 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
const retry = getService('retry');
const find = getService('find');
const ml = getService('ml');
const toasts = getService('toasts');
const PageObjects = getPageObjects(['discover', 'timePicker']);
return {
@ -1068,5 +1070,15 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
await browser.pressKeys(browser.keys.ESCAPE);
});
},
async assertErrorToastsNotExist() {
const toastCount = await toasts.getToastCount();
// Toast element index starts at 1, not 0
for (let toastIdx = 1; toastIdx < toastCount + 1; toastIdx++) {
const toast = await toasts.getToastElement(toastIdx);
const isErrorToast = await toast.elementHasClass('euiToast--danger');
expect(isErrorToast).to.eql(false, `Expected toast message to be successful, got error.`);
}
},
};
}