[Lens] fixes the flakiness of the configureDimension function (#118518) (#118533)

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
Kibana Machine 2021-11-15 11:07:34 -05:00 committed by GitHub
parent 4c484728ee
commit edf0021c1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,9 +131,18 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
const operationSelector = opts.isPreviousIncompatible
? `lns-indexPatternDimension-${opts.operation} incompatible`
: `lns-indexPatternDimension-${opts.operation}`;
await retry.try(async () => {
await testSubjects.exists(operationSelector);
async function getAriaPressed() {
const operationSelectorContainer = await testSubjects.find(operationSelector);
await testSubjects.click(operationSelector, undefined, FORMULA_TAB_HEIGHT);
const ariaPressed = await operationSelectorContainer.getAttribute('aria-pressed');
return ariaPressed;
}
// adding retry here as it seems that there is a flakiness of the operation click
// it seems that the aria-pressed attribute is updated to true when the button is clicked
await retry.waitFor('aria pressed to be true', async () => {
const ariaPressedStatus = await getAriaPressed();
return ariaPressedStatus === 'true';
});
}
if (opts.field) {