Skip to content

Commit

Permalink
retry reading suggestion list (elastic#116405) (elastic#116560)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Joe Reuter <[email protected]>
  • Loading branch information
kibanamachine and flash1293 authored Oct 28, 2021
1 parent b5fd8df commit 42b2083
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/functional/page_objects/timelion_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
*/

import { FtrService } from '../ftr_provider_context';
import type { WebElementWrapper } from '../services/lib/web_element_wrapper';

export class TimelionPageObject extends FtrService {
private readonly testSubjects = this.ctx.getService('testSubjects');
private readonly retry = this.ctx.getService('retry');

public async getSuggestionItemsText() {
const timelionCodeEditor = await this.testSubjects.find('timelionCodeEditor');
const lists = await timelionCodeEditor.findAllByClassName('monaco-list-row');
let lists: WebElementWrapper[] = [];
await this.retry.try(async () => {
const timelionCodeEditor = await this.testSubjects.find('timelionCodeEditor');
lists = await timelionCodeEditor.findAllByClassName('monaco-list-row');
if (lists.length === 0) {
throw new Error('suggestion list not populated');
}
});
return await Promise.all(lists.map(async (element) => await element.getVisibleText()));
}

Expand Down

0 comments on commit 42b2083

Please sign in to comment.