Skip to content

Commit

Permalink
[TSVB] Wait for markdown textarea to be cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Dec 7, 2020
1 parent 446390d commit c68604d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 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,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<string> {
const el = await find.byCssSelector('.tvbEditorVisualization');
const text = await el.getVisibleText();
Expand Down

0 comments on commit c68604d

Please sign in to comment.