mirror of
https://github.com/zulip/zulip.git
synced 2026-07-12 21:04:41 +08:00
puppeteer_tests: Rename navigate_to func to navigate_using_left_sidebar.
As we are using the 'navigate_to' function to navigate the links on the left sidebar, It'd be more clear to rename the function to 'navigate_using_left_sidebar'. Also adding '#left-sidebar' when selecting the element, to be sure it will select the element from the left sidebar.
This commit is contained in:
parent
e61f73c239
commit
c5f0806308
@ -9,9 +9,13 @@ async function wait_for_tab(page: Page, tab: string): Promise<void> {
|
||||
await page.waitForSelector(tab_slector, {visible: true});
|
||||
}
|
||||
|
||||
async function navigate_to(page: Page, click_target: string, tab: string): Promise<void> {
|
||||
async function navigate_using_left_sidebar(
|
||||
page: Page,
|
||||
click_target: string,
|
||||
tab: string,
|
||||
): Promise<void> {
|
||||
console.log("Visiting #" + click_target);
|
||||
await page.click(`a[href='#${CSS.escape(click_target)}']`);
|
||||
await page.click(`#left-sidebar a[href='#${CSS.escape(click_target)}']`);
|
||||
|
||||
await wait_for_tab(page, tab);
|
||||
}
|
||||
@ -80,7 +84,7 @@ async function navigation_tests(page: Page): Promise<void> {
|
||||
const verona_id = await page.evaluate(() => zulip_test.get_stream_id("Verona"));
|
||||
const verona_narrow = `narrow/stream/${verona_id}-Verona`;
|
||||
|
||||
await navigate_to(page, verona_narrow, "message_feed_container");
|
||||
await navigate_using_left_sidebar(page, verona_narrow, "message_feed_container");
|
||||
|
||||
// Hardcoded this instead of using `navigate_to`
|
||||
// as Puppeteer cannot click hidden elements.
|
||||
@ -88,11 +92,11 @@ async function navigation_tests(page: Page): Promise<void> {
|
||||
await wait_for_tab(page, "message_feed_container");
|
||||
|
||||
await navigate_to_subscriptions(page);
|
||||
await navigate_to(page, "all_messages", "message_feed_container");
|
||||
await navigate_using_left_sidebar(page, "all_messages", "message_feed_container");
|
||||
await navigate_to_settings(page);
|
||||
await navigate_to(page, "narrow/is/private", "message_feed_container");
|
||||
await navigate_using_left_sidebar(page, "narrow/is/private", "message_feed_container");
|
||||
await navigate_to_subscriptions(page);
|
||||
await navigate_to(page, verona_narrow, "message_feed_container");
|
||||
await navigate_using_left_sidebar(page, verona_narrow, "message_feed_container");
|
||||
|
||||
await test_reload_hash(page);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user