From cb6c60ef7ab2aadb665dc5051e5e8c2e9f70323c Mon Sep 17 00:00:00 2001 From: evykassirer Date: Wed, 6 Nov 2024 17:05:55 -0800 Subject: [PATCH] stream_create: Fix puppeteer test flake from modal reopening. In 245357c86800e5a2ceb418d1d56d2c6cd80ba791 we added a redirect after stream creation, to go to the stream feed. This means the stream settings modal was closed partway through the tests. This caused a flake where when the modal was reopened it was not always open by the time we fetched the stream name. The main fix in this commit is changing the classname for the stream in the modal to be more specific (`stream-name` can also be found in the left sidebar in many places) and waiting for it to be visible again before getting text from it. More discussion here: https://chat.zulip.org/#narrow/channel/43-automated-testing/topic/stream.20create.20puppeteer.20failure/near/1976724 Co-authored-by: Anders Kaseorg --- web/e2e-tests/stream_create.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/e2e-tests/stream_create.test.ts b/web/e2e-tests/stream_create.test.ts index 1f2ffec7a6..20a9fd04d8 100644 --- a/web/e2e-tests/stream_create.test.ts +++ b/web/e2e-tests/stream_create.test.ts @@ -96,11 +96,19 @@ async function create_stream(page: Page): Promise { await common.wait_for_micromodal_to_open(page); await page.click(".dialog_submit_button"); await common.wait_for_micromodal_to_close(page); + + // We redirect to the channel message view. + await page.waitForSelector("#subscription_overlay", {hidden: true}); + await page.waitForSelector( + `xpath///*[${common.has_class_x("message-header-navbar-title")} and text()="Puppeteer"]`, + ); + await page.waitForSelector(".message-header-stream-settings-button"); await page.click(".message-header-stream-settings-button"); await page.waitForSelector(".stream_section"); await page.waitForSelector( - `xpath///*[${common.has_class_x("stream-name")} and text()="Puppeteer"]`, + `xpath///*[${common.has_class_x("stream-name-title")} and text()="Puppeteer"]`, + {visible: true}, ); const stream_name = await common.get_text_from_selector( page,