~launchpad-pqm/launchpad/devel

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
Asking a New Question from a ProjectGroup
=========================================

Even though project groups are not QuestionTargets, it is still possible
to create a question from a project group. There are some form and
behaviour difference from the regular process for asking a question
(documented in 35-question-add.txt). Firstly, we do not know the product
the product the question is about, so we ask the user to select one.
Secondly, without knowing the product, we cannot show the which of the
user's preferred languages are supported.


Ask a question about a Product in a ProjectGroup
------------------------------------------------

The user must be logged in to ask a question. When he attempts to ask a
question, without being logged in, he encounters an unauthorized
exception (and the user will be prompted to login from another page).
The logged user will see the Ask a Question page, for the Mozilla
Project in this case.

    >>> anon_browser.open('http://answers.launchpad.dev/mozilla')
    >>> anon_browser.getLink('Ask a question').click()
    Traceback (most recent call last):
      ...
    Unauthorized...

    >>> user_browser.open('http://answers.launchpad.dev/mozilla')
    >>> user_browser.getLink('Ask a question').click()
    >>> print user_browser.title
    Ask a question...

The workflow is identical to the regular one, except that the user must
select one of the ProjectGroup's Products. The page displays a list of
products associated with the project. Note that the site policy is to
use the word 'Project' for 'Products' (and 'Distributions') so that
users do not have to learn our business' semantics.

    >>> print user_browser.getControl('Project').displayOptions
    ['Mozilla Firefox', 'Mozilla Thunderbird']

The first item in the list is the default value, and it will be
submitted if the user does not change it.

    >>> print user_browser.getControl('Project').displayValue
    ['Mozilla Firefox']

Like for the regular workflow, the user is shown a list of languages,
with the supported languages flagged with an asterisk.

    >>> print user_browser.getControl('Language').displayValue
    ['English (en) *']

    >>> langs = sorted(user_browser.getControl('Language').displayOptions)
    >>> for lang in langs: print lang
    Afrikaans (af)
    English (en) *
    Sotho, Southern (st)
    Xhosa (xh)
    Zulu (zu)

No Privileged Person enters a short summary of his problem, and submits
the form with the 'Continue' button. In this case, a question for
Firefox in English regarding SVG.

    >>> user_browser.getControl('Summary').value = (
    ...     'Problem with SVG')
    >>> user_browser.getControl('Continue').click()

He's shown a list of similar questions related to the product Firefox
that he submitted:

    >>> similar_questions = find_tag_by_id(
    ...     user_browser.contents, 'similar-questions')
    >>> for row in similar_questions.fetch('li'):
    ...     print row.a.renderContents()
    2: Problem showing the SVG demo on W3C site

No Privileged Person can still change the product for which he's asking
the question. The user chooses Thunderbird from the 'Project' product
list.

    >>> user_browser.getControl('Mozilla Thunderbird').selected = True

If he empties the question summary, and submits the form he'll be
redirected to the first page. Let's assume he does this by accident as
he revises the summary after reading the similar questions.

    >>> user_browser.getControl('Summary').value = ''
    >>> user_browser.getControl('Post Question').click()

An error message in the page informs the user that the summary is
missing:

    >>> soup = find_main_content(user_browser.contents)
    >>> print soup.first('div', 'message').renderContents()
    You must enter a summary of your problem.

The product Thunderbird that he selected on the previous screen is still
selected. No Privileged Person re-enters his question summary, and
submits the form.

    >>> print user_browser.getControl('Project').displayValue
    ['Mozilla Thunderbird']

    >>> user_browser.getControl('Summary').value = (
    ...     'Problem displaying complex SVG')
    >>> user_browser.getControl('Continue').click()

The user is again shown similar questions, this time for the product
Thunderbird. Since there are no similar questions against Thunderbird,
an appropriate message is displayed to inform him of this:

    >>> soup = find_main_content(user_browser.contents)
    >>> print soup.first('p').renderContents()
    There are no existing FAQs or questions similar to the summary you
    entered.

The user then elaborates upon his question by entering a description of
the problem. He submits the form using the 'Post Question' button.

    >>> user_browser.getControl('Description').value = (
    ...  "I received an HTML message containing an inlined SVG\n"
    ...  "representation of a chessboard. It didn't displayed properly.\n"
    ...  "Is there a way to configure Thunderbird to display SVG properly?\n")
    >>> user_browser.getControl('Post Question').click()

No Privileged Person is taken to page displaying his question. From this
point on, the user's interaction with the question follows to regular
workflow. (see 30-question-workflow.txt for the details).

    >>> user_browser.url
    '.../thunderbird/+question/...'

    >>> print user_browser.title
    Question #... : Questions : Mozilla Thunderbird


Supported Language behaviour
----------------------------

Following a similar path as demonstrated above with a non-English
language speaker illustrates a less-than-ideal behaviour for supported
languages. (See xx-question-add-in-other-languages.txt for the regular
behaviour).


Register a support contact who speaks a non-English language
............................................................

To illustrate the supported language behavior, we add an answer contact
to Thunderbird who has Japanese as a preferred language. Japanese will
be a supported language for Thunderbird Questions, which allows us to
test the supported languages behaviour for non-English languages. Dafydd
speaks Japanese, so we will use him.

    >>> daf_browser = setupBrowser(auth='Basic daf@canonical.com:daf')
    >>> daf_browser.open('http://launchpad.dev/~daf/+editlanguages')
    >>> print daf_browser.title
    Language preferences...

    >>> daf_browser.getControl('Japanese').selected
    True

    >>> daf_browser.open(
    ...     'http://answers.launchpad.dev/thunderbird/+answer-contact')
    >>> print daf_browser.title
    Answer contact for...

    >>> daf_browser.getControl('I want to be an answer contact for '
    ...                        'Mozilla Thunderbird').selected = True
    >>> daf_browser.getControl('Continue').click()
    >>> content = find_main_content(daf_browser.contents)
    >>> for message in content.findAll('div', 'informational message'):
    ...      print message.renderContents()
    You have been added as an answer contact for Mozilla Thunderbird.

And we add Japanese to No Privileges Person's preferred languages. We
then have a condition for certain products, Thunderbird in this example,
where the user's languages and the answer contact's languages will
match. This condition demonstrates the supported language behaviour.

    >>> user_browser.open(
    ...     'http://launchpad.dev/~no-priv/+editlanguages')
    >>> print user_browser.title
    Language preferences...

    >>> user_browser.getControl('Japanese').selected = True
    >>> user_browser.getControl('Save').click()
    >>> soup = find_main_content(user_browser.contents)
    >>> print soup.first('div', 'informational message').renderContents()
    Added Japanese to your preferred languages.

So if No Privileges Person were to visit the Ask a Question page for
Thunderbird directly, he will see that Japanese, as well English (the
default supported language), have asterisks next to them in the Language
list. This indicates that he can ask a question in Japanese or English
and expect someone to reply in the same language.

    >>> user_browser.open(
    ...     'http://answers.launchpad.dev/thunderbird/+addquestion')
    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja) *']

The supported languages will not be shown immediately when Sample Person
asks a question Thunderbird question from the context of the Mozilla
Project.


Ask a non-English question about a Product in a ProjectGroup
............................................................

Supported languages are only shown after the user submits the 'Product'
associated with the project. When a user enters the 'Product'
information incorrectly we cannot show the supported languages to the
user.


Supported languages aren't displayed after choosing a product
.............................................................

XXX sinzui 2007-05-02 #111793 (Supported languages will not be shown in
some cases when asking questions from the ProjectGroup facet) No
Privileges Person visits the Ask a question page from a project just as
No Privileged Person did above, but this time in wants to do so in
Japanese.

    >>> user_browser.open('http://answers.launchpad.dev/mozilla')
    >>> user_browser.getLink('Ask a question').click()
    >>> print user_browser.title
    Ask a question...

The page displays a list of products associated with the project. The
first item in the list is the default value, and it will be submitted if
the user does not change it.

    >>> print user_browser.getControl('Project').displayOptions
    ['Mozilla Firefox', 'Mozilla Thunderbird']

    >>> print user_browser.getControl('Project').displayValue
    ['Mozilla Firefox']

Like for the regular workflow, the user is shown a list of languages,
with the supported languages flagged with an asterisk. Note that only
English is flagged because we do not know which Product the question is
about. Without knowing the product, we cannot flag the supported
languages other than the default language of English. If the user were
to submit his question in another language, he might find that the
language is supported on the next page.

    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja)']

    >>> user_browser.getControl('Language').value = ['en']

No Privileges Person enters a short summary of his problem in English
because Japanese is not listed as supported. He submits the form with
the 'Continue' button without setting the product. In this case, he is
asking a question for Firefox in English regarding SVG.

    >>> user_browser.getControl('Summary').value = (
    ...     'Problem displaying complex SVG')
    >>> user_browser.getControl('Continue').click()

He's shown a list of similar questions related to the product Firefox.
He can see which of his preferred languages are supported for the
Firefox product by reviewing which languages has asterisks in the
Languages list--only English in the example.

    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja)']

No Privileges Person can still change the product for which he's asking
the question. He relizes he should have selected Thunderbird as the
subject of the question. He chooses Thunderbird from the 'Project'
product list and reviews the list of supported languages again. The
language list does not change because the Thunderbird was not submitted
as the product.

    >>> user_browser.getControl('Mozilla Thunderbird').selected = True
    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja)']

If No Privileges Person asks a question in Japanese, it will be
supported by Dafydd, but No Privileges Person will never know that.
Let's stop here. The rest of this scenario is just adding a question as
described above--filling in a description and submitting the data with
the 'Post Question' button.


Supported languages are displayed after the submitting a product
................................................................

Let's try this again from the starting page, but this time, No
Privileges Person correctly chooses Thunderbird as the subject of his
question.

    >>> user_browser.open('http://answers.launchpad.dev/mozilla')
    >>> user_browser.getLink('Ask a question').click()
    >>> print user_browser.title
    Ask a question...

    >>> user_browser.getControl('Mozilla Thunderbird').selected = True

He writes his summary in English as he sees that is the only supported
Language, and 'Continues' to the next page.

    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja)']

    >>> user_browser.getControl('Summary').value = (
    ...     'Problem displaying complex SVG')
    >>> user_browser.getControl('Continue').click()

The product Thunderbird that he selected on the previous screen is still
selected. He can see that this product has support for Japanese as well
as English when he sees the asterisks next to both in the Languages
list. Japanese is supported because Dafydd speaks Japanese and is an
answer contact for Thunderbird. We see this only after a question
summary is submitted for a product.

    >>> print user_browser.getControl('Language').displayOptions
    ['English (en) *', 'Japanese (ja) *']

No Privileges Person sets the language to Japanese, changes his question
summary, writes a description, and submits the form with the 'Post
Question' button.

    >>> print user_browser.getControl('Project').displayValue
    ['Mozilla Thunderbird']

    >>> user_browser.getControl('Japanese (ja) *').selected = True
    >>> user_browser.getControl('Summary').value = (
    ...     'Pretend this is written in Japanese')
    >>> user_browser.getControl('Description').value = (
    ...      "Something in kanji and hiragana.")
    >>> user_browser.getControl('Post Question').click()

The user is taken to page displaying his question. Changing the language
or the summary did not search for similar questions again--the question
is created.

    >>> user_browser.url
    '.../thunderbird/+question/...'

    >>> print user_browser.title
    Question #... : Questions : Mozilla Thunderbird