Skip to content

Commit

Permalink
[Functional][TSVB] Wait for markdown textarea to be cleaned (elastic#…
Browse files Browse the repository at this point in the history
…85128) (elastic#85371)

* [TSVB] Wait for markdown textarea to be cleaned

* No need for retry

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine committed Dec 9, 2020
1 parent a275443 commit 6713443
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
}

public async enterMarkdown(markdown: string) {
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await this.clearMarkdown();
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await input.type(markdown);
await PageObjects.common.sleep(3000);
}
Expand All @@ -147,14 +147,20 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
const value = $('.ace_line').text();
if (value.length > 0) {
log.debug('Clearing text area input');
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await input.clearValueWithKeyboard();
this.waitForMarkdownTextAreaCleaned();
}

return value.length === 0;
});
}

public async waitForMarkdownTextAreaCleaned() {
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await input.clearValueWithKeyboard();
const text = await this.getMarkdownText();
return text.length === 0;
}

public async getMarkdownText(): Promise<string> {
const el = await find.byCssSelector('.tvbEditorVisualization');
const text = await el.getVisibleText();
Expand Down

0 comments on commit 6713443

Please sign in to comment.