~ubuntu-branches/ubuntu/natty/schooltool.gradebook/natty

« back to all changes in this revision

Viewing changes to src/schooltool/gradebook/browser/ftests/worksheet_hiding.txt

  • Committer: Bazaar Package Importer
  • Author(s): Gediminas Paulauskas
  • Date: 2011-02-24 16:53:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110224165353-hi69ckyal3b8dyns
Tags: upstream-0.9.0~a1
ImportĀ upstreamĀ versionĀ 0.9.0~a1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Hiding Worksheets
 
2
-----------------
 
3
 
 
4
We want to allow the user to hide a worksheet so that it no longer figures in
 
5
the gradebook.  The worksheet will not be deleted from the database, but it
 
6
will be ignored in all areas of gradebook management.
 
7
 
 
8
Log in as manager:
 
9
 
 
10
    >>> manager = Browser('manager', 'schooltool')
 
11
 
 
12
Now, set up a school year (2005-2006) with two terms (Fall and
 
13
Spring):
 
14
 
 
15
    >>> from schooltool.app.browser.ftests import setup
 
16
    >>> setup.setUpBasicSchool()
 
17
 
 
18
Set up one courses:
 
19
 
 
20
    >>> setup.addCourse('Math I', '2005-2006')
 
21
 
 
22
Set up persons:
 
23
 
 
24
    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
 
25
    >>> addPerson('Paul', 'Cardune', 'paul', 'pwd', browser=manager)
 
26
    >>> addPerson('Tom', 'Hoffman', 'tom', 'pwd', browser=manager)
 
27
    >>> addPerson('Claudia', 'Richter', 'claudia', 'pwd', browser=manager)
 
28
    >>> addPerson('Stephan', 'Richter', 'stephan', 'pwd', browser=manager)
 
29
 
 
30
Set up one section with instructor and students:
 
31
 
 
32
    >>> setup.addSection('Math I', '2005-2006', 'Fall',
 
33
    ...                  instructors=['Stephan'],
 
34
    ...                  members=['Tom', 'Claudia', 'Paul'])
 
35
 
 
36
Log in as teacher:
 
37
 
 
38
    >>> stephan = Browser('stephan', 'pwd')
 
39
 
 
40
Add a couple of activities to the default worksheet:
 
41
 
 
42
    >>> stephan.getLink('Gradebook').click()
 
43
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
44
    2005-2006 / Fall
 
45
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
46
    Math I - Math I (1)
 
47
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
48
    <td class="active_tab">
 
49
      <span style="font-weight: bold;">Sheet1</span>
 
50
    </td>
 
51
    >>> stephan.getLink('New Activity').click()
 
52
    >>> stephan.getControl('Title').value = 'HW 1'
 
53
    >>> stephan.getControl('Description').value = 'Homework 1'
 
54
    >>> stephan.getControl('Category').value = ['assignment']
 
55
    >>> stephan.getControl('Maximum').value = '50'
 
56
    >>> stephan.getControl('Add').click()
 
57
 
 
58
    >>> stephan.getLink('New Activity').click()
 
59
    >>> stephan.getControl('Title').value = 'Quiz'
 
60
    >>> stephan.getControl('Description').value = 'Week 1 Pop Quiz'
 
61
    >>> stephan.getControl('Category').value = ['exam']
 
62
    >>> stephan.getControl('Add').click()
 
63
 
 
64
We'll add a new worksheet called 'Second Sheet' and note its presence
 
65
in the list.
 
66
 
 
67
    >>> stephan.getLink('Worksheets').click()
 
68
    >>> stephan.getLink('New Worksheet').click()
 
69
    >>> stephan.getControl('Title').value = 'Second Sheet'
 
70
    >>> stephan.getControl('Add').click()
 
71
    >>> stephan.printQuery('//h1')
 
72
    <h1>Worksheets</h1>
 
73
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
 
74
    Sheet1
 
75
    Second Sheet
 
76
 
 
77
We'll make it the user's current worksheet to make sure we can handle hiding
 
78
a worksheet that happens to be the current one for the user.
 
79
 
 
80
    >>> stephan.getLink('Return to Gradebook').click()
 
81
    >>> stephan.getLink('Second Sheet').click()
 
82
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
83
    <td class="active_tab">
 
84
      <a href="...">Sheet1</a>
 
85
    </td>
 
86
    <td class="active_tab">
 
87
      <span style="font-weight: bold;">Second Sheet</span>
 
88
    </td>
 
89
 
 
90
Now we'll hide our newly added worksheet, noting its absense from the list.
 
91
 
 
92
    >>> stephan.getLink('Worksheets').click()
 
93
    >>> stephan.getControl(name='hide:list').value = ['Worksheet-2']
 
94
    >>> stephan.getControl('Hide').click()
 
95
    >>> stephan.printQuery('//h1')
 
96
    <h1>Worksheets</h1>
 
97
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
 
98
    Sheet1
 
99
 
 
100
Finally, we'll return to the gradebook, noting that it handles the current
 
101
worksheet being hidden, changing the current worksheet to the first one that
 
102
is not hidden.
 
103
 
 
104
    >>> stephan.getLink('Return to Gradebook').click()
 
105
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
106
    <td class="active_tab">
 
107
      <span style="font-weight: bold;">Sheet1</span>
 
108
    </td>
 
109
 
 
110
 
 
111
Unhiding Worksheets
 
112
~~~~~~~~~~~~~~~~~~~
 
113
 
 
114
Now that we can hide worksheets, we need to allow the user to change
 
115
their mind and unhide a worksheet they previously hid.  We need to
 
116
navigate to the worksheets from which we can call up the view for
 
117
unhiding worksheets.
 
118
 
 
119
    >>> stephan.getLink('Worksheets').click()
 
120
    >>> stephan.getLink('Unhide Worksheets').click()
 
121
    >>> stephan.printQuery('//h1/text()')
 
122
    Unhide Worksheets
 
123
    >>> stephan.printQuery('//form//table/tr/td[2]/span/text()')
 
124
    Second Sheet
 
125
 
 
126
We'll choose the worksheet we just hid and hit the Unhide button.  The
 
127
view automatically returns to the worksheets view.  There we see that
 
128
the worksheet has reappeared in the worksheets list.
 
129
 
 
130
    >>> stephan.getControl(name='unhide:list').value = ['Worksheet-2']
 
131
    >>> stephan.getControl('Unhide').click()
 
132
    >>> stephan.printQuery('//h1')
 
133
    <h1>Worksheets</h1>
 
134
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
 
135
    Sheet1
 
136
    Second Sheet
 
137
 
 
138
We'll return to the gradebook to see both worksheets:
 
139
 
 
140
    >>> stephan.getLink('Return to Gradebook').click()
 
141
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
142
    <td class="active_tab">
 
143
      <span style="font-weight: bold;">Sheet1</span>
 
144
    </td>
 
145
    <td class="active_tab">
 
146
      <a href="...">Second Sheet</a>
 
147
    </td>