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_test: Add missing `waitFor` to avoid occasional flakes.

Riken Shah812d563bd450
diff --git a/frontend_tests/puppeteer_tests/03-compose.ts b/frontend_tests/puppeteer_tests/03-compose.ts
index 9f623edfc6d..ee37795b848 100644
--- a/frontend_tests/puppeteer_tests/03-compose.ts
+++ b/frontend_tests/puppeteer_tests/03-compose.ts
@@ -59,9 +59,9 @@ async function test_keyboard_shortcuts(page: Page): Promise<void> {
}
async function test_reply_by_click_prepopulates_stream_topic_names(page: Page): Promise<void> {
- const stream_message = get_last_element(
- await page.$x(get_message_xpath("Compose stream reply test")),
- );
+ const stream_message_xpath = get_message_xpath("Compose stream reply test");
+ await page.waitForXPath(stream_message_xpath, {visible: true});
+ const stream_message = get_last_element(await page.$x(stream_message_xpath));
// we chose only the last element make sure we don't click on any duplicates.
await stream_message.click();
await common.check_form_contents(page, "#send_message_form", {
diff --git a/frontend_tests/puppeteer_tests/07-navigation.ts b/frontend_tests/puppeteer_tests/07-navigation.ts
index 7be89c5a2e8..4f2cd8c7d47 100644
--- a/frontend_tests/puppeteer_tests/07-navigation.ts
+++ b/frontend_tests/puppeteer_tests/07-navigation.ts
@@ -34,6 +34,8 @@ async function navigate_to_settings(page: Page): Promise<void> {
await page.waitForSelector("#settings_page", {visible: true});
await page.click("#settings_page .content-wrapper .exit");
+ // Wait until the overlay is completely closed.
+ await page.waitForSelector("#settings_overlay_container", {hidden: true});
}
async function navigate_to_subscriptions(page: Page): Promise<void> {
@@ -49,6 +51,8 @@ async function navigate_to_subscriptions(page: Page): Promise<void> {
await page.waitForSelector("#subscriptions_table", {visible: true});
await page.click("#subscription_overlay .exit");
+ // Wait until the overlay is completely closed.
+ await page.waitForSelector("#settings_overlay_container", {hidden: true});
}
async function test_reload_hash(page: Page): Promise<void> {