1
Test for the order of the sidebar groups in the journal
2
=======================================================
6
>>> manager = browsers.manager
7
>>> manager.ui.login('manager', 'schooltool')
11
>>> manager.open('http://localhost/time?value=2011-09-23')
15
>>> manager.ui.schoolyear.add('2011', '2011-01-01', '2011-12-31')
19
>>> manager.query.link('School').click()
20
>>> manager.query.link('Terms').click()
21
>>> manager.query.link('Term').click()
22
>>> manager.query.name('form.widgets.title').ui.set_value('2011')
23
>>> manager.query.name('form.widgets.first').ui.set_value('2011-01-01')
24
>>> manager.query.name('form.widgets.last').ui.set_value('2011-12-31')
25
>>> manager.query.button('Next').click()
26
>>> manager.query.button('Saturday').click()
27
>>> manager.query.button('Sunday').click()
28
>>> manager.query.button('Submit').click()
32
>>> manager.query.link('School').click()
33
>>> manager.query.link('Timetables').click()
34
>>> manager.query.link('Timetable').click()
35
>>> manager.query.button('Next').click()
36
>>> manager.query.button('Days of the week').click()
37
>>> manager.query.button('Same time each day').click()
38
>>> manager.query.button('Next').click()
39
>>> manager.query.button('Designated by time').click()
40
>>> manager.query.button('No').click()
42
Add a course and a section:
44
>>> manager.ui.course.add('2011', 'Math')
45
>>> manager.ui.section.add('2011', '2011', 'Math')
47
Set a schedule for the section:
49
>>> manager.ui.section.go('2011', '2011', 'Math (1)')
50
>>> manager.query.link('Schedule').click()
51
>>> sel = '//div[contains(@class, "sidebar")]//a[text()="Schedule"]'
52
>>> manager.query.xpath(sel).click()
53
>>> manager.query.button('Submit').click()
54
>>> manager.query.xpath('//input[@name="period.0-.Period-"]').click()
55
>>> manager.query.xpath('//input[@name="period.1-.Period-"]').click()
56
>>> manager.query.xpath('//input[@name="period.2-.Period-"]').click()
57
>>> manager.query.xpath('//input[@name="period.3-.Period-"]').click()
58
>>> manager.query.xpath('//input[@name="period.4-.Period-"]').click()
59
>>> manager.query.button('Save').click()
63
>>> manager.ui.person.add('Tom', 'Hoffman', 'tom', 'pwd')
64
>>> manager.ui.person.add('Camila', 'Cerna', 'camila', 'pwd')
66
Set Tom as instructor of the section and Camila as a student:
68
>>> manager.ui.section.instructors.add('2011', '2011', 'Math (1)', ['tom'])
69
>>> manager.ui.section.students.add('2011', '2011', 'Math (1)', ['camila'])
71
Log in as tom and go to the journal of the section:
73
>>> tom = browsers.tom
74
>>> tom.ui.login('tom', 'pwd')
75
>>> sel = '//div[@class="event-body"]//a[text()="Journal"]'
76
>>> tom.query.xpath(sel).click()
78
http://localhost/schoolyears/2011/2011/sections/1/journal/index.html...
80
Print the journal sidebar groups:
82
>>> for el in tom.query_all.css('.sidebar .content .header'):