~launchpad-pqm/launchpad/devel

13130.2.11 by Curtis Hovey
Hush lint.
1
Question Workflow
2
=================
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
3
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
4
The status of a question changes based on the action done by users on
5
it. To demonstrate the workflow, we will use the existing question #2 on
6
the Firefox product which was filed by 'Sample Person'.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
7
3691.259.1 by Francis J. Lacoste
Convert to Moin-style headers, convert () comments to regular python comments.
8
    # We will use one browser objects for the owner, and one for the user
9
    # providing support, 'No Privileges Person' here.
13130.2.11 by Curtis Hovey
Hush lint.
10
4920.4.7 by Christian Reis
Convert answer-tracker to use setupBrowser
11
    >>> owner_browser = setupBrowser(auth='Basic test@canonical.com:test')
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
12
4920.4.7 by Christian Reis
Convert answer-tracker to use setupBrowser
13
    >>> support_browser = setupBrowser(
14
    ...     auth='Basic no-priv@canonical.com:test')
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
15
3691.259.1 by Francis J. Lacoste
Convert to Moin-style headers, convert () comments to regular python comments.
16
    # Define some utility functions to retrieve easily the last comment
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
17
    # added and the status of the question.
13130.2.11 by Curtis Hovey
Hush lint.
18
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
19
    >>> def find_request_status(contents):
9098.6.12 by Paul Hummer
Fixed tests
20
    ...     print extract_text(
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
21
    ...         find_tag_by_id(contents, 'question-status'))
9098.6.12 by Paul Hummer
Fixed tests
22
3691.197.77 by Francis J. Lacoste
Improve comments.
23
    >>> def  find_last_comment(contents):
4788.1.4 by Christian Reis
Get rid of BeautifulSoup() invocations in our pagetests, replacing with find_main_content.
24
    ...     soup = find_main_content(contents)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
25
    ...     return soup.fetch('div', 'boardCommentBody')[-1]
26
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
27
    >>> def print_last_comment(contents):
28
    ...     print extract_text(find_last_comment(contents))
29
5126.2.6 by Francis J. Lacoste
Update to use proper helpers.
30
13130.2.11 by Curtis Hovey
Hush lint.
31
Logging In
32
----------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
33
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
34
To participate in a question, the user must be logged in.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
35
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
36
    >>> anon_browser.open('http://launchpad.dev/firefox/+question/2')
3700.1.105 by Matthew Paul Thomas
Fixes support tracker pagetests.
37
    >>> print anon_browser.contents
38
    <!DOCTYPE...
39
    ...
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
40
    To post a message you must <a href="+login">log in</a>.
3700.1.105 by Matthew Paul Thomas
Fixes support tracker pagetests.
41
    ...
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
42
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
43
13130.2.11 by Curtis Hovey
Hush lint.
44
Requesting for More Information
45
-------------------------------
46
47
It's not unusual that the original message of a question is terse and
48
quite vague. In these cases, to help the user, some more information
49
will be required.
50
51
No Privileges Person visits the question. He see the heading 'Can you
52
help with this problem?'. The problem is not clear, he needs more
53
information. To request for more information from the question owner, No
54
Privileges Person enters his question in the 'Message' field and clicks
55
on the 'Add Information Request' button.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
56
57
    >>> support_browser.open(
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
58
    ...     'http://launchpad.dev/firefox/+question/2')
4471.5.7 by Curtis Hovey
Added rule to never display the 'Can you help...' and 'Ask your own...' blocks when the user is also the question owner.
59
    >>> content = find_tag_by_id(
60
    ...     support_browser.contents, 'can-you-help-with-this-problem')
61
    >>> print content.h2.renderContents()
62
    Can you help with this problem?
9098.6.12 by Paul Hummer
Fixed tests
63
9322.2.3 by Paul Hummer
Fixed indentation issues
64
    >>> print extract_text(
65
    ...     find_tag_by_id(support_browser.contents, 'horizontal-menu'))
9322.2.1 by Paul Hummer
Added failing tests
66
    Link existing bug
67
    Create bug report
68
    Link to a FAQ
9861.5.9 by Curtis Hovey
Updated tests to verify FAQ information.
69
    Create a new FAQ
9322.2.1 by Paul Hummer
Added failing tests
70
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
71
    >>> support_browser.getControl('Message').value = (
72
    ...     "Can you provide an example of an URL displaying the problem?")
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
73
    >>> support_browser.getControl('Add Information Request').click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
74
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
75
The message was added to the question and its status was changed to
76
'Needs information':
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
77
9098.6.12 by Paul Hummer
Fixed tests
78
    >>> find_request_status(support_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
79
    Status: Needs information
13130.2.11 by Curtis Hovey
Hush lint.
80
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
81
    >>> print_last_comment(support_browser.contents)
82
    Can you provide an example of an URL displaying the problem?
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
83
84
Of course, if you don't add a message, clicking on the button will give
85
you an error.
86
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
87
    >>> support_browser.getControl('Add Information Request').click()
4788.1.4 by Christian Reis
Get rid of BeautifulSoup() invocations in our pagetests, replacing with find_main_content.
88
    >>> soup = find_main_content(support_browser.contents)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
89
    >>> print soup.first('div', 'message').renderContents()
90
    Please enter a message.
91
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
92
13130.2.11 by Curtis Hovey
Hush lint.
93
Adding a Comment
94
----------------
9570.9.1 by Gavin Panella
For logged-in users, always allow comments on a question without changing the status.
95
96
A comment can be added at any point without altering the status. The
13130.2.11 by Curtis Hovey
Hush lint.
97
user simply enters the comment in the 'Message' box and clicks the 'Just
98
Add a Comment' button.
9570.9.1 by Gavin Panella
For logged-in users, always allow comments on a question without changing the status.
99
100
    >>> support_browser.getControl('Message').value = (
101
    ...     "I forgot to mention, in the meantime here is a workaround...")
9638.1.1 by Gavin Panella
Change the 'Add Comment' button to 'Just Add a Comment'.
102
    >>> support_browser.getControl('Just Add a Comment').click()
9570.9.1 by Gavin Panella
For logged-in users, always allow comments on a question without changing the status.
103
104
This appends the comment to the question and it doesn't change its
105
status:
106
107
    >>> print find_request_status(support_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
108
    Status: Needs information ...
13130.2.11 by Curtis Hovey
Hush lint.
109
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
110
    >>> print_last_comment(support_browser.contents)
111
    I forgot to mention, in the meantime here is a workaround...
9570.9.1 by Gavin Panella
For logged-in users, always allow comments on a question without changing the status.
112
113
13130.2.11 by Curtis Hovey
Hush lint.
114
Answering with More Information
115
-------------------------------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
116
13130.2.11 by Curtis Hovey
Hush lint.
117
When the question is in the 'Needs information' state, it means that the
118
question owner should come back and provide more information. He can do
119
so by entering the reply in the 'Message' box and clicking on the "I'm
120
Providing More Information" button. Note that the question owner cannot
121
see the 'Can you help with this problem?' heading because it is not
122
relevant to his tasks.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
123
124
    >>> owner_browser.open(
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
125
    ...     'http://launchpad.dev/firefox/+question/2')
4471.5.7 by Curtis Hovey
Added rule to never display the 'Can you help...' and 'Ask your own...' blocks when the user is also the question owner.
126
    >>> content = find_tag_by_id(
127
    ...     owner_browser.contents, 'can-you-help-with-this-problem')
128
    >>> content is None
129
    True
130
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
131
    >>> owner_browser.getControl('Message').value = (
132
    ...     "The following SVG doesn't display properly:\n"
133
    ...     "http://www.w3.org/2001/08/rdfweb/rdfweb-chaals-and-dan.svg")
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
134
    >>> owner_browser.getControl("I'm Providing More Information").click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
135
136
Once the owner replied with the, hopefully, requested information, the
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
137
status is changed to Open and his answer appended to the question
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
138
discussion.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
139
140
    >>> print find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
141
    Status: Open ...
13130.2.11 by Curtis Hovey
Hush lint.
142
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
143
    >>> print_last_comment(owner_browser.contents)
144
    The following SVG doesn't display properly:
145
    http://www.w3.org/2001/08/rdfweb/rdfweb-chaals-and-dan.svg
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
146
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
147
13130.2.11 by Curtis Hovey
Hush lint.
148
Giving an Answer
149
----------------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
150
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
151
Once the question is clarified, it is easier for a user to give an
13130.2.11 by Curtis Hovey
Hush lint.
152
answer. This is done by entering the answer in the 'Message' box and
153
clicking the 'Propose Answer' button.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
154
155
    >>> support_browser.open(
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
156
    ...     'http://launchpad.dev/firefox/+question/2')
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
157
    >>> support_browser.getControl('Message').value = (
158
    ...     "New version of the firefox package are available with SVG "
159
    ...     "support enabled. You can use apt-get or adept to upgrade.")
13045.9.2 by Chris Johnston
Changes 'Add Answer' to 'Propose Answer' for better clarity.
160
    >>> support_browser.getControl('Propose Answer').click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
161
13130.2.11 by Curtis Hovey
Hush lint.
162
This moves the the question to the Answered state and adds the answer to
163
the end of the discussion:
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
164
165
    >>> print find_request_status(support_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
166
    Status: Answered ...
13130.2.11 by Curtis Hovey
Hush lint.
167
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
168
    >>> print_last_comment(support_browser.contents)
169
    New version of the firefox package are available with SVG support
170
    enabled. You can use apt-get or adept to upgrade.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
171
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
172
13130.2.11 by Curtis Hovey
Hush lint.
173
Confirming an Answer
174
--------------------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
175
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
176
When the owner comes back on the question page, he will now see a new
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
177
'This Solved My Problem' button near the answer.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
178
179
    >>> owner_browser.open(
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
180
    ...     'http://launchpad.dev/firefox/+question/2')
4788.1.4 by Christian Reis
Get rid of BeautifulSoup() invocations in our pagetests, replacing with find_main_content.
181
    >>> soup = find_main_content(owner_browser.contents)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
182
    >>> soup.fetch('div', 'boardComment')[-1].first('input', type='submit')
183
    <input type="submit" name="field.actions.confirm"
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
184
     value="This Solved My Problem" />
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
185
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
186
(Note although we have three comments on the question, that's the only
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
187
one that has this button. Only answers have this button.)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
188
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
189
There is also a hint below the form to the question owner about using
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
190
the 'This Solved My Problem' button.
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
191
192
    >>> answer_button_paragraph = find_tag_by_id(
193
    ...     owner_browser.contents, 'answer-button-hint')
194
    >>> print extract_text(answer_button_paragraph)
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
195
    To confirm an answer, use the 'This Solved My Problem' button located at
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
196
    the bottom of the answer.
197
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
198
Clicking that button will confirm that the answer solved the problem.
199
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
200
    >>> owner_browser.getControl('This Solved My Problem').click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
201
13130.2.11 by Curtis Hovey
Hush lint.
202
This changes the status of the question to 'Solved' and mark 'No
203
Privileges Person' as the solver.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
204
205
    >>> print find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
206
    Status: Solved ...
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
207
208
Since no message can be provided when that button is clicked. A default
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
209
confirmation message was appended to the question discussion:
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
210
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
211
    >>> print_last_comment(owner_browser.contents)
212
    Thanks No Privileges Person, that solved my question.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
213
214
The confirmed answer is also highlighted.
215
5126.2.6 by Francis J. Lacoste
Update to use proper helpers.
216
    >>> soup = find_main_content(owner_browser.contents)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
217
    >>> bestAnswer = soup.fetch('div', 'boardComment')[-2]
3847.2.68 by Mark Shuttleworth
Test fixes
218
    >>> print bestAnswer.first('img')
4428.2.3 by Curtis Hovey
Corrected test to identify altered markup.
219
    <img src="/@@/favourite-yes" ... title="Marked as best answer" />
13130.2.11 by Curtis Hovey
Hush lint.
220
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
221
    >>> print soup.first(
222
    ...     'div', 'boardCommentBody highlighted').renderContents()
223
    <p>New version of the firefox package are available with SVG support
224
    enabled. You can use apt-get or adept to upgrade.</p>
225
9322.2.1 by Paul Hummer
Added failing tests
226
The History link should now show up.
227
9322.2.3 by Paul Hummer
Fixed indentation issues
228
    >>> print extract_text(
229
    ...     find_tag_by_id(support_browser.contents, 'horizontal-menu'))
9322.2.1 by Paul Hummer
Added failing tests
230
    History
231
    Link existing bug
232
    Create bug report
233
    Link to a FAQ
9861.5.9 by Curtis Hovey
Updated tests to verify FAQ information.
234
    Create a new FAQ
9322.2.1 by Paul Hummer
Added failing tests
235
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
236
13130.2.11 by Curtis Hovey
Hush lint.
237
Adding another Comment
238
----------------------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
239
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
240
When the question is Solved, it is still possible to add comments to it.
241
The user simply enters the comment in the 'Message' box and clicks the
9638.1.1 by Gavin Panella
Change the 'Add Comment' button to 'Just Add a Comment'.
242
'Just Add a Comment' button.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
243
244
    >>> owner_browser.getControl('Message').value = (
245
    ...     "The example now displays correctly. Thanks.")
9638.1.1 by Gavin Panella
Change the 'Add Comment' button to 'Just Add a Comment'.
246
    >>> owner_browser.getControl('Just Add a Comment').click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
247
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
248
This appends the comment to the question and it doesn't change its
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
249
status:
250
251
    >>> print find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
252
    Status: Solved ...
13130.2.11 by Curtis Hovey
Hush lint.
253
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
254
    >>> print_last_comment(owner_browser.contents)
255
    The example now displays correctly. Thanks.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
256
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
257
13130.2.11 by Curtis Hovey
Hush lint.
258
Reopening
259
---------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
260
13130.2.11 by Curtis Hovey
Hush lint.
261
It can happen that, altough the owner confirmed the question was solved,
262
the original problem reappears. In this case, he can reopen the question
263
by entering a new message and clicking the "I Still Need an Answer"
264
button.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
265
266
    >>> owner_browser.getControl('Message').value = (
267
    ...     "Actually, there are still SVGs that do not display correctly. "
268
    ...     "For example, the following\n"
269
    ...     "http://people.w3.org/maxf/ChessGML/immortal.svg doesn't display "
270
    ...     "correctly.")
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
271
    >>> owner_browser.getControl("I Still Need an Answer").click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
272
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
273
This appends the new information to the question discussion and changes
274
its status back to 'Open'.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
275
276
    >>> print find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
277
    Status: Open ...
13130.2.11 by Curtis Hovey
Hush lint.
278
9570.9.8 by Gavin Panella
Post-review improvements suggested by Barry.
279
    >>> print_last_comment(owner_browser.contents)
280
    Actually, there are still SVGs that do not display correctly.
281
    For example, the following
282
    http://people.w3.org/maxf/ChessGML/immortal.svg doesn't
283
    display correctly.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
284
13130.2.11 by Curtis Hovey
Hush lint.
285
This also removes the highlighting from the previous answer and sets the
286
answerer back to None.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
287
4788.1.4 by Christian Reis
Get rid of BeautifulSoup() invocations in our pagetests, replacing with find_main_content.
288
    >>> soup = find_main_content(owner_browser.contents)
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
289
    >>> bestAnswer = soup.fetch('div', 'boardComment')[-4]
290
    >>> bestAnswer.first('strong') is None
291
    True
13130.2.11 by Curtis Hovey
Hush lint.
292
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
293
    >>> bestAnswer.first('div', 'boardCommentBody')
14412.3.5 by mbp at canonical
Answers page tests expect microformats
294
    <div class="boardCommentBody" itemprop="commentText"><p>New version
295
    of the firefox package
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
296
    are available with SVG support enabled. You can use apt-get or adept to
297
    upgrade.</p></div>
298
299
In addition, this creates a reopening record that is displayed in the
300
reopening portlet.
301
9861.5.11 by Curtis Hovey
Made test robust--markup changes should not break a test.
302
    >>> print extract_text(
303
    ...     find_tag_by_id(owner_browser.contents, 'portlet-reopenings'))
304
    This question was reopened ... Sample Person
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
305
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
306
13130.2.11 by Curtis Hovey
Hush lint.
307
Self-Answer
308
-----------
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
309
13130.2.11 by Curtis Hovey
Hush lint.
310
The owner can also gives the solution to his own question. He simply has
311
to enter his solution in the 'Message' box and click the 'Problem
312
Solved' button.
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
313
314
    >>> owner_browser.getControl('Message').value = (
315
    ...     "OK, this example requires some SVG features that will only be "
316
    ...     "available in Firefox 2.0.")
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
317
    >>> owner_browser.getControl("Problem Solved").click()
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
318
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
319
This appends the message to the question and sets its status to
9297.2.24 by Barry Warsaw
Test repair.
320
'Solved', and the answerer as the owner. We do not however mark a
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
321
message as the "Best answer".
3691.197.36 by Francis J. Lacoste
Implement new workflow UI
322
9098.6.12 by Paul Hummer
Fixed tests
323
    >>> find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
324
    Status: Solved ...
13130.2.11 by Curtis Hovey
Hush lint.
325
5126.2.6 by Francis J. Lacoste
Update to use proper helpers.
326
    >>> soup = find_tag_by_id(owner_browser.contents, 'portlet-details')
327
    >>> soup = find_main_content(owner_browser.contents)
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
328
    >>> bestAnswer = soup.first('img', {'title': 'Marked as best answer'})
329
    >>> None == bestAnswer
3847.2.71 by Mark Shuttleworth
Test fixes
330
    True
331
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
332
A message is displayed to the user confirming that the question is
13130.2.11 by Curtis Hovey
Hush lint.
333
solved and suggesting that the user choose an answer that helped the
334
question owner to solve the his problem.
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
335
336
    >>> for message in soup.findAll('div', 'informational message'):
337
    ...     print extract_text(message)
9297.2.24 by Barry Warsaw
Test repair.
338
    Your question is solved. If a particular message helped you solve the
4576.2.3 by Curtis Hovey
Revisions pre review with kiko.
339
    problem, use the 'This solved my problem' button.
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
340
13130.2.11 by Curtis Hovey
Hush lint.
341
If the user chooses a best answer, the author of that answer is
342
attributed as the answerer.
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
343
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
344
    >>> owner_browser.getControl('This Solved My Problem').click()
9098.6.12 by Paul Hummer
Fixed tests
345
    >>> find_request_status(owner_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
346
    Status: Solved ...
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
347
348
The answer's message is also highlighted as the best answer.
349
5126.2.6 by Francis J. Lacoste
Update to use proper helpers.
350
    >>> soup = find_main_content(owner_browser.contents)
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
351
    >>> bestAnswer = soup.find('img', {'title' : 'Marked as best answer'})
352
    >>> print bestAnswer
4428.2.3 by Curtis Hovey
Corrected test to identify altered markup.
353
    <img src="/@@/favourite-yes" ... title="Marked as best answer" />
13130.2.11 by Curtis Hovey
Hush lint.
354
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
355
    >>> answerer = bestAnswer.parent.find('a')
356
    >>> print extract_text(answerer)
13130.2.7 by Curtis Hovey
Update questions to use link-display-name-id.
357
    No Privileges Person (no-priv)
13130.2.11 by Curtis Hovey
Hush lint.
358
14412.3.5 by mbp at canonical
Answers page tests expect microformats
359
    >>> message = soup.find(
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
360
    ...     'div', 'boardCommentBody highlighted')
14412.3.5 by mbp at canonical
Answers page tests expect microformats
361
    >>> print message
362
    <div class="boardCommentBody highlighted"
363
    itemprop="commentText"><p>New version of the firefox package are
364
    available with SVG support enabled. You can use apt-get or adept to
365
    upgrade.</p></div>
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
366
    >>> print extract_text(message)
367
    New version of the firefox package are available with SVG support
368
    enabled. You can use apt-get or adept to upgrade.
9297.2.24 by Barry Warsaw
Test repair.
369
14412.3.13 by mbp at canonical
Review tweaks (thanks Jeroen)
370
13130.2.11 by Curtis Hovey
Hush lint.
371
History
372
=======
3691.197.38 by Francis J. Lacoste
Display action history on +history
373
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
374
The history of the question is available on the 'History' page.
3691.197.38 by Francis J. Lacoste
Display action history on +history
375
3691.197.40 by Francis J. Lacoste
Add +confirm link
376
    >>> anon_browser.open(
3859.4.3 by Francis J. Lacoste
Rename URLs of the Answer Tracker containging ticket or support-contact.
377
    ...     'http://launchpad.dev/firefox/+question/2')
3691.197.38 by Francis J. Lacoste
Display action history on +history
378
    >>> anon_browser.getLink('History').click()
379
    >>> print anon_browser.title
9322.10.28 by Guilherme Salgado
Fix a ton of tests
380
    History of question #2...
3691.197.38 by Francis J. Lacoste
Display action history on +history
381
3691.398.5 by Francis J. Lacoste
Updated pagetests to use new terminology.
382
It lists all the actions performed through workflow on the question:
3691.197.38 by Francis J. Lacoste
Display action history on +history
383
4788.1.4 by Christian Reis
Get rid of BeautifulSoup() invocations in our pagetests, replacing with find_main_content.
384
    >>> soup = find_main_content(anon_browser.contents)
3691.197.38 by Francis J. Lacoste
Display action history on +history
385
    >>> action_listing = soup.first('table', 'listing')
386
    >>> for header in action_listing.fetch('th'):
387
    ...     print header.renderContents()
3847.2.52 by Mark Shuttleworth
Test fixes for new date presentation
388
    When
3691.197.38 by Francis J. Lacoste
Display action history on +history
389
    Who
390
    Action
391
    New State
13130.2.11 by Curtis Hovey
Hush lint.
392
3691.197.38 by Francis J. Lacoste
Display action history on +history
393
    >>> for row in action_listing.first('tbody').fetch('tr'):
394
    ...     cells = row.fetch('td')
3916.1.1 by Francis J. Lacoste
Use fmt:link to render link to person.
395
    ...     who = extract_text(cells[1].first('a'))
3691.197.38 by Francis J. Lacoste
Display action history on +history
396
    ...     action = cells[2].renderContents()
3691.197.55 by Francis J. Lacoste
Rename newstatus to new_status as per new naming convention. Renamed foreign key to ticket__answer__fk as requested by stub.
397
    ...     new_status = cells[3].renderContents()
3847.2.71 by Mark Shuttleworth
Test fixes
398
    ...     print who.lstrip('&nbsp;'), action, new_status
399
    No Privileges Person Request for more information Needs information
9570.9.1 by Gavin Panella
For logged-in users, always allow comments on a question without changing the status.
400
    No Privileges Person Comment Needs information
3847.2.71 by Mark Shuttleworth
Test fixes
401
    Sample Person        Give more information        Open
402
    No Privileges Person Answer                       Answered
403
    Sample Person        Confirm                      Solved
404
    Sample Person        Comment                      Solved
405
    Sample Person        Reopen                       Open
406
    Sample Person        Confirm                      Solved
4471.5.1 by Curtis Hovey
Revised workflow to allow the question own to set the question status to Solved without selecting an answser first. An Answer can be confirmed while in the solved state.
407
    Sample Person        Confirm                      Solved
3847.2.68 by Mark Shuttleworth
Test fixes
408
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
409
13130.2.11 by Curtis Hovey
Hush lint.
410
Solving a question without an answer
411
------------------------------------
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
412
413
The user that asks a questions may solve the question before another
414
user can submit an answer. Without any answer messages, the user does
415
not see a notification to choose a 'This solved my problem' button.
416
13130.2.11 by Curtis Hovey
Hush lint.
417
Carlos has an open question that no one has submitted an answer for. He
418
is able to solve the problem on his own, and submits the solution for
419
other users with similar problems. He does not see a notice about
9297.2.24 by Barry Warsaw
Test repair.
420
choosing an answer that helped him solve his problem.
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
421
4920.4.7 by Christian Reis
Convert answer-tracker to use setupBrowser
422
    >>> carlos_browser = setupBrowser(auth='Basic carlos@canonical.com:test')
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
423
    >>> carlos_browser.open('http://launchpad.dev/firefox/+question/12')
424
    >>> print find_request_status(carlos_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
425
    Status: Open ...
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
426
427
    >>> answer_button_paragraph = find_tag_by_id(
428
    ...     carlos_browser.contents, 'answer-button-hint')
429
    >>> answer_button_paragraph is None
430
    True
9098.6.12 by Paul Hummer
Fixed tests
431
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
432
    >>> carlos_browser.getControl('Message').value = (
433
    ...     "There is a bug in that version. SMP is fine after upgrading.")
9570.9.6 by Gavin Panella
Return the case of buttons to headline case, as specified in https://dev.launchpad.net/UserInterfaceWording.
434
    >>> carlos_browser.getControl("Problem Solved").click()
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
435
    >>> print find_request_status(carlos_browser.contents)
9861.5.1 by Curtis Hovey
Updated the question index to follow the preferred layout for artefacts.
436
    Status: Solved ...
4576.2.1 by Curtis Hovey
Added two rules to show the 'This Solved My Problem' notice
437
438
    >>> content = find_main_content(carlos_browser.contents)
439
    >>> messages = content.findAll('div', 'informational message')
440
    >>> messages
441
    []
442
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
443
13130.2.11 by Curtis Hovey
Hush lint.
444
Asking a separate question
445
--------------------------
446
447
A user that is new to Answers is not familiar with the workflow. He may
448
have a problem of his own, and has discovered an existing question. We
449
want him to ask his own question instead of intruding into the workflow
450
of existing questions.
451
452
No Privileges Person (a different user from the one above) discovers the
453
Firefox question. The solution does not work, but he thinks he has a
454
similar problem so he asks his own question.
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
455
456
    >>> user_browser.open('http://launchpad.dev/firefox/+question/2')
9297.2.24 by Barry Warsaw
Test repair.
457
4834.2.1 by Curtis Hovey
Add can_answer to the QuestionWorkflowView to test when to display
458
    >>> content = find_main_content(user_browser.contents)
4834.2.2 by Curtis Hovey
Changes per review.
459
    >>> print content.find(id='can-you-help-with-this-problem')
460
    None
9297.2.24 by Barry Warsaw
Test repair.
461
13303.9.2 by Huw Wilkins
Fixed failing doctest
462
    >>> user_browser.getLink('Ask a question').click()
4450.4.1 by Curtis Hovey
Added link and test to ask a new question from a question page.
463
    >>> print user_browser.title
9322.10.26 by Guilherme Salgado
Fix answers tests
464
    Ask a question about...