3131 Meeting , SchedulingEvent , SessionStatusName )
3232from ietf .meeting .utils import add_event_info_to_session_qs
3333from ietf .utils .test_utils import assert_ical_response_is_valid
34- from ietf .utils .jstest import IetfSeleniumTestCase , ifSeleniumEnabled , selenium_enabled
34+ from ietf .utils .jstest import ( IetfSeleniumTestCase , ifSeleniumEnabled , selenium_enabled ,
35+ presence_of_element_child_by_css_selector )
3536from ietf import settings
3637
3738if selenium_enabled ():
@@ -1572,6 +1573,7 @@ def setUp(self):
15721573 sg_sess .save ()
15731574 sg_slot .save ()
15741575
1576+ self .wait = WebDriverWait (self .driver , 2 )
15751577
15761578 def tearDown (self ):
15771579 settings .AGENDA_PATH = self .saved_agenda_path
@@ -1647,7 +1649,7 @@ def assert_upcoming_meeting_visibility(self, visible_meetings=None):
16471649 def assert_upcoming_meeting_calendar (self , visible_meetings = None ):
16481650 """Assert that correct items are sent to the calendar"""
16491651 def advance_month ():
1650- button = WebDriverWait ( self .driver , 2 ) .until (
1652+ button = self .wait .until (
16511653 expected_conditions .element_to_be_clickable (
16521654 (By .CSS_SELECTOR , 'div#calendar button.fc-next-button' )))
16531655 self .scroll_to_element (button )
@@ -1850,8 +1852,6 @@ def test_upcoming_view_filter_whitespace(self):
18501852 self .do_upcoming_view_filter_test ('?show=mars , ames &hide= ames' , meetings )
18511853
18521854 def test_upcoming_view_time_zone_selection (self ):
1853- wait = WebDriverWait (self .driver , 2 )
1854-
18551855 def _assert_interim_tz_correct (sessions , tz ):
18561856 zone = pytz .timezone (tz )
18571857 for session in sessions :
@@ -1897,7 +1897,7 @@ def _assert_ietf_tz_correct(meetings, tz):
18971897 # wait for the select box to be updated - look for an arbitrary time zone to be in
18981898 # its options list to detect this
18991899 arbitrary_tz = 'America/Halifax'
1900- arbitrary_tz_opt = wait .until (
1900+ arbitrary_tz_opt = self . wait .until (
19011901 expected_conditions .presence_of_element_located (
19021902 (By .CSS_SELECTOR , '#timezone-select > option[value="%s"]' % arbitrary_tz )
19031903 )
@@ -1923,7 +1923,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19231923
19241924 # click 'utc' button
19251925 utc_tz_link .click ()
1926- wait .until (expected_conditions .element_to_be_selected (utc_tz_opt ))
1926+ self . wait .until (expected_conditions .element_to_be_selected (utc_tz_opt ))
19271927 self .assertFalse (local_tz_opt .is_selected ())
19281928 self .assertFalse (local_tz_bottom_opt .is_selected ())
19291929 self .assertFalse (arbitrary_tz_opt .is_selected ())
@@ -1935,7 +1935,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19351935
19361936 # click back to 'local'
19371937 local_tz_link .click ()
1938- wait .until (expected_conditions .element_to_be_selected (local_tz_opt ))
1938+ self . wait .until (expected_conditions .element_to_be_selected (local_tz_opt ))
19391939 self .assertTrue (local_tz_opt .is_selected ())
19401940 self .assertTrue (local_tz_bottom_opt .is_selected ())
19411941 self .assertFalse (arbitrary_tz_opt .is_selected ())
@@ -1947,7 +1947,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19471947
19481948 # Now select a different item from the select input
19491949 arbitrary_tz_opt .click ()
1950- wait .until (expected_conditions .element_to_be_selected (arbitrary_tz_opt ))
1950+ self . wait .until (expected_conditions .element_to_be_selected (arbitrary_tz_opt ))
19511951 self .assertFalse (local_tz_opt .is_selected ())
19521952 self .assertFalse (local_tz_bottom_opt .is_selected ())
19531953 self .assertTrue (arbitrary_tz_opt .is_selected ())
@@ -1960,7 +1960,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19601960 # Now repeat those tests using the widgets at the bottom of the page
19611961 # click 'utc' button
19621962 utc_tz_bottom_link .click ()
1963- wait .until (expected_conditions .element_to_be_selected (utc_tz_opt ))
1963+ self . wait .until (expected_conditions .element_to_be_selected (utc_tz_opt ))
19641964 self .assertFalse (local_tz_opt .is_selected ())
19651965 self .assertFalse (local_tz_bottom_opt .is_selected ())
19661966 self .assertFalse (arbitrary_tz_opt .is_selected ())
@@ -1972,7 +1972,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19721972
19731973 # click back to 'local'
19741974 local_tz_bottom_link .click ()
1975- wait .until (expected_conditions .element_to_be_selected (local_tz_opt ))
1975+ self . wait .until (expected_conditions .element_to_be_selected (local_tz_opt ))
19761976 self .assertTrue (local_tz_opt .is_selected ())
19771977 self .assertTrue (local_tz_bottom_opt .is_selected ())
19781978 self .assertFalse (arbitrary_tz_opt .is_selected ())
@@ -1984,7 +1984,7 @@ def _assert_ietf_tz_correct(meetings, tz):
19841984
19851985 # Now select a different item from the select input
19861986 arbitrary_tz_bottom_opt .click ()
1987- wait .until (expected_conditions .element_to_be_selected (arbitrary_tz_opt ))
1987+ self . wait .until (expected_conditions .element_to_be_selected (arbitrary_tz_opt ))
19881988 self .assertFalse (local_tz_opt .is_selected ())
19891989 self .assertFalse (local_tz_bottom_opt .is_selected ())
19901990 self .assertTrue (arbitrary_tz_opt .is_selected ())
@@ -1994,6 +1994,52 @@ def _assert_ietf_tz_correct(meetings, tz):
19941994 _assert_interim_tz_correct (sessions , arbitrary_tz )
19951995 _assert_ietf_tz_correct (ietf_meetings , arbitrary_tz )
19961996
1997+ def test_upcoming_materials_modal (self ):
1998+ """Test opening and closing a materals modal
1999+
2000+ This does not test dynamic reloading of the meeting materials - it relies on the main
2001+ agenda page testing that. If the materials modal handling diverges between here and
2002+ there, this should be updated to include that test.
2003+ """
2004+ url = self .absreverse ('ietf.meeting.views.upcoming' )
2005+ self .driver .get (url )
2006+
2007+ interim = self .displayed_interims (['mars' ])[0 ]
2008+ session = interim .session_set .first ()
2009+ assignment = session .official_timeslotassignment ()
2010+ slug = assignment .slug ()
2011+
2012+ # modal should start hidden
2013+ modal_div = self .driver .find_element_by_css_selector ('div#modal-%s' % slug )
2014+ self .assertFalse (modal_div .is_displayed ())
2015+
2016+ # Click the 'materials' button
2017+ open_modal_button = self .wait .until (
2018+ expected_conditions .element_to_be_clickable (
2019+ (By .CSS_SELECTOR , '[data-target="#modal-%s"]' % slug )
2020+ ),
2021+ 'Modal open button not found or not clickable' ,
2022+ )
2023+ open_modal_button .click ()
2024+ self .wait .until (
2025+ expected_conditions .visibility_of (modal_div ),
2026+ 'Modal did not become visible after clicking open button' ,
2027+ )
2028+
2029+ # Now close the modal
2030+ close_modal_button = self .wait .until (
2031+ presence_of_element_child_by_css_selector (
2032+ modal_div ,
2033+ '.modal-footer button[data-dismiss="modal"]' ,
2034+ ),
2035+ 'Modal close button not found or not clickable' ,
2036+ )
2037+ close_modal_button .click ()
2038+ self .wait .until (
2039+ expected_conditions .invisibility_of_element (modal_div ),
2040+ 'Modal was not hidden after clicking close button' ,
2041+ )
2042+
19972043
19982044# The following are useful debugging tools
19992045
0 commit comments