@@ -273,7 +273,9 @@ async def test_on_load_navigate(
273273 link .click ()
274274 assert urlsplit (driver .current_url ).path == f"/page/{ ix } "
275275
276- link = driver .find_element (By .ID , "link_page_next" )
276+ link = dynamic_route .poll_for_result (
277+ lambda : driver .find_element (By .ID , "link_page_next" )
278+ )
277279 page_id_input = driver .find_element (By .ID , "page_id" )
278280 raw_path_input = driver .find_element (By .ID , "raw_path" )
279281
@@ -283,7 +285,7 @@ async def test_on_load_navigate(
283285 assert dynamic_route .poll_for_value (
284286 page_id_input , exp_not_equal = str (ix - 1 )
285287 ) == str (ix )
286- assert dynamic_route .poll_for_value (raw_path_input ) == f"/page/{ ix } / "
288+ assert dynamic_route .poll_for_value (raw_path_input ) == f"/page/{ ix } "
287289 await poll_for_order (exp_order )
288290
289291 # manually load the next page to trigger client side routing in prod mode
@@ -341,7 +343,7 @@ async def test_on_load_navigate(
341343 driver .get (f"{ dynamic_route .frontend_url } /redirect-page/0/?foo=bar" )
342344 await poll_for_order (exp_order )
343345 # should have redirected back to page 0
344- assert urlsplit (driver .current_url ).path == "/page/0/ "
346+ assert urlsplit (driver .current_url ).path . removesuffix ( "/" ) == "/page/0"
345347
346348
347349@pytest .mark .asyncio
@@ -370,12 +372,12 @@ async def test_on_load_navigate_non_dynamic(
370372 link = driver .find_element (By .ID , "link_index" )
371373 with poll_for_navigation (driver ):
372374 link .click ()
373- assert urlsplit (driver .current_url ).path == "/ "
375+ assert urlsplit (driver .current_url ).path . removesuffix ( "/" ) == ""
374376
375377 link = driver .find_element (By .ID , "link_page_x" )
376378 with poll_for_navigation (driver ):
377379 link .click ()
378- assert urlsplit (driver .current_url ).path == "/static/x/ "
380+ assert urlsplit (driver .current_url ).path . removesuffix ( "/" ) == "/static/x"
379381 await poll_for_order (["/static/x-no page id" , "/static/x-no page id" ])
380382
381383
@@ -422,11 +424,11 @@ def assert_content(expected: str, expect_not: str):
422424 assert next_page_link
423425 with poll_for_navigation (driver ):
424426 next_page_link .click ()
425- assert driver .current_url == f"{ dynamic_route .frontend_url } /arg/1/ "
427+ assert driver .current_url . removesuffix ( "/" ) == f"{ dynamic_route .frontend_url } /arg/1"
426428 assert_content ("1" , "0" )
427429 next_page_link = driver .find_element (By .ID , "next-page" )
428430 assert next_page_link
429431 with poll_for_navigation (driver ):
430432 next_page_link .click ()
431- assert driver .current_url == f"{ dynamic_route .frontend_url } /arg/2/ "
433+ assert driver .current_url . removesuffix ( "/" ) == f"{ dynamic_route .frontend_url } /arg/2"
432434 assert_content ("2" , "1" )
0 commit comments