mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
puppeteer: Fix dropdown click flake in admin.ts.
The reason for the flake was we were not waiting enough time for the dropdown to render search results when we type `rome` To fix this, We are waiting until the dropdown input value evaluates to be `rome`. We also update variable name from `verona_in_dropdown` to correct `rome_in_dropdown`.
This commit is contained in:
@@ -35,13 +35,19 @@ async function test_change_new_stream_notifications_setting(page: Page): Promise
|
|||||||
"#realm_notifications_stream_id_widget .dropdown-search > input[type=text]",
|
"#realm_notifications_stream_id_widget .dropdown-search > input[type=text]",
|
||||||
"rome",
|
"rome",
|
||||||
);
|
);
|
||||||
|
await page.waitForFunction(
|
||||||
|
() =>
|
||||||
|
$(
|
||||||
|
"#realm_notifications_stream_id_widget .dropdown-search > input[type=text]",
|
||||||
|
).val() === "rome",
|
||||||
|
);
|
||||||
|
|
||||||
const verona_in_dropdown = await page.waitForXPath(
|
const rome_in_dropdown = await page.waitForXPath(
|
||||||
'//*[@id="realm_notifications_stream_id_widget"]//*[@class="dropdown-list-body"]/li[1]',
|
'//*[@id="realm_notifications_stream_id_widget"]//*[@class="dropdown-list-body"]/li[1]',
|
||||||
{visible: true},
|
{visible: true},
|
||||||
);
|
);
|
||||||
assert.ok(verona_in_dropdown);
|
assert.ok(rome_in_dropdown);
|
||||||
await (verona_in_dropdown as ElementHandle<Element>).click();
|
await (rome_in_dropdown as ElementHandle<Element>).click();
|
||||||
|
|
||||||
await submit_notifications_stream_settings(page);
|
await submit_notifications_stream_settings(page);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user