Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed May 12, 2022
1 parent 59cdde3 commit 9c55499
Showing 1 changed file with 42 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import expect from '@kbn/expect';
import {
OPTIONS_LIST_CONTROL,
RANGE_SLIDER_CONTROL,
/** Because the time slider is temporarily disabled as of https://github.com/elastic/kibana/pull/130978,
** I simply commented out the time slider tests for now :) **/
// TIME_SLIDER_CONTROL,
TIME_SLIDER_CONTROL,
} from '@kbn/controls-plugin/common';

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');

const { dashboardControls, timePicker, common, dashboard } = getPageObjects([
'dashboardControls',
'timePicker',
Expand All @@ -46,16 +46,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const replaceWithRangeSlider = async (controlId: string) => {
await dashboardControls.controlEditorSetType(RANGE_SLIDER_CONTROL);
await changeFieldType('weightLbs');
await dashboardControls.rangeSliderWaitForLoading();
await dashboardControls.verifyControlType(controlId, 'range-slider-control');
await retry.try(async () => {
await dashboardControls.rangeSliderWaitForLoading();
await dashboardControls.verifyControlType(controlId, 'range-slider-control');
});
};

// const replaceWithTimeSlider = async (controlId: string) => {
// await dashboardControls.controlEditorSetType(TIME_SLIDER_CONTROL);
// await changeFieldType('@timestamp');
// await testSubjects.waitForDeleted('timeSlider-loading-spinner');
// await dashboardControls.verifyControlType(controlId, 'timeSlider');
// };
const replaceWithTimeSlider = async (controlId: string) => {
await dashboardControls.controlEditorSetType(TIME_SLIDER_CONTROL);
await changeFieldType('@timestamp');
await testSubjects.waitForDeleted('timeSlider-loading-spinner');
await dashboardControls.verifyControlType(controlId, 'timeSlider');
};

describe('Replacing controls', async () => {
let controlId: string;
Expand Down Expand Up @@ -83,9 +85,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await replaceWithRangeSlider(controlId);
});

// it('with time slider', async () => {
// await replaceWithTimeSlider(controlId);
// });
/** Because the time slider is temporarily disabled as of https://github.com/elastic/kibana/pull/130978,
** I simply skipped all time slider tests for now :) **/
it.skip('with time slider', async () => {
await replaceWithTimeSlider(controlId);
});
});

describe('Replace range slider', async () => {
Expand All @@ -105,31 +109,31 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await replaceWithOptionsList(controlId);
});

// it('with time slider', async () => {
// await replaceWithTimeSlider(controlId);
// });
it.skip('with time slider', async () => {
await replaceWithTimeSlider(controlId);
});
});

// describe('Replace time slider', async () => {
// beforeEach(async () => {
// await dashboardControls.clearAllControls();
// await dashboardControls.createControl({
// controlType: TIME_SLIDER_CONTROL,
// dataViewTitle: 'animals-*',
// fieldName: '@timestamp',
// });
// await testSubjects.waitForDeleted('timeSlider-loading-spinner');
// controlId = (await dashboardControls.getAllControlIds())[0];
// await dashboardControls.editExistingControl(controlId);
// });

// it('with options list', async () => {
// await replaceWithOptionsList(controlId);
// });

// it('with range slider', async () => {
// await replaceWithRangeSlider(controlId);
// });
// });
describe.skip('Replace time slider', async () => {
beforeEach(async () => {
await dashboardControls.clearAllControls();
await dashboardControls.createControl({
controlType: TIME_SLIDER_CONTROL,
dataViewTitle: 'animals-*',
fieldName: '@timestamp',
});
await testSubjects.waitForDeleted('timeSlider-loading-spinner');
controlId = (await dashboardControls.getAllControlIds())[0];
await dashboardControls.editExistingControl(controlId);
});

it('with options list', async () => {
await replaceWithOptionsList(controlId);
});

it('with range slider', async () => {
await replaceWithRangeSlider(controlId);
});
});
});
}

0 comments on commit 9c55499

Please sign in to comment.