diff --git a/frontend_tests/puppeteer_tests/03-compose.ts b/frontend_tests/puppeteer_tests/03-compose.ts index 9f623edfc6..ee37795b84 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 { } async function test_reply_by_click_prepopulates_stream_topic_names(page: Page): Promise { - 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 7be89c5a2e..4f2cd8c7d4 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 { 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 { @@ -49,6 +51,8 @@ async function navigate_to_subscriptions(page: Page): Promise { 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 {