From 6713443c4b42e001fdf5e77c0482f8a98bd3ffd7 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Wed, 9 Dec 2020 12:30:18 +0200 Subject: [PATCH] [Functional][TSVB] Wait for markdown textarea to be cleaned (#85128) (#85371) * [TSVB] Wait for markdown textarea to be cleaned * No need for retry Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- test/functional/page_objects/visual_builder_page.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 0e305eaafc82f..5b07cb0e534db 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -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); } @@ -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 { const el = await find.byCssSelector('.tvbEditorVisualization'); const text = await el.getVisibleText();