forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests_js.py
More file actions
2775 lines (2368 loc) · 129 KB
/
tests_js.py
File metadata and controls
2775 lines (2368 loc) · 129 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright The IETF Trust 2014-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import time
import datetime
import shutil
import os
import re
from unittest import skipIf
import django
from django.utils.text import slugify
from django.utils.timezone import now
from django.db.models import F
import pytz
from django.conf import settings
from django.test.utils import override_settings
import debug # pyflakes:ignore
from ietf.doc.factories import DocumentFactory
from ietf.doc.models import State
from ietf.group import colors
from ietf.person.models import Person
from ietf.group.models import Group
from ietf.group.factories import GroupFactory
from ietf.meeting.factories import ( MeetingFactory, RoomFactory, SessionFactory, TimeSlotFactory,
ProceedingsMaterialFactory, ScheduleFactory, ConstraintFactory )
from ietf.meeting.test_data import make_meeting_test_data, make_interim_meeting
from ietf.meeting.models import (Schedule, SchedTimeSessAssignment, Session,
Room, TimeSlot, Constraint, ConstraintName,
Meeting, SchedulingEvent, SessionStatusName)
from ietf.meeting.utils import add_event_info_to_session_qs
from ietf.utils.test_utils import assert_ical_response_is_valid
from ietf.utils.jstest import ( IetfSeleniumTestCase, ifSeleniumEnabled, selenium_enabled,
presence_of_element_child_by_css_selector )
if selenium_enabled():
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.common.exceptions import NoSuchElementException, TimeoutException
@ifSeleniumEnabled
@override_settings(MEETING_SESSION_LOCK_TIME=datetime.timedelta(minutes=10))
class EditMeetingScheduleTests(IetfSeleniumTestCase):
def test_edit_meeting_schedule(self):
meeting = make_meeting_test_data()
schedule = Schedule.objects.filter(meeting=meeting, owner__user__username="plain").first()
room1 = Room.objects.get(name="Test Room")
slot1 = TimeSlot.objects.filter(meeting=meeting, location=room1, type='regular').order_by('time').first()
slot1b = TimeSlot.objects.filter(meeting=meeting, location=room1, type='regular').order_by('time').last()
self.assertNotEqual(slot1.pk, slot1b.pk)
room2 = Room.objects.create(meeting=meeting, name="Test Room2", capacity=1)
room2.session_types.add('regular')
slot2 = TimeSlot.objects.create(
meeting=meeting,
type_id='regular',
location=room2,
duration=datetime.timedelta(hours=2),
time=slot1.time - datetime.timedelta(minutes=10),
)
slot3 = TimeSlot.objects.create(
meeting=meeting,
type_id='regular',
location=room2,
duration=datetime.timedelta(hours=2),
time=max(slot1.end_time(), slot2.end_time()) + datetime.timedelta(minutes=10),
)
slot4 = TimeSlot.objects.create(
meeting=meeting,
type_id='regular',
location=room1,
duration=datetime.timedelta(hours=2),
time=slot1.time + datetime.timedelta(days=1),
)
s1, s2 = Session.objects.filter(meeting=meeting, type='regular')
s2.requested_duration = slot2.duration + datetime.timedelta(minutes=10)
s2.save()
SchedTimeSessAssignment.objects.filter(session=s1).delete()
s2b = SessionFactory(
meeting=meeting,
group=s2.group,
attendees=10,
requested_duration=datetime.timedelta(minutes=60),
add_to_schedule=False,
)
SchedulingEvent.objects.create(
session=s2b,
status=SessionStatusName.objects.get(slug='appr'),
by=Person.objects.get(name='(System)'),
)
Constraint.objects.create(
meeting=meeting,
source=s1.group,
target=s2.group,
name=ConstraintName.objects.get(slug="conflict"),
)
self.login()
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule', kwargs=dict(num=meeting.number, name=schedule.name, owner=schedule.owner_email()))
self.driver.get(url)
WebDriverWait(self.driver, 2).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '.edit-meeting-schedule')))
self.assertEqual(len(self.driver.find_elements(By.CSS_SELECTOR, '.session.purpose-regular')), 3)
# select - show session info
s2_element = self.driver.find_element(By.CSS_SELECTOR, '#session{}'.format(s2.pk))
s2b_element = self.driver.find_element(By.CSS_SELECTOR, '#session{}'.format(s2b.pk))
self.assertNotIn('other-session-selected', s2b_element.get_attribute('class'))
s2_element.click()
# other session for group should be flagged for highlighting
s2b_element = self.driver.find_element(By.CSS_SELECTOR, '#session{}'.format(s2b.pk))
self.assertIn('other-session-selected', s2b_element.get_attribute('class'))
# other session for group should appear in the info panel
session_info_container = self.driver.find_element(By.CSS_SELECTOR, '.session-info-container')
self.assertIn(s2.group.acronym, session_info_container.find_element(By.CSS_SELECTOR, ".title").text)
self.assertEqual(session_info_container.find_element(By.CSS_SELECTOR, ".other-session .time").text, "not yet scheduled")
# deselect
self.driver.find_element(By.CSS_SELECTOR, '.scheduling-panel').click()
self.assertEqual(session_info_container.find_elements(By.CSS_SELECTOR, ".title"), [])
self.assertNotIn('other-session-selected', s2b_element.get_attribute('class'))
# unschedule
# we would like to do
#
# unassigned_sessions_element = self.driver.find_element(By.CSS_SELECTOR, '.unassigned-sessions')
# ActionChains(self.driver).drag_and_drop(s2_element, unassigned_sessions_element).perform()
#
# but unfortunately, Selenium does not simulate drag and drop events, see
#
# https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604
#
# so for the time being we inject the Javascript workaround here and do it from JS
#
# https://storage.googleapis.com/google-code-attachments/selenium/issue-3604/comment-9/drag_and_drop_helper.js
self.driver.execute_script('!function(s){s.fn.simulateDragDrop=function(t){return this.each(function(){new s.simulateDragDrop(this,t)})},s.simulateDragDrop=function(t,a){this.options=a,this.simulateEvent(t,a)},s.extend(s.simulateDragDrop.prototype,{simulateEvent:function(t,a){var e="dragstart",n=this.createEvent(e);this.dispatchEvent(t,e,n),e="drop";var r=this.createEvent(e,{});r.dataTransfer=n.dataTransfer,this.dispatchEvent(s(a.dropTarget)[0],e,r),e="dragend";var i=this.createEvent(e,{});i.dataTransfer=n.dataTransfer,this.dispatchEvent(t,e,i)},createEvent:function(t){var a=document.createEvent("CustomEvent");return a.initCustomEvent(t,!0,!0,null),a.dataTransfer={data:{},setData:function(t,a){this.data[t]=a},getData:function(t){return this.data[t]}},a},dispatchEvent:function(t,a,e){t.dispatchEvent?t.dispatchEvent(e):t.fireEvent&&t.fireEvent("on"+a,e)}})}(jQuery);')
self.driver.execute_script("jQuery('#session{}').simulateDragDrop({{dropTarget: '.unassigned-sessions .drop-target'}});".format(s2.pk))
WebDriverWait(self.driver, 2).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '.unassigned-sessions #session{}'.format(s2.pk))))
self.assertEqual(list(SchedTimeSessAssignment.objects.filter(session=s2, schedule=schedule)), [])
# sorting unassigned
sorted_pks = [s.pk for s in sorted([s1, s2, s2b], key=lambda s: (s.group.acronym, s.requested_duration, s.pk))]
self.driver.find_element(By.CSS_SELECTOR, '[name=sort_unassigned] option[value=name]').click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, '.unassigned-sessions .drop-target #session{} + #session{} + #session{}'.format(*sorted_pks)))
sorted_pks = [s.pk for s in sorted([s1, s2, s2b], key=lambda s: (s.group.parent.acronym, s.group.acronym, s.requested_duration, s.pk))]
self.driver.find_element(By.CSS_SELECTOR, '[name=sort_unassigned] option[value=parent]').click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, '.unassigned-sessions .drop-target #session{} + #session{}'.format(*sorted_pks)))
sorted_pks = [s.pk for s in sorted([s1, s2, s2b], key=lambda s: (s.requested_duration, s.group.parent.acronym, s.group.acronym, s.pk))]
self.driver.find_element(By.CSS_SELECTOR, '[name=sort_unassigned] option[value=duration]').click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, '.unassigned-sessions .drop-target #session{} ~ #session{}'.format(*sorted_pks)))
sorted_pks = [s.pk for s in sorted([s1, s2, s2b], key=lambda s: (int(bool(s.comments)), s.group.parent.acronym, s.group.acronym, s.requested_duration, s.pk))]
self.driver.find_element(By.CSS_SELECTOR, '[name=sort_unassigned] option[value=comments]').click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, '.unassigned-sessions .drop-target #session{} + #session{}'.format(*sorted_pks)))
# schedule
self.driver.execute_script("jQuery('#session{}').simulateDragDrop({{dropTarget: '#timeslot{} .drop-target'}});".format(s2.pk, slot1.pk))
WebDriverWait(self.driver, 2).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '#timeslot{} #session{}'.format(slot1.pk, s2.pk))))
assignment = SchedTimeSessAssignment.objects.get(session=s2, schedule=schedule)
self.assertEqual(assignment.timeslot, slot1)
# timeslot constraint hints when selected
s1_element = self.driver.find_element(By.CSS_SELECTOR, '#session{}'.format(s1.pk))
s1_element.click()
# violated due to constraints - both the timeslot and its timeslot label
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#timeslot{}.would-violate-hint'.format(slot1.pk)))
# Find the timeslot label for slot1 - it's the first timeslot in the first room group
slot1_roomgroup_elt = self.driver.find_element(By.CSS_SELECTOR,
'.day-flow .day:first-child .room-group:nth-child(2)' # count from 2 - first-child is the day label
)
self.assertTrue(
slot1_roomgroup_elt.find_elements(By.CSS_SELECTOR,
'.time-header > .time-label.would-violate-hint:first-child'
),
'Timeslot header label should show a would-violate hint for a constraint violation'
)
# violated due to missing capacity
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#timeslot{}.would-violate-hint'.format(slot3.pk)))
# Find the timeslot label for slot3 - it's the second timeslot in the second room group
slot3_roomgroup_elt = self.driver.find_element(By.CSS_SELECTOR,
'.day-flow .day:first-child .room-group:nth-child(3)' # count from 2 - first-child is the day label
)
self.assertFalse(
slot3_roomgroup_elt.find_elements(By.CSS_SELECTOR,
'.time-header > .time-label.would-violate-hint:nth-child(2)'
),
'Timeslot header label should not show a would-violate hint for room capacity violation'
)
# reschedule
self.driver.execute_script("jQuery('#session{}').simulateDragDrop({{dropTarget: '#timeslot{} .drop-target'}});".format(s2.pk, slot2.pk))
WebDriverWait(self.driver, 2).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '#timeslot{} #session{}'.format(slot2.pk, s2.pk))))
assignment = SchedTimeSessAssignment.objects.get(session=s2, schedule=schedule)
self.assertEqual(assignment.timeslot, slot2)
# too many attendees warning
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#session{}.too-many-attendees'.format(s2.pk)))
# overfull timeslot
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#timeslot{}.overfull'.format(slot2.pk)))
# constraint hints
s1_element.click()
self.assertIn('would-violate-hint', s2_element.get_attribute('class'))
constraint_element = s2_element.find_element(By.CSS_SELECTOR, ".constraints span[data-sessions=\"{}\"].would-violate-hint".format(s1.pk))
self.assertTrue(constraint_element.is_displayed())
# current constraint violations
self.driver.execute_script("jQuery('#session{}').simulateDragDrop({{dropTarget: '#timeslot{} .drop-target'}});".format(s1.pk, slot1.pk))
WebDriverWait(self.driver, 2).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '#timeslot{} #session{}'.format(slot1.pk, s1.pk))))
constraint_element = s2_element.find_element(By.CSS_SELECTOR, ".constraints span[data-sessions=\"{}\"].violated-hint".format(s1.pk))
self.assertTrue(constraint_element.is_displayed())
# hide sessions in area
self.assertTrue(s1_element.is_displayed())
self.driver.find_element(By.CSS_SELECTOR, ".session-parent-toggles [value=\"{}\"]".format(s1.group.parent.acronym)).click()
self.assertTrue(s1_element.is_displayed()) # should still be displayed
self.assertIn('hidden-parent', s1_element.get_attribute('class'),
'Session should be hidden when parent disabled')
s1_element.click() # try to select
self.assertNotIn('selected', s1_element.get_attribute('class'),
'Session should not be selectable when parent disabled')
self.driver.find_element(By.CSS_SELECTOR, ".session-parent-toggles [value=\"{}\"]".format(s1.group.parent.acronym)).click()
self.assertTrue(s1_element.is_displayed())
self.assertNotIn('hidden-parent', s1_element.get_attribute('class'),
'Session should not be hidden when parent enabled')
s1_element.click() # try to select
self.assertIn('selected', s1_element.get_attribute('class'),
'Session should be selectable when parent enabled')
# hide timeslots
self.driver.find_element(By.CSS_SELECTOR, "#timeslot-toggle-modal-open").click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, "#timeslot-group-toggles-modal").is_displayed())
self.driver.find_element(By.CSS_SELECTOR, "#timeslot-group-toggles-modal [value=\"{}\"]".format("ts-group-{}-{}".format(slot2.time.strftime("%Y%m%d-%H%M"), int(slot2.duration.total_seconds() / 60)))).click()
self.driver.find_element(By.CSS_SELECTOR, "#timeslot-group-toggles-modal [data-dismiss=\"modal\"]").click()
self.assertTrue(not self.driver.find_element(By.CSS_SELECTOR, "#timeslot-group-toggles-modal").is_displayed())
# swap days
self.driver.find_element(By.CSS_SELECTOR, ".day .swap-days[data-dayid=\"{}\"]".format(slot4.time.date().isoformat())).click()
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, "#swap-days-modal").is_displayed())
self.driver.find_element(By.CSS_SELECTOR, "#swap-days-modal input[name=\"target_day\"][value=\"{}\"]".format(slot1.time.date().isoformat())).click()
self.driver.find_element(By.CSS_SELECTOR, "#swap-days-modal button[type=\"submit\"]").click()
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#timeslot{} #session{}'.format(slot4.pk, s1.pk)),
'Session s1 should have moved to second meeting day')
# swap timeslot column - put session in a differently-timed timeslot
self.driver.find_element(By.CSS_SELECTOR,
'.day .swap-timeslot-col[data-timeslot-pk="{}"]'.format(slot1b.pk)
).click() # open modal on the second timeslot for room1
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, "#swap-timeslot-col-modal").is_displayed())
self.driver.find_element(By.CSS_SELECTOR,
'#swap-timeslot-col-modal input[name="target_timeslot"][value="{}"]'.format(slot4.pk)
).click() # select room1 timeslot that has a session in it
self.driver.find_element(By.CSS_SELECTOR, '#swap-timeslot-col-modal button[type="submit"]').click()
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, '#timeslot{} #session{}'.format(slot1b.pk, s1.pk)),
'Session s1 should have moved to second timeslot on first meeting day')
def test_past_flags(self):
"""Test that timeslots and sessions in the past are marked accordingly
Would also like to test that past-hint flags are applied when a session is dragged, but that
requires simulating HTML5 drag-and-drop. Have not yet found a good way to do this.
"""
wait = WebDriverWait(self.driver, 2)
meeting = MeetingFactory(type_id='ietf')
room = RoomFactory(meeting=meeting)
# get current time in meeting time zone
right_now = now().astimezone(
pytz.timezone(meeting.time_zone)
)
if not settings.USE_TZ:
right_now = right_now.replace(tzinfo=None)
past_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(hours=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(1,4)
]
future_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(hours=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(1,4)
]
now_timeslots = [
# timeslot just barely in the past (to avoid race conditions) but overlapping now
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(seconds=1),
duration=datetime.timedelta(hours=1), location=room),
# next slot is < MEETING_SESSION_LOCK_TIME in the future
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(minutes=9),
duration=datetime.timedelta(hours=1), location=room)
]
past_sessions = [
SchedTimeSessAssignment.objects.create(
schedule=meeting.schedule,
timeslot=ts,
session=SessionFactory(meeting=meeting, add_to_schedule=False),
).session
for ts in past_timeslots
]
future_sessions = [
SchedTimeSessAssignment.objects.create(
schedule=meeting.schedule,
timeslot=ts,
session=SessionFactory(meeting=meeting, add_to_schedule=False),
).session
for ts in future_timeslots
]
now_sessions = [
SchedTimeSessAssignment.objects.create(
schedule=meeting.schedule,
timeslot=ts,
session=SessionFactory(meeting=meeting, add_to_schedule=False),
).session
for ts in now_timeslots
]
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule', kwargs=dict(num=meeting.number))
self.login(username=meeting.schedule.owner.user.username)
self.driver.get(url)
past_flags = self.driver.find_elements(By.CSS_SELECTOR,
','.join('#timeslot{} .past-flag'.format(ts.pk) for ts in past_timeslots)
)
self.assertGreaterEqual(len(past_flags), len(past_timeslots) + len(past_sessions),
'Expected at least one flag for each past timeslot and session')
now_flags = self.driver.find_elements(By.CSS_SELECTOR,
','.join('#timeslot{} .past-flag'.format(ts.pk) for ts in now_timeslots)
)
self.assertGreaterEqual(len(now_flags), len(now_timeslots) + len(now_sessions),
'Expected at least one flag for each "now" timeslot and session')
future_flags = self.driver.find_elements(By.CSS_SELECTOR,
','.join('#timeslot{} .past-flag'.format(ts.pk) for ts in future_timeslots)
)
self.assertGreaterEqual(len(future_flags), len(future_timeslots) + len(future_sessions),
'Expected at least one flag for each future timeslot and session')
wait.until(expected_conditions.presence_of_element_located(
(By.CSS_SELECTOR, '#timeslot{}.past'.format(past_timeslots[0].pk))
))
for flag in past_flags:
self.assertTrue(flag.is_displayed(), 'Past timeslot or session not flagged as past')
for flag in now_flags:
self.assertTrue(flag.is_displayed(), '"Now" timeslot or session not flagged as past')
for flag in future_flags:
self.assertFalse(flag.is_displayed(), 'Future timeslot or session is flagged as past')
def test_past_swap_days_buttons(self):
"""Swap days buttons should be hidden for past items"""
wait = WebDriverWait(self.driver, 2)
meeting = MeetingFactory(type_id='ietf', date=datetime.datetime.today() - datetime.timedelta(days=3), days=7)
room = RoomFactory(meeting=meeting)
# get current time in meeting time zone
right_now = now().astimezone(
pytz.timezone(meeting.time_zone)
)
if not settings.USE_TZ:
right_now = right_now.replace(tzinfo=None)
past_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(days=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(4) # includes 0
]
future_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(days=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(1,4)
]
now_timeslots = [
# timeslot just barely in the past (to avoid race conditions) but overlapping now
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(seconds=1),
duration=datetime.timedelta(hours=1), location=room),
# next slot is < MEETING_SESSION_LOCK_TIME in the future
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(minutes=9),
duration=datetime.timedelta(hours=1), location=room)
]
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule', kwargs=dict(num=meeting.number))
self.login(username=meeting.schedule.owner.user.username)
self.driver.get(url)
past_swap_days_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'.swap-days[data-start="{}"]'.format(ts.time.date().isoformat()) for ts in past_timeslots
)
)
self.assertEqual(len(past_swap_days_buttons), len(past_timeslots), 'Missing past swap days buttons')
future_swap_days_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'.swap-days[data-start="{}"]'.format(ts.time.date().isoformat()) for ts in future_timeslots
)
)
self.assertEqual(len(future_swap_days_buttons), len(future_timeslots), 'Missing future swap days buttons')
now_swap_days_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'.swap-days[data-start="{}"]'.format(ts.time.date().isoformat()) for ts in now_timeslots
)
)
# only one "now" button because both sessions are on the same day
self.assertEqual(len(now_swap_days_buttons), 1, 'Missing "now" swap days button')
wait.until(
expected_conditions.presence_of_element_located(
(By.CSS_SELECTOR, '.timeslot.past') # wait until timeslots are updated by JS
)
)
# check that swap buttons are disabled for past days
self.assertFalse(
any(button.is_displayed() for button in past_swap_days_buttons),
'Past swap days buttons still visible for official schedule',
)
self.assertTrue(
all(button.is_displayed() for button in future_swap_days_buttons),
'Future swap days buttons not visible for official schedule',
)
self.assertFalse(
any(button.is_displayed() for button in now_swap_days_buttons),
'"Now" swap days buttons still visible for official schedule',
)
# Open the swap days modal to verify that past day radios are disabled.
# Use a middle day because whichever day we click will be disabled as an
# option to swap. If we used the first or last day, a fencepost error in
# disabling options by date might be hidden.
clicked_index = 1
future_swap_days_buttons[clicked_index].click()
try:
modal = wait.until(
expected_conditions.visibility_of_element_located(
(By.CSS_SELECTOR, '#swap-days-modal')
)
)
except TimeoutException:
self.fail('Modal never appeared')
self.assertFalse(
any(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_day"][value="{}"]'.format(ts.time.date().isoformat()) for ts in past_timeslots)
)),
'Past day is enabled in swap-days modal for official schedule',
)
# future_timeslots[:-1] in the next selector because swapping a day with itself is disabled
enabled_timeslots = (ts for ts in future_timeslots if ts != future_timeslots[clicked_index])
self.assertTrue(
all(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_day"][value="{}"]'.format(ts.time.date().isoformat()) for ts in enabled_timeslots)
)),
'Future day is not enabled in swap-days modal for official schedule',
)
self.assertFalse(
any(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_day"][value="{}"]'.format(ts.time.date().isoformat()) for ts in now_timeslots)
)),
'"Now" day is enabled in swap-days modal for official schedule',
)
def test_past_swap_timeslot_col_buttons(self):
"""Swap timeslot column buttons should be hidden for past items"""
wait = WebDriverWait(self.driver, 2)
meeting = MeetingFactory(type_id='ietf', date=datetime.datetime.today() - datetime.timedelta(days=3), days=7)
room = RoomFactory(meeting=meeting)
# get current time in meeting time zone
right_now = now().astimezone(
pytz.timezone(meeting.time_zone)
)
if not settings.USE_TZ:
right_now = right_now.replace(tzinfo=None)
past_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(hours=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(1,4) # does not include 0 to avoid race conditions
]
future_timeslots = [
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(hours=n),
duration=datetime.timedelta(hours=1), location=room)
for n in range(1,4)
]
now_timeslots = [
# timeslot just barely in the past (to avoid race conditions) but overlapping now
TimeSlotFactory(meeting=meeting, time=right_now - datetime.timedelta(seconds=1),
duration=datetime.timedelta(hours=1), location=room),
# next slot is < MEETING_SESSION_LOCK_TIME in the future
TimeSlotFactory(meeting=meeting, time=right_now + datetime.timedelta(minutes=9),
duration=datetime.timedelta(hours=1), location=room)
]
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule', kwargs=dict(num=meeting.number))
self.login(username=meeting.schedule.owner.user.username)
self.driver.get(url)
past_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'*[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in past_timeslots
)
)
self.assertEqual(len(past_swap_ts_buttons), len(past_timeslots), 'Missing past swap timeslot col buttons')
future_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'*[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in future_timeslots
)
)
self.assertEqual(len(future_swap_ts_buttons), len(future_timeslots), 'Missing future swap timeslot col buttons')
now_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
','.join(
'[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in now_timeslots
)
)
self.assertEqual(len(now_swap_ts_buttons), len(now_timeslots), 'Missing "now" swap timeslot col buttons')
wait.until(
expected_conditions.presence_of_element_located(
(By.CSS_SELECTOR, '.timeslot.past') # wait until timeslots are updated by JS
)
)
# check that swap buttons are disabled for past days
self.assertFalse(
any(button.is_displayed() for button in past_swap_ts_buttons),
'Past swap timeslot col buttons still visible for official schedule',
)
self.assertTrue(
all(button.is_displayed() for button in future_swap_ts_buttons),
'Future swap timeslot col buttons not visible for official schedule',
)
self.assertFalse(
any(button.is_displayed() for button in now_swap_ts_buttons),
'"Now" swap timeslot col buttons still visible for official schedule',
)
# Open the swap days modal to verify that past day radios are disabled.
# Use a middle day because whichever day we click will be disabled as an
# option to swap. If we used the first or last day, a fencepost error in
# disabling options by date might be hidden.
clicked_index = 1
future_swap_ts_buttons[clicked_index].click()
try:
modal = wait.until(
expected_conditions.visibility_of_element_located(
(By.CSS_SELECTOR, '#swap-timeslot-col-modal')
)
)
except TimeoutException:
self.fail('Modal never appeared')
self.assertFalse(
any(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_timeslot"][value="{}"]'.format(ts.pk) for ts in past_timeslots)
)),
'Past timeslot is enabled in swap-timeslot-col modal for official schedule',
)
# future_timeslots[:-1] in the next selector because swapping a timeslot with itself is disabled
enabled_timeslots = (ts for ts in future_timeslots if ts != future_timeslots[clicked_index])
self.assertTrue(
all(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_timeslot"][value="{}"]'.format(ts.pk) for ts in enabled_timeslots)
)),
'Future timeslot is not enabled in swap-timeslot-col modal for official schedule',
)
self.assertFalse(
any(radio.is_enabled()
for radio in modal.find_elements(By.CSS_SELECTOR, ','.join(
'input[name="target_timeslot"][value="{}"]'.format(ts.pk) for ts in now_timeslots)
)),
'"Now" timeslot is enabled in swap-timeslot-col modal for official schedule',
)
def test_unassigned_sessions_sort(self):
"""Unassigned session sorting should behave correctly
Sorting options and list of sort criteria
name (name, duration, id)
parent (parent, name, duration, id)
duration (duration, parent, name, id)
comments (presence of comments, parent, name, duration, id)
"""
# Define helpers
def sort_by_position(driver, sessions):
"""Helper to sort sessions by the position of their session element in the unscheduled box"""
def _sort_key(sess):
elt = driver.find_element(By.ID, 'session{}'.format(sess.pk))
return (elt.location['y'], elt.location['x'])
return sorted(sessions, key=_sort_key)
wait = WebDriverWait(self.driver, 2)
def wait_for_order(sessions, expected_order, fail_message):
"""Helper to wait for sorting to complete"""
try:
wait.until(
lambda driver: sort_by_position(driver, sessions) == expected_order,
)
except TimeoutException:
pass # Fall through to the assertion which will fail, don't throw a confusing timeout exception
self.assertEqual(sort_by_position(self.driver, sessions), expected_order, fail_message)
# Start the test here
# set up several WGs in various areas, including no area.
area_acronyms = ['A', 'B', 'C', 'D']
areas = [GroupFactory(type_id='area', acronym=acro) for acro in area_acronyms]
# now create WGs with acronyms that sort differently than by area (g00, g01, g02...)
num = 0
wgs = []
group_acro = lambda n: 'g{:02d}'.format(n)
for _ in range(2):
wgs.append(GroupFactory(acronym=group_acro(num), type_id='wg', parent=None))
num += 1
for area in areas:
wgs.append(GroupFactory(acronym=group_acro(num), type_id='wg', parent=area))
num += 1
# Create an IETF meeting...
meeting = MeetingFactory(type_id='ietf')
# ...add a room that has no timeslots to be sure it's handled...
RoomFactory(meeting=meeting)
# ...and sessions for the groups. Use durations that are in a different order than
# area or name. The wgs list is in ascending acronym order, so use descending durations.
sessions = []
for n, wg in enumerate(wgs[::-1]):
sessions.append(
SessionFactory(
meeting=meeting,
group=wg,
requested_duration=datetime.timedelta(minutes=30 + 5 * n),
status_id='schedw',
add_to_schedule=False,
)
)
# Finally, assign comments to some sessions. Assign every 3rd until we reach the end.
# This should be a different sort than any of the other axes.
for sess in sessions[::3]:
sess.comments = 'special request'
sess.save()
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule', kwargs=dict(num=meeting.number))
self.login('secretary')
self.driver.get(url)
select = self.driver.find_element(By.NAME, 'sort_unassigned')
options = {
opt.get_attribute('value'): opt
for opt in select.find_elements(By.TAG_NAME, 'option')
}
# check sorting by name
options['name'].click()
self.assertEqual(select.get_attribute('value'), 'name')
expected_order = sorted(
sessions,
key=lambda s: (
s.group.acronym,
s.requested_duration,
)
)
wait_for_order(sessions, expected_order, 'Failed to sort by name')
# check sorting by parent
options['parent'].click()
self.assertEqual(select.get_attribute('value'), 'parent')
expected_order = sorted(
sessions,
key=lambda s: (
s.group.parent.acronym if s.group.parent else '',
s.group.acronym,
s.requested_duration,
)
)
wait_for_order(sessions, expected_order, 'Failed to sort by parent')
# check sorting by duration
options['duration'].click()
self.assertEqual(select.get_attribute('value'), 'duration')
expected_order = sorted(
sessions,
key=lambda s: (
s.requested_duration,
s.group.parent.acronym if s.group.parent else '',
s.group.acronym,
)
)
wait_for_order(sessions, expected_order, 'Failed to sort by duration')
# check sorting by comments
options['comments'].click()
self.assertEqual(select.get_attribute('value'), 'comments')
expected_order = sorted(
sessions,
key=lambda s: (
0 if len(s.comments) > 0 else 1,
s.group.parent.acronym if s.group.parent else '',
s.group.acronym,
s.requested_duration,
)
)
wait_for_order(sessions, expected_order, 'Failed to sort by comments')
def test_unassigned_sessions_drop_target_visible_when_empty(self):
"""The drop target for unassigned sessions should not collapse to 0 size
This test checks that issue #3174 has not regressed. A test that exercises
moving items from the schedule into the unassigned-sessions area is needed,
but as of 2021-05-04, Selenium does not support the HTML5 drag-and-drop
event interface. See:
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604
https://gist.github.com/rcorreia/2362544
Note, however, that the workarounds are inadequate - they do not handle
all of the events needed by the editor.
"""
# Set up a meeting and a schedule a plain user can edit
schedule = ScheduleFactory(meeting__type_id='ietf', owner__user__username="plain")
meeting = schedule.meeting
# Open the editor
self.login()
url = self.absreverse(
'ietf.meeting.views.edit_meeting_schedule',
kwargs=dict(num=meeting.number, name=schedule.name, owner=schedule.owner_email())
)
self.driver.get(url)
# Check that the drop target for unassigned sessions is actually empty
drop_target = self.driver.find_element(By.CSS_SELECTOR,
'.unassigned-sessions .drop-target'
)
self.assertEqual(len(drop_target.find_elements(By.CLASS_NAME, 'session')), 0,
'Unassigned sessions box is not empty, test is broken')
# Check that the drop target has non-zero size
self.assertGreater(drop_target.size['height'], 0,
'Drop target for unassigned sessions collapsed to 0 height')
self.assertGreater(drop_target.size['width'], 0,
'Drop target for unassigned sessions collapsed to 0 width')
def test_session_constraint_hints(self):
"""Selecting a session should mark conflicting sessions
To test for recurrence of https://trac.ietf.org/trac/ietfdb/ticket/3327 need to have some constraints that
do not conflict. Testing with only violated constraints does not exercise the code adequately.
"""
meeting = MeetingFactory(type_id='ietf', date=datetime.date.today(), populate_schedule=False)
TimeSlotFactory.create_batch(5, meeting=meeting)
schedule = ScheduleFactory(meeting=meeting)
sessions = SessionFactory.create_batch(5, meeting=meeting, add_to_schedule=False)
groups = [s.group for s in sessions]
# Now set up constraints
# Get an arbitrary enabled group conflict ConstraintName
constraint_names = meeting.enabled_constraint_names().filter(is_group_conflict=True)
self.assertGreaterEqual(len(constraint_names), 2, 'Not enough constraint names enabled to perform test')
# one-way conflict from group 0 to 1
ConstraintFactory(meeting=meeting, name=constraint_names[0], source=groups[0], target=groups[1], person=None)
# one-way conflict from group 2 to 0
ConstraintFactory(meeting=meeting, name=constraint_names[0], source=groups[2], target=groups[0], person=None)
# two-way conflict between groups 0 and 3
ConstraintFactory(meeting=meeting, name=constraint_names[0], source=groups[0], target=groups[3], person=None)
ConstraintFactory(meeting=meeting, name=constraint_names[0], source=groups[3], target=groups[0], person=None)
# constraints that are not active when selecting sessions[0]
ConstraintFactory(meeting=meeting, name=constraint_names[1], source=groups[1], target=groups[2], person=None)
ConstraintFactory(meeting=meeting, name=constraint_names[1], source=groups[3], target=groups[4], person=None)
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule',
kwargs=dict(num=meeting.number, owner=schedule.owner.email(), name=schedule.name))
self.login(schedule.owner.user.username)
self.driver.get(url)
session_elements = [self.driver.find_element(By.CSS_SELECTOR, f'#session{sess.pk}') for sess in sessions]
session_elements[0].click()
# All conflicting sessions should be flagged with the would-violate-hint class.
self.assertIn('would-violate-hint', session_elements[1].get_attribute('class'),
'Constraint violation should be indicated on conflicting session')
self.assertIn('would-violate-hint', session_elements[2].get_attribute('class'),
'Constraint violation should be indicated on conflicting session')
self.assertIn('would-violate-hint', session_elements[3].get_attribute('class'),
'Constraint violation should be indicated on conflicting session')
# And the non-conflicting session should not be flagged
self.assertNotIn('would-violate-hint', session_elements[4].get_attribute('class'),
'Constraint violation should not be indicated on non-conflicting session')
@ifSeleniumEnabled
@skipIf(django.VERSION[0]==2, "Skipping test with race conditions under Django 2")
class ScheduleEditTests(IetfSeleniumTestCase):
def testUnschedule(self):
meeting = make_meeting_test_data()
colors.fg_group_colors['FARFUT'] = 'blue'
colors.bg_group_colors['FARFUT'] = 'white'
self.assertEqual(SchedTimeSessAssignment.objects.filter(session__meeting=meeting, session__group__acronym='mars', schedule__name='test-schedule').count(),1)
ss = list(SchedTimeSessAssignment.objects.filter(session__meeting__number=72,session__group__acronym='mars',schedule__name='test-schedule')) # pyflakes:ignore
self.login()
url = self.absreverse('ietf.meeting.views.edit_meeting_schedule',kwargs=dict(num='72',name='test-schedule',owner='plain@example.com'))
self.driver.get(url)
# driver.get() will wait for scripts to finish, but not ajax
# requests. Wait for completion of the permissions check:
read_only_note = self.driver.find_element(By.ID, 'read_only')
WebDriverWait(self.driver, 10).until(expected_conditions.invisibility_of_element(read_only_note), "Read-only schedule")
s1 = Session.objects.filter(group__acronym='mars', meeting=meeting).first()
selector = "#session_{}".format(s1.pk)
WebDriverWait(self.driver, 30).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, selector)), "Did not find %s"%selector)
self.assertEqual(self.driver.find_elements(By.CSS_SELECTOR, "#sortable-list #session_{}".format(s1.pk)), [])
element = self.driver.find_element(By.ID, 'session_{}'.format(s1.pk))
target = self.driver.find_element(By.ID, 'sortable-list')
ActionChains(self.driver).drag_and_drop(element,target).perform()
self.assertTrue(self.driver.find_elements(By.CSS_SELECTOR, "#sortable-list #session_{}".format(s1.pk)))
time.sleep(0.1) # The API that modifies the database runs async
self.assertEqual(SchedTimeSessAssignment.objects.filter(session__meeting__number=72,session__group__acronym='mars',schedule__name='test-schedule').count(),0)
@ifSeleniumEnabled
class SlideReorderTests(IetfSeleniumTestCase):
def setUp(self):
super(SlideReorderTests, self).setUp()
self.session = SessionFactory(meeting__type_id='ietf', status_id='sched')
self.session.sessionpresentation_set.create(document=DocumentFactory(type_id='slides',name='one'),order=1)
self.session.sessionpresentation_set.create(document=DocumentFactory(type_id='slides',name='two'),order=2)
self.session.sessionpresentation_set.create(document=DocumentFactory(type_id='slides',name='three'),order=3)
def secr_login(self):
self.login('secretary')
#@override_settings(DEBUG=True)
def testReorderSlides(self):
return
url = self.absreverse('ietf.meeting.views.session_details',
kwargs=dict(
num=self.session.meeting.number,
acronym = self.session.group.acronym,))
self.secr_login()
self.driver.get(url)
#debug.show('unicode(self.driver.page_source)')
second = self.driver.find_element(By.CSS_SELECTOR, '#slides tr:nth-child(2)')
third = self.driver.find_element(By.CSS_SELECTOR, '#slides tr:nth-child(3)')
ActionChains(self.driver).drag_and_drop(second,third).perform()
time.sleep(0.1) # The API that modifies the database runs async
names=self.session.sessionpresentation_set.values_list('document__name',flat=True)
self.assertEqual(list(names),['one','three','two'])
@ifSeleniumEnabled
class AgendaTests(IetfSeleniumTestCase):
def setUp(self):
super(AgendaTests, self).setUp()
self.meeting = make_meeting_test_data()
def row_id_for_item(self, item):
return 'row-%s' % item.slug()
def get_expected_items(self):
expected_items = self.meeting.schedule.assignments.exclude(timeslot__type__in=['lead','offagenda'])
self.assertGreater(len(expected_items), 0, 'Test setup generated an empty schedule')
return expected_items
def test_agenda_view_js_func_parse_query_params(self):
"""Test parse_query_params() function"""
self.driver.get(self.absreverse('ietf.meeting.views.agenda'))
parse_query_params = 'return agenda_filter_for_testing.parse_query_params'
# Only 'show' param
result = self.driver.execute_script(
parse_query_params + '("?show=group1,group2,group3");'
)
self.assertEqual(result, dict(show='group1,group2,group3'))
# Only 'hide' param
result = self.driver.execute_script(
parse_query_params + '("?hide=group4,group5,group6");'
)
self.assertEqual(result, dict(hide='group4,group5,group6'))
# Both 'show' and 'hide'
result = self.driver.execute_script(
parse_query_params + '("?show=group1,group2,group3&hide=group4,group5,group6");'
)
self.assertEqual(result, dict(show='group1,group2,group3', hide='group4,group5,group6'))
# Encoded
result = self.driver.execute_script(
parse_query_params + '("?show=%20group1,%20group2,%20group3&hide=group4,group5,group6");'
)
self.assertEqual(result, dict(show=' group1, group2, group3', hide='group4,group5,group6'))
def test_agenda_view_js_func_toggle_list_item(self):
"""Test toggle_list_item() function"""
self.driver.get(self.absreverse('ietf.meeting.views.agenda'))
result = self.driver.execute_script(
"""
// start empty, add item
var list0=[];
%(toggle_list_item)s(list0, 'item');
// one item, remove it
var list1=['item'];
%(toggle_list_item)s(list1, 'item');
// one item, add another
var list2=['item1'];
%(toggle_list_item)s(list2, 'item2');
// multiple items, remove first
var list3=['item1', 'item2', 'item3'];
%(toggle_list_item)s(list3, 'item1');
// multiple items, remove middle
var list4=['item1', 'item2', 'item3'];
%(toggle_list_item)s(list4, 'item2');
// multiple items, remove last
var list5=['item1', 'item2', 'item3'];
%(toggle_list_item)s(list5, 'item3');
return [list0, list1, list2, list3, list4, list5];
""" % {'toggle_list_item': 'agenda_filter_for_testing.toggle_list_item'}
)
self.assertEqual(result[0], ['item'], 'Adding item to empty list failed')
self.assertEqual(result[1], [], 'Removing only item in a list failed')
self.assertEqual(result[2], ['item1', 'item2'], 'Adding second item to list failed')
self.assertEqual(result[3], ['item2', 'item3'], 'Removing first item from list failed')
self.assertEqual(result[4], ['item1', 'item3'], 'Removing middle item from list failed')
self.assertEqual(result[5], ['item1', 'item2'], 'Removing last item from list failed')
def do_agenda_view_filter_test(self, querystring, visible_groups=()):
self.login()
self.driver.get(self.absreverse('ietf.meeting.views.agenda') + querystring)
self.assert_agenda_item_visibility(visible_groups)
self.assert_agenda_view_filter_matches_ics_filter(querystring)