@@ -82,19 +82,7 @@ async def test_nursing_book_content_warning_login(
8282 await nursing .click_maternal_newborn_book_view_online_link ()
8383 await nursing .click_nursing_content_warning_dialog_goto ()
8484
85- # to debug in CI - begin
86- await chrome_page_unlogged .wait_for_load_state ("domcontentloaded" )
87-
88- print (f"DEBUG URL after goto click: { chrome_page_unlogged .url } " )
89- print (f"DEBUG page title: { await chrome_page_unlogged .title ()} " )
90-
91- # Check if the element exists at all even if not visible
92- count = await chrome_page_unlogged .locator ("[class*='ContentWarning']" ).count ()
93- print (f"DEBUG ContentWarning count: { count } " )
94- # to debug in CI - ends
95-
9685 # THEN: Content warning dialog opens and user can log in
97- await nursing .nursing_material_warning_dialog .wait_for (state = "visible" )
9886 assert await nursing .nursing_material_warning_dialog .is_visible ()
9987
10088 if await nursing .nursing_content_warning_dialog_login .is_visible ():
@@ -107,20 +95,15 @@ async def test_nursing_book_content_warning_login(
10795
10896 await chrome_page_unlogged .keyboard .press ("Escape" )
10997
110- await nursing .nursing_material_warning_dialog .wait_for (state = "visible" )
111- assert await nursing .nursing_material_warning_dialog .is_visible ()
112-
113- await chrome_page_unlogged .wait_for_load_state ("domcontentloaded" )
114-
115- assert await nursing .nursing_material_warning_dialog .is_visible ()
116- await nursing .dismiss_nursing_material_warning_dialog ()
117-
118- await home .click_logged_in_user_dropdown ()
119- await home .logout_link_is_visible ()
98+ if await nursing .nursing_material_warning_dialog .is_visible ():
99+ await nursing .dismiss_nursing_material_warning_dialog ()
120100
121101 assert (
122102 "maternal-newborn-nursing/pages/1-introduction" in chrome_page_unlogged .url
123103 )
124104
105+ await home .click_logged_in_user_dropdown ()
106+ assert await home .logout_link_is_visible ()
107+
125108 else :
126109 pytest .fail ("Nursing content warning dialog is not visible" )
0 commit comments