mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
This PR adds a retry to two service methods (clickActionsMenu & assertDateRangeSelection) in order to make them more robust against slow loading.
This commit is contained in:
parent
b91356118d
commit
00a3815903
8 changed files with 55 additions and 51 deletions
|
@ -6,8 +6,7 @@
|
|||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function({ loadTestFile }: FtrProviderContext) {
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/47312
|
||||
describe.skip('anomaly detection', function() {
|
||||
describe('anomaly detection', function() {
|
||||
loadTestFile(require.resolve('./single_metric_job'));
|
||||
loadTestFile(require.resolve('./multi_metric_job'));
|
||||
loadTestFile(require.resolve('./population_job'));
|
||||
|
|
|
@ -105,11 +105,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Feb 7, 2016 @ 00:00:00.000',
|
||||
'Feb 11, 2016 @ 23:59:54.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
@ -235,11 +238,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Feb 7, 2016 @ 00:00:00.000',
|
||||
'Feb 11, 2016 @ 23:59:54.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
|
|
@ -119,11 +119,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Jun 12, 2019 @ 00:04:19.000',
|
||||
'Jul 12, 2019 @ 23:45:36.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
@ -262,11 +265,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Jun 12, 2019 @ 00:04:19.000',
|
||||
'Jul 12, 2019 @ 23:45:36.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
|
|
@ -306,11 +306,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Feb 7, 2016 @ 00:00:00.000',
|
||||
'Feb 11, 2016 @ 23:59:54.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
|
|
@ -104,11 +104,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Feb 7, 2016 @ 00:00:00.000',
|
||||
'Feb 11, 2016 @ 23:59:54.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
@ -212,11 +215,14 @@ export default function({ getService }: FtrProviderContext) {
|
|||
await ml.jobWizardCommon.assertTimeRangeSectionExists();
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
it('sets the timerange', async () => {
|
||||
await ml.jobWizardCommon.clickUseFullDataButton(
|
||||
'Feb 7, 2016 @ 00:00:00.000',
|
||||
'Feb 11, 2016 @ 23:59:54.000'
|
||||
);
|
||||
});
|
||||
|
||||
it('displays the event rate chart', async () => {
|
||||
await ml.jobWizardCommon.assertEventRateChartExists();
|
||||
await ml.jobWizardCommon.assertEventRateChartHasData();
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';
|
|||
export function MachineLearningJobTableProvider({ getService }: FtrProviderContext) {
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
|
||||
return new (class MlJobTable {
|
||||
public async parseJobTable() {
|
||||
|
@ -141,34 +140,26 @@ export function MachineLearningJobTableProvider({ getService }: FtrProviderConte
|
|||
}
|
||||
|
||||
public async ensureDetailsOpen(jobId: string) {
|
||||
await retry.try(async () => {
|
||||
await retry.tryForTime(10000, async () => {
|
||||
if (!(await testSubjects.exists(this.detailsSelector(jobId)))) {
|
||||
await testSubjects.click(this.rowSelector(jobId, 'mlJobListRowDetailsToggle'));
|
||||
await testSubjects.existOrFail(this.detailsSelector(jobId), { timeout: 1000 });
|
||||
}
|
||||
|
||||
await testSubjects.existOrFail(this.detailsSelector(jobId));
|
||||
});
|
||||
}
|
||||
|
||||
public async ensureDetailsClosed(jobId: string) {
|
||||
await retry.try(async () => {
|
||||
await retry.tryForTime(10000, async () => {
|
||||
if (await testSubjects.exists(this.detailsSelector(jobId))) {
|
||||
await testSubjects.click(this.rowSelector(jobId, 'mlJobListRowDetailsToggle'));
|
||||
await testSubjects.missingOrFail(this.detailsSelector(jobId));
|
||||
await testSubjects.missingOrFail(this.detailsSelector(jobId), { timeout: 1000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async waitForJobsToLoad() {
|
||||
await retry.waitFor(
|
||||
'jobs table to exist',
|
||||
async () => await testSubjects.exists('~mlJobListTable')
|
||||
);
|
||||
|
||||
await retry.waitFor(
|
||||
'jobs table to be done loading',
|
||||
async () => await testSubjects.exists('mlJobListTable loaded')
|
||||
);
|
||||
await testSubjects.existOrFail('~mlJobListTable', { timeout: 60 * 1000 });
|
||||
await testSubjects.existOrFail('mlJobListTable loaded', { timeout: 30 * 1000 });
|
||||
}
|
||||
|
||||
public async filterWithSearchString(filter: string) {
|
||||
|
@ -215,10 +206,12 @@ export function MachineLearningJobTableProvider({ getService }: FtrProviderConte
|
|||
}
|
||||
|
||||
public async clickActionsMenu(jobId: string) {
|
||||
await testSubjects.click(this.rowSelector(jobId, 'euiCollapsedItemActionsButton'));
|
||||
if (!(await find.existsByDisplayedByCssSelector('[class~=euiContextMenuPanel]'))) {
|
||||
throw new Error(`expected euiContextMenuPanel to exist`);
|
||||
}
|
||||
retry.tryForTime(30 * 1000, async () => {
|
||||
if (!(await testSubjects.exists('mlActionButtonDeleteJob'))) {
|
||||
await testSubjects.click(this.rowSelector(jobId, 'euiCollapsedItemActionsButton'));
|
||||
await testSubjects.existOrFail('mlActionButtonDeleteJob', { timeout: 5000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async clickCloneJobAction(jobId: string) {
|
||||
|
|
|
@ -13,15 +13,8 @@ export function MachineLearningJobWizardCommonProvider({ getService }: FtrProvid
|
|||
const testSubjects = getService('testSubjects');
|
||||
|
||||
return {
|
||||
async waitForNextButtonVisible() {
|
||||
await retry.waitFor(
|
||||
'next button to be visible',
|
||||
async () => await testSubjects.isDisplayed('mlJobWizardNavButtonNext')
|
||||
);
|
||||
},
|
||||
|
||||
async clickNextButton() {
|
||||
await this.waitForNextButtonVisible();
|
||||
await testSubjects.existOrFail('mlJobWizardNavButtonNext');
|
||||
await testSubjects.clickWhenNotDisabled('mlJobWizardNavButtonNext');
|
||||
},
|
||||
|
||||
|
@ -283,9 +276,11 @@ export function MachineLearningJobWizardCommonProvider({ getService }: FtrProvid
|
|||
},
|
||||
|
||||
async assertDateRangeSelection(expectedStartDate: string, expectedEndDate: string) {
|
||||
expect(await this.getSelectedDateRange()).to.eql({
|
||||
startDate: expectedStartDate,
|
||||
endDate: expectedEndDate,
|
||||
await retry.tryForTime(5000, async () => {
|
||||
expect(await this.getSelectedDateRange()).to.eql({
|
||||
startDate: expectedStartDate,
|
||||
endDate: expectedEndDate,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -295,21 +290,17 @@ export function MachineLearningJobWizardCommonProvider({ getService }: FtrProvid
|
|||
},
|
||||
|
||||
async ensureAdvancedSectionOpen() {
|
||||
await retry.try(async () => {
|
||||
await retry.tryForTime(5000, async () => {
|
||||
if ((await testSubjects.exists('mlJobWizardAdvancedSection')) === false) {
|
||||
await testSubjects.click('mlJobWizardToggleAdvancedSection');
|
||||
await testSubjects.existOrFail('mlJobWizardAdvancedSection');
|
||||
await testSubjects.existOrFail('mlJobWizardAdvancedSection', { timeout: 1000 });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async createJobAndWaitForCompletion() {
|
||||
await testSubjects.clickWhenNotDisabled('mlJobWizardButtonCreateJob');
|
||||
await retry.waitForWithTimeout(
|
||||
'job processing to finish',
|
||||
5 * 60 * 1000,
|
||||
async () => await testSubjects.exists('mlJobWizardButtonRunInRealTime')
|
||||
);
|
||||
await testSubjects.existOrFail('mlJobWizardButtonRunInRealTime', { timeout: 5 * 60 * 1000 });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,22 +21,22 @@ export function MachineLearningNavigationProvider({
|
|||
},
|
||||
|
||||
async assertTabsExist(tabTypeSubject: string, areaSubjects: string[]) {
|
||||
await retry.try(async () => {
|
||||
await retry.tryForTime(10000, async () => {
|
||||
expect(await testSubjects.findAll(`~${tabTypeSubject}`, 3)).to.have.length(
|
||||
areaSubjects.length
|
||||
);
|
||||
for (const areaSubj of areaSubjects) {
|
||||
await testSubjects.existOrFail(`~${tabTypeSubject}&~${areaSubj}`);
|
||||
await testSubjects.existOrFail(`~${tabTypeSubject}&~${areaSubj}`, { timeout: 1000 });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async navigateToArea(linkSubject: string, pageSubject: string) {
|
||||
await retry.try(async () => {
|
||||
await retry.tryForTime(2 * 60 * 1000, async () => {
|
||||
if ((await testSubjects.exists(`${linkSubject} selected`)) === false) {
|
||||
await testSubjects.click(linkSubject);
|
||||
await testSubjects.existOrFail(`${linkSubject} selected`);
|
||||
await testSubjects.existOrFail(pageSubject);
|
||||
await testSubjects.existOrFail(`${linkSubject} selected`, { timeout: 30 * 1000 });
|
||||
await testSubjects.existOrFail(pageSubject, { timeout: 30 * 1000 });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue