Skip to content

Commit

Permalink
[Lens] flaky gauge fix (#120724)
Browse files Browse the repository at this point in the history
* flaky fix

* flaky

* the other flakiness

* retrySetValue everywhere

* one option changed

* move to original order

* Update lens_page.ts
  • Loading branch information
mbondyra authored Dec 14, 2021
1 parent 518726a commit c97fc59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
33 changes: 9 additions & 24 deletions x-pack/test/functional/apps/lens/gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const testSubjects = getService('testSubjects');
const find = getService('find');
const retry = getService('retry');

// Failing: See https://github.com/elastic/kibana/issues/120670
describe.skip('lens gauge', () => {
describe('lens gauge', () => {
before(async () => {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVisType('lens');
Expand All @@ -34,7 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
operation: 'average',
field: 'bytes',
});

await PageObjects.lens.waitForVisualization();
});

Expand All @@ -51,18 +48,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('should reflect edits for gauge', async () => {
await PageObjects.lens.openVisualOptions();
await retry.try(async () => {
await testSubjects.setValue('lnsToolbarGaugeLabelMajor', 'custom title');
});
await retry.try(async () => {
await testSubjects.setValue('lnsToolbarGaugeLabelMinor-select', 'custom');
});
await retry.try(async () => {
await testSubjects.setValue('lnsToolbarGaugeLabelMinor', 'custom subtitle');
});

await PageObjects.lens.waitForVisualization();
await PageObjects.lens.configureDimension({
dimension: 'lnsGauge_metricDimensionPanel > lns-dimensionTrigger',
operation: 'count',
Expand All @@ -73,6 +58,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.setEuiSwitch('lnsDynamicColoringGaugeSwitch', 'check');
await PageObjects.lens.closeDimensionEditor();

await PageObjects.lens.openVisualOptions();
await PageObjects.lens.retrySetValue('lnsToolbarGaugeLabelMajor', 'custom title');
await PageObjects.lens.retrySetValue('lnsToolbarGaugeLabelMinor-select', 'custom', {});
await PageObjects.lens.retrySetValue('lnsToolbarGaugeLabelMinor', 'custom subtitle');

await PageObjects.lens.waitForVisualization();
await PageObjects.lens.openDimensionEditor(
'lnsGauge_goalDimensionPanel > lns-empty-dimension'
);
Expand All @@ -82,20 +73,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.openDimensionEditor(
'lnsGauge_minDimensionPanel > lns-empty-dimension-suggested-value'
);

await testSubjects.setValue('lns-indexPattern-static_value-input', '1000', {
clearWithKeyboard: true,
});
await PageObjects.lens.retrySetValue('lns-indexPattern-static_value-input', '1000');
await PageObjects.lens.waitForVisualization();
await PageObjects.lens.closeDimensionEditor();

await PageObjects.lens.openDimensionEditor(
'lnsGauge_maxDimensionPanel > lns-empty-dimension-suggested-value'
);

await testSubjects.setValue('lns-indexPattern-static_value-input', '25000', {
clearWithKeyboard: true,
});
await PageObjects.lens.retrySetValue('lns-indexPattern-static_value-input', '25000');
await PageObjects.lens.waitForVisualization();
await PageObjects.lens.closeDimensionEditor();

Expand Down
13 changes: 13 additions & 0 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,19 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
await testSubjects.exists('lnsVisualOptionsButton');
});
},
async retrySetValue(
input: string,
value: string,
options = {
clearWithKeyboard: true,
typeCharByChar: true,
} as Record<string, boolean>
) {
await retry.try(async () => {
await testSubjects.setValue(input, value, options);
expect(await (await testSubjects.find(input)).getAttribute('value')).to.eql(value);
});
},
async useCurvedLines() {
await testSubjects.click('lnsCurveStyleToggle');
},
Expand Down

0 comments on commit c97fc59

Please sign in to comment.