Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Fix flaky drafts tests.

Aman Agrawal781473414f38
diff --git a/web/e2e-tests/drafts.test.ts b/web/e2e-tests/drafts.test.ts
index b2d241a70d2..7d836d27244 100644
--- a/web/e2e-tests/drafts.test.ts
+++ b/web/e2e-tests/drafts.test.ts
@@ -37,9 +37,17 @@ async function create_stream_message_draft(page: Page): Promise<void> {
await page.waitForSelector("#stream_message_recipient_topic", {visible: true});
await common.select_stream_in_compose_via_dropdown(page, "Denmark");
await common.fill_form(page, "form#send_message_form", {
- stream_message_recipient_topic: "tests",
content: "Test stream message.",
});
+ await page.type("#stream_message_recipient_topic", "tests", {delay: 100});
+
+ // Ideally, we don't need to click on the typeahead to create a draft with this topic but
+ // the typeahead seems bugged and remains open in the next compose session even after it
+ // is being closed via clicking on #compose_close.
+ const entry = await page.waitForSelector('.typeahead[style*="display: block"] .active a', {
+ visible: true,
+ });
+ await entry!.click();
await page.click("#compose_close");
}