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.

puppeteer: Wait for bot data before user_id lookup.

Aman Agrawale46fffe89620
diff --git a/web/e2e-tests/settings.test.ts b/web/e2e-tests/settings.test.ts
index 5bdd68cb2ee..284a559b929 100644
--- a/web/e2e-tests/settings.test.ts
+++ b/web/e2e-tests/settings.test.ts
@@ -138,6 +138,13 @@ async function test_webhook_bot_creation(page: Page): Promise<void> {
await page.click(".micromodal .dialog_submit_button");
await common.wait_for_micromodal_to_close(page);
+ // Wait for the bot to appear in the local data store, since the
+ // bot_add event may not have been processed yet when the modal closes.
+ await page.waitForFunction(
+ (bot_name: string) => zulip_test.get_user_id_from_name(bot_name) !== undefined,
+ {},
+ "Bot 1",
+ );
const user_id = await common.get_user_id_from_name(page, "Bot 1");
await open_manage_bot_tab(page, user_id!);
@@ -188,6 +195,13 @@ async function test_normal_bot_creation(page: Page): Promise<void> {
await page.click(".micromodal .dialog_submit_button");
await common.wait_for_micromodal_to_close(page);
+ // Wait for the bot to appear in the local data store, since the
+ // bot_add event may not have been processed yet when the modal closes.
+ await page.waitForFunction(
+ (bot_name: string) => zulip_test.get_user_id_from_name(bot_name) !== undefined,
+ {},
+ "Bot 2",
+ );
const user_id = await common.get_user_id_from_name(page, "Bot 2");
await open_manage_bot_tab(page, user_id!);