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
|
== Creating a new FAQ ==
New FAQs can be created for a project by users who have 'moderation'
privileges. This includes answer contacts and the project's owner.
No Privileges Person is not an answer contact for Mozilla Firefox, nor
the project owner, therefore he cannot create a new FAQ.
>>> user_browser.open('http://answers.launchpad.dev/firefox')
>>> user_browser.getLink('All FAQs').click()
>>> user_browser.getLink('Create a new FAQ')
Traceback (most recent call last):
...
LinkNotFoundError
>>> user_browser.open(
... 'http://answers.launchpad.dev/firefox/+createfaq')
Traceback (most recent call last):
...
Unauthorized: ...
Sample Person does have that ability to create a FAQ because he is the
project owner. He is looking for a FAQ about RSS, but he does not find
one. He chooses to create one because he has answered several questions
from various sources about the subject.
>>> owner_browser = setupBrowser(auth='Basic test@canonical.com:test')
>>> owner_browser.open('http://answers.launchpad.dev/firefox')
>>> owner_browser.getLink('All FAQs').click()
>>> print owner_browser.title
FAQs for Mozilla Firefox : Questions : Mozilla Firefox
>>> print extract_text(
... find_tag_by_id(owner_browser.contents, 'faqs-listing'))
What's the keyboard shortcut for [random feature]?
How do I install plugins (Shockwave, QuickTime, etc.)?
How do I troubleshoot problems with extensions/themes?
How do I install Extensions?
How do I install Java?
>>> owner_browser.getLink('Create a new FAQ').click()
The page for creating a new FAQ contains three fields that are empty.
Sample Person adds a title, keywords, and puts the answer into the
content field. He then submits the form using the 'Create' button.
>>> owner_browser.url
'http://answers.launchpad.dev/firefox/+createfaq'
>>> print owner_browser.title
Create a FAQ for...
>>> owner_browser.getControl('Title').value
''
>>> owner_browser.getControl('Keywords').value
''
>>> owner_browser.getControl('Content').value
''
>>> owner_browser.getControl('Title').value = 'How do I read RSS?'
>>> owner_browser.getControl('Keywords').value = 'RSS, bookmark'
>>> owner_browser.getControl('Content').value = 'Use the bookmark bar.'
>>> owner_browser.getControl('Create').click()
The FAQ is created and the browser displays the page for Sample Person.
>>> owner_browser.url
'http://answers.launchpad.dev/firefox/+faq/...'
>>> print owner_browser.title
FAQ #12 : Questions : Mozilla Firefox
>>> content = find_main_content(owner_browser.contents)
>>> extract_text(find_tag_by_id(content, 'faq-keywords'))
u'Keywords:...RSS bookmark'
>>> extract_text(find_tag_by_id(content, 'faq-content'))
u'Use the bookmark bar.'
He returns to the projects list of FAQs to verify that the newest
FAQ is listed first.
>>> owner_browser.getLink('List all FAQs').click()
>>> print owner_browser.title
FAQs for Mozilla Firefox : Questions : Mozilla Firefox
>>> print extract_text(
... find_tag_by_id(owner_browser.contents, 'faqs-listing'))
How do I read RSS?
What's the keyboard shortcut for [random feature]?
How do I install plugins (Shockwave, QuickTime, etc.)?
How do I troubleshoot problems with extensions/themes?
How do I install Extensions?
|