Skip to content

Commit

Permalink
[Lens] Fix flaky test by closing options after use (#64714)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Wylie Conlon and elasticmachine authored Apr 29, 2020
1 parent 9fe7229 commit af2e86f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const find = getService('find');
const comboBox = getService('comboBox');
const PageObjects = getPageObjects([
'header',
'common',
Expand Down Expand Up @@ -107,20 +108,17 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
* @param opts.operation - the desired operation ID for the dimension
* @param opts.field - the desired field for the dimension
*/
async configureDimension(opts: { dimension: string; operation?: string; field?: string }) {
async configureDimension(opts: { dimension: string; operation: string; field: string }) {
await find.clickByCssSelector(opts.dimension);

if (opts.operation) {
await find.clickByCssSelector(
`[data-test-subj="lns-indexPatternDimensionIncompatible-${opts.operation}"],
[data-test-subj="lns-indexPatternDimension-${opts.operation}"]`
);
}
await find.clickByCssSelector(
`[data-test-subj="lns-indexPatternDimensionIncompatible-${opts.operation}"],
[data-test-subj="lns-indexPatternDimension-${opts.operation}"]`
);

if (opts.field) {
await testSubjects.click('indexPattern-dimension-field');
await testSubjects.click(`lns-fieldOption-${opts.field}`);
}
const target = await testSubjects.find('indexPattern-dimension-field');
await comboBox.openOptionsList(target);
await comboBox.setElement(target, opts.field);
},

/**
Expand Down

0 comments on commit af2e86f

Please sign in to comment.