Skip to content

Commit

Permalink
[ML] Functional tests - stabilize import job test (#111929)
Browse files Browse the repository at this point in the history
This PR stabilizes the import job tests by giving the `Import` button some time to be enabled before clicking it.
  • Loading branch information
pheyos authored Sep 13, 2021
1 parent b7b593a commit c01ff06
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 c01ff06

Please sign in to comment.