puppeteer: Fix flaky wait for narrow change after sending a message.

This flake was happening since `wait_for_fully_processed_message`
only checks if the `star` icon is displayed on the message but
doesn't check for current narrow or waits for the narrow to
change.

Since narrow is changed to the message narrow after sending a
message. If we don't wait for narrow to change, this narrow change
can make the `get_current_msg_list_id` call return true for the
wrong narrow change. Which causes message list id of the wrong
message list to be returned and hence we cannot locate this
message list id.

To fix it, we check if sending this message will cause a narrow
change and if true, we wait for the narrow to change before
checking if the message is visible.
This commit is contained in:
Aman Agrawal
2024-10-07 08:09:46 +00:00
parent 882e4f56c1
commit dae2a68ad9
6 changed files with 50 additions and 31 deletions

View File

@@ -517,27 +517,23 @@ async function message_basic_tests(page: Page): Promise<void> {
stream_name: "Verona",
topic: "other topic",
content: "verona other topic c",
outside_view: true,
},
{stream_name: "Denmark", topic: "test", content: "denmark message", outside_view: true},
{stream_name: "Denmark", topic: "test", content: "denmark message"},
{
recipient: "cordelia@zulip.com, hamlet@zulip.com",
content: "group direct message a",
outside_view: true,
},
{
recipient: "cordelia@zulip.com, hamlet@zulip.com",
content: "group direct message b",
outside_view: true,
},
{recipient: "cordelia@zulip.com", content: "direct message c", outside_view: true},
{recipient: "cordelia@zulip.com", content: "direct message c"},
{stream_name: "Verona", topic: "test", content: "verona test d"},
{
recipient: "cordelia@zulip.com, hamlet@zulip.com",
content: "group direct message d",
outside_view: true,
},
{recipient: "cordelia@zulip.com", content: "direct message e", outside_view: true},
{recipient: "cordelia@zulip.com", content: "direct message e"},
]);
await page.click("#left-sidebar-navigation-list .top_left_all_messages");