@@ -225,6 +225,54 @@ def test_edit_meeting_schedule(self):
225225
226226 self .assertTrue (self .driver .find_elements_by_css_selector ('#timeslot{} #session{}' .format (slot4 .pk , s1 .pk )))
227227
228+ def test_unassigned_sessions_drop_target_visible_when_empty (self ):
229+ """The drop target for unassigned sessions should not collapse to 0 size
230+
231+ This test checks that issue #3174 has not regressed. A test that exercises
232+ moving items from the schedule into the unassigned-sessions area is needed,
233+ but as of 2021-05-04, Selenium does not support the HTML5 drag-and-drop
234+ event interface. See:
235+
236+ https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604
237+ https://gist.github.com/rcorreia/2362544
238+
239+ Note, however, that the workarounds are inadequate - they do not handle
240+ all of the events needed by the editor.
241+ """
242+ # Set up a meeting and a schedule a plain user can edit
243+ meeting = make_meeting_test_data ()
244+ schedule = Schedule .objects .filter (meeting = meeting , owner__user__username = "plain" ).first ()
245+ sessions = meeting .session_set .filter (type_id = 'regular' )
246+ timeslots = meeting .timeslot_set .filter (type_id = 'regular' )
247+ self .assertGreaterEqual (timeslots .count (), sessions .count (),
248+ 'Need a timeslot for each session' )
249+ for index , session in enumerate (sessions ):
250+ SchedTimeSessAssignment .objects .create (
251+ schedule = schedule ,
252+ timeslot = timeslots [index ],
253+ session = session ,
254+ )
255+
256+ # Open the editor
257+ self .login ()
258+ url = self .absreverse (
259+ 'ietf.meeting.views.edit_meeting_schedule' ,
260+ kwargs = dict (num = meeting .number , name = schedule .name , owner = schedule .owner_email ())
261+ )
262+ self .driver .get (url )
263+
264+ # Check that the drop target for unassigned sessions is actually empty
265+ drop_target = self .driver .find_element_by_css_selector (
266+ '.unassigned-sessions .drop-target'
267+ )
268+ self .assertEqual (len (drop_target .find_elements_by_class_name ('session' )), 0 ,
269+ 'Unassigned sessions box is not empty, test is broken' )
270+
271+ # Check that the drop target has non-zero size
272+ self .assertGreater (drop_target .size ['height' ], 0 ,
273+ 'Drop target for unassigned sessions collapsed to 0 height' )
274+ self .assertGreater (drop_target .size ['width' ], 0 ,
275+ 'Drop target for unassigned sessions collapsed to 0 width' )
228276
229277@ifSeleniumEnabled
230278@skipIf (django .VERSION [0 ]== 2 , "Skipping test with race conditions under Django 2" )
0 commit comments