From c68604d76463983b4f980995b30e1d6b4cfd3a23 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 7 Dec 2020 14:04:03 +0200 Subject: [PATCH 1/2] [TSVB] Wait for markdown textarea to be cleaned --- .../functional/page_objects/visual_builder_page.ts | 14 +++++++++++--- 1 file changed, 11 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..47fae2f029bb1 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,22 @@ 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() { + await retry.waitFor('markdown text to be cleaned', async () => { + 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(); From b39dd7d1937f60c926760c8a3822ce087acb6423 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 7 Dec 2020 15:46:53 +0200 Subject: [PATCH 2/2] No need for retry --- test/functional/page_objects/visual_builder_page.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 47fae2f029bb1..5b07cb0e534db 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -155,12 +155,10 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro } public async waitForMarkdownTextAreaCleaned() { - await retry.waitFor('markdown text to be cleaned', async () => { - const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea'); - await input.clearValueWithKeyboard(); - const text = await this.getMarkdownText(); - return text.length === 0; - }); + const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea'); + await input.clearValueWithKeyboard(); + const text = await this.getMarkdownText(); + return text.length === 0; } public async getMarkdownText(): Promise {