retry reading suggestion list (#116405)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Joe Reuter 2021-10-28 09:36:52 +02:00 committed by GitHub
parent 3424f94fb4
commit 2b15dc9b10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -257,8 +257,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(value).to.eql('.es()');
});
// FLAKY: https://github.com/elastic/kibana/issues/116033
describe.skip('dynamic suggestions for argument values', () => {
describe('dynamic suggestions for argument values', () => {
describe('.es()', () => {
it('should show index pattern suggestions for index argument', async () => {
await monacoEditor.setCodeEditorValue('');

View file

@ -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()));
}