Skip to content

Commit

Permalink
[ML] Functional tests - stabilize import job test (elastic#111929) (e…
Browse files Browse the repository at this point in the history
…lastic#111972)

This PR stabilizes the import job tests by giving the `Import` button some time to be enabled before clicking it.

Co-authored-by: Robert Oskamp <[email protected]>
  • Loading branch information
kibanamachine and pheyos authored Sep 14, 2021
1 parent dca10ce commit c37d750
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions x-pack/test/functional/services/ml/stack_management_jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function MachineLearningStackManagementJobsProvider(
},

async executeSync() {
await testSubjects.click('mlJobMgmtSyncFlyoutSyncButton', 2000);
await testSubjects.clickWhenNotDisabled('mlJobMgmtSyncFlyoutSyncButton', { timeout: 5000 });

// check and close success toast
const resultToast = await toasts.getToastElement(1);
Expand Down Expand Up @@ -285,7 +285,18 @@ export function MachineLearningStackManagementJobsProvider(
},

async importJobs() {
await testSubjects.click('mlJobMgmtImportImportButton', 1000);
await testSubjects.clickWhenNotDisabled('mlJobMgmtImportImportButton', { timeout: 5000 });

// check and close success toast
const resultToast = await toasts.getToastElement(1);
const titleElement = await testSubjects.findDescendant('euiToastHeader', resultToast);
const title: string = await titleElement.getVisibleText();
expect(title).to.match(/^\d+ job[s]? successfully imported$/);

const dismissButton = await testSubjects.findDescendant('toastCloseButton', resultToast);
await dismissButton.click();

// check that the flyout is closed
await testSubjects.missingOrFail('mlJobMgmtImportJobsFlyout', { timeout: 60 * 1000 });
},

Expand Down Expand Up @@ -340,7 +351,18 @@ export function MachineLearningStackManagementJobsProvider(
},

async selectExportJobs() {
await testSubjects.click('mlJobMgmtExportExportButton');
await testSubjects.clickWhenNotDisabled('mlJobMgmtExportExportButton', { timeout: 5000 });

// check and close success toast
const resultToast = await toasts.getToastElement(1);
const titleElement = await testSubjects.findDescendant('euiToastHeader', resultToast);
const title: string = await titleElement.getVisibleText();
expect(title).to.match(/^Your file is downloading in the background$/);

const dismissButton = await testSubjects.findDescendant('toastCloseButton', resultToast);
await dismissButton.click();

// check that the flyout is closed
await testSubjects.missingOrFail('mlJobMgmtExportJobsFlyout', { timeout: 60 * 1000 });
},

Expand Down

0 comments on commit c37d750

Please sign in to comment.