puppeteer_test: Add missing `waitFor` to avoid occasional flakes.

This commit is contained in:
Riken Shah 2021-03-12 17:00:25 +05:30 committed by Anders Kaseorg
parent 6421c1d8d9
commit 812d563bd4
2 changed files with 7 additions and 3 deletions

View File

@ -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", {

View File

@ -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> {