[Functional][TSVB] Wait for markdown textarea to be cleaned (#85128)

* [TSVB] Wait for markdown textarea to be cleaned

* No need for retry
This commit is contained in:
Stratoula Kalafateli 2020-12-09 08:42:35 +02:00 committed by GitHub
parent 7bed867229
commit f2d961df6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,8 +131,8 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
} }
public async enterMarkdown(markdown: string) { public async enterMarkdown(markdown: string) {
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await this.clearMarkdown(); await this.clearMarkdown();
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
await input.type(markdown); await input.type(markdown);
await PageObjects.common.sleep(3000); await PageObjects.common.sleep(3000);
} }
@ -147,14 +147,20 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
const value = $('.ace_line').text(); const value = $('.ace_line').text();
if (value.length > 0) { if (value.length > 0) {
log.debug('Clearing text area input'); log.debug('Clearing text area input');
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea'); this.waitForMarkdownTextAreaCleaned();
await input.clearValueWithKeyboard();
} }
return value.length === 0; 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> { public async getMarkdownText(): Promise<string> {
const el = await find.byCssSelector('.tvbEditorVisualization'); const el = await find.byCssSelector('.tvbEditorVisualization');
const text = await el.getVisibleText(); const text = await el.getVisibleText();