1
Test for the copy timetables option for new years
2
=================================================
4
See https://bugs.launchpad.net/bugs/1005962
8
>>> manager = browsers.manager
9
>>> manager.ui.login('manager', 'schooltool')
13
>>> manager.ui.schoolyear.add('2014', '2014-01-01', '2014-12-31')
15
Add a couple of timetables:
17
>>> manager.query.link('School').click()
18
>>> manager.query.link('Timetables').click()
19
>>> manager.query.link('Timetable').click()
20
>>> manager.query.id('field.title').clear()
21
>>> manager.query.id('field.title').ui.set_value('3 periods')
22
>>> manager.query.button('Next').click()
23
>>> manager.query.button('Days of the week').click()
24
>>> manager.query.button('Same time each day').click()
25
>>> manager.query.id('field.times').clear()
26
>>> times = '\n'.join([
31
>>> manager.query.id('field.times').ui.set_value(times)
32
>>> manager.query.button('Next').click()
33
>>> manager.query.button('Have names').click()
34
>>> manager.query.id('field.periods').ui.set_value('First\nSecond\nThird')
35
>>> manager.query.button('Next').click()
36
>>> manager.query.button('Same').click()
37
>>> manager.query.button('Next').click()
38
>>> manager.query.button('No').click()
40
>>> manager.query.link('School').click()
41
>>> manager.query.link('Timetables').click()
42
>>> manager.query.link('Timetable').click()
43
>>> manager.query.id('field.title').clear()
44
>>> manager.query.id('field.title').ui.set_value('4 periods')
45
>>> manager.query.button('Next').click()
46
>>> manager.query.button('Days of the week').click()
47
>>> manager.query.button('Same time each day').click()
48
>>> manager.query.id('field.times').clear()
49
>>> times = '\n'.join([
55
>>> manager.query.id('field.times').ui.set_value(times)
56
>>> manager.query.button('Next').click()
57
>>> manager.query.button('Have names').click()
58
>>> manager.query.id('field.periods').ui.set_value('A\nB\nC\nD')
59
>>> manager.query.button('Next').click()
60
>>> manager.query.button('Same').click()
61
>>> manager.query.css('select[name="period_0"]').ui.set_value('C')
62
>>> manager.query.css('select[name="period_1"]').ui.set_value('A')
63
>>> manager.query.css('select[name="period_2"]').ui.set_value('D')
64
>>> manager.query.css('select[name="period_3"]').ui.set_value('B')
65
>>> manager.query.button('Next').click()
66
>>> manager.query.button('Yes').click()
67
>>> manager.query.id('homeroom_0_A').click()
68
>>> manager.query.id('homeroom_1_A').click()
69
>>> manager.query.id('homeroom_2_A').click()
70
>>> manager.query.id('homeroom_3_A').click()
71
>>> manager.query.id('homeroom_4_A').click()
72
>>> manager.query.id('homeroom_5_A').click()
73
>>> manager.query.id('homeroom_6_A').click()
74
>>> manager.query.button('Next').click()
76
Check both timetables:
78
>>> manager.query.link('School').click()
79
>>> manager.query.link('2014').click()
80
>>> manager.query.link('Timetables').click()
81
>>> print_timetables_table(manager)
82
3 periods, 2014-01-01, 2014-12-31
83
4 periods, 2014-01-01, 2014-12-31
85
>>> manager.query.link('3 periods').click()
86
>>> print_timetable(manager)
90
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
91
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
92
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
93
| First Lesson | First Lesson | First Lesson | First Lesson | First Lesson | First Lesson | First Lesson |
94
| Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson |
95
| Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson |
96
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
98
+-------------+-------------+-------------+-------------+-------------+----------+--------+
99
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
100
+-------------+-------------+-------------+-------------+-------------+----------+--------+
101
| 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | | |
102
| 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | | |
103
| 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | | |
104
+-------------+-------------+-------------+-------------+-------------+----------+--------+
105
>>> manager.query.link('Done').click()
106
>>> manager.query.link('4 periods').click()
107
>>> print_timetable(manager)
111
+------------+------------+------------+------------+------------+------------+------------+
112
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
113
+------------+------------+------------+------------+------------+------------+------------+
114
| C Lesson | C Lesson | C Lesson | C Lesson | C Lesson | C Lesson | C Lesson |
115
| A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom |
116
| D Lesson | D Lesson | D Lesson | D Lesson | D Lesson | D Lesson | D Lesson |
117
| B Lesson | B Lesson | B Lesson | B Lesson | B Lesson | B Lesson | B Lesson |
118
+------------+------------+------------+------------+------------+------------+------------+
120
+-------------+-------------+-------------+-------------+-------------+----------+--------+
121
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
122
+-------------+-------------+-------------+-------------+-------------+----------+--------+
123
| 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | | |
124
| 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | | |
125
| 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | | |
126
| 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | | |
127
+-------------+-------------+-------------+-------------+-------------+----------+--------+
129
Add a new school year copying the timetables:
131
>>> manager.query.link('School').click()
132
>>> manager.query.link('School Year').click()
133
>>> manager.query.id('form-widgets-title').ui.set_value('2015')
134
>>> manager.query.id('form-widgets-first').ui.set_value('2015-02-01')
135
>>> manager.query.id('form-widgets-last').ui.set_value('2015-12-01')
136
>>> manager.query.css('input[name="importAllTimetables"]').click()
137
>>> manager.query.id('form-buttons-add').click()
139
Go to the new year's timetables:
141
>>> manager.query.link('School').click()
142
>>> manager.query.link('2015').click()
143
>>> manager.query.link('Timetables').click()
144
>>> print_timetables_table(manager)
145
3 periods, 2015-02-01, 2015-12-01
146
4 periods, 2015-02-01, 2015-12-01
148
>>> manager.query.link('3 periods').click()
149
>>> print_timetable(manager)
153
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
154
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
155
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
156
| First Lesson | First Lesson | First Lesson | First Lesson | First Lesson | First Lesson | First Lesson |
157
| Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson | Second Lesson |
158
| Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson | Third Lesson |
159
+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
161
+-------------+-------------+-------------+-------------+-------------+----------+--------+
162
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
163
+-------------+-------------+-------------+-------------+-------------+----------+--------+
164
| 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | 09:30-10:25 | | |
165
| 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | 10:30-11:25 | | |
166
| 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | 11:30-12:25 | | |
167
+-------------+-------------+-------------+-------------+-------------+----------+--------+
168
>>> manager.query.link('Done').click()
169
>>> manager.query.link('4 periods').click()
170
>>> print_timetable(manager)
174
+------------+------------+------------+------------+------------+------------+------------+
175
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
176
+------------+------------+------------+------------+------------+------------+------------+
177
| C Lesson | C Lesson | C Lesson | C Lesson | C Lesson | C Lesson | C Lesson |
178
| A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom | A Homeroom |
179
| D Lesson | D Lesson | D Lesson | D Lesson | D Lesson | D Lesson | D Lesson |
180
| B Lesson | B Lesson | B Lesson | B Lesson | B Lesson | B Lesson | B Lesson |
181
+------------+------------+------------+------------+------------+------------+------------+
183
+-------------+-------------+-------------+-------------+-------------+----------+--------+
184
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
185
+-------------+-------------+-------------+-------------+-------------+----------+--------+
186
| 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | 09:00-10:00 | | |
187
| 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | 10:00-11:00 | | |
188
| 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | 11:00-12:00 | | |
189
| 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | 12:00-13:00 | | |
190
+-------------+-------------+-------------+-------------+-------------+----------+--------+