Merge lp:~rockstar/launchpad/fix-code-windmill-tests into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/fix-code-windmill-tests
Merge into: lp:launchpad
Diff against target: 274 lines (+119/-40)
5 files modified
lib/canonical/launchpad/javascript/code/subscription.js (+1/-1)
lib/lp/code/stories/branches/xx-subscribing-branches.txt (+87/-3)
lib/lp/code/templates/branch-portlet-subscribers.pt (+6/-11)
lib/lp/code/windmill/tests/test_branch_links.py (+24/-24)
lib/lp/code/windmill/tests/test_code_review.py (+1/-1)
To merge this branch: bzr merge lp:~rockstar/launchpad/fix-code-windmill-tests
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Canonical Launchpad Engineering code Pending
Review via email: mp+17268@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

This branch fixes a couple of windmill tests that were broken, as well as a breakage in my progressive enhancement changes that were introduced with my subscription refactoring.

The subscription refactoring apparently had a letter deleted accidentally before landing that ended up causing some of the Windmill tests to fail because the javascript was erroring out (and javascript doesn't deal with errors very well.) Also, apparently in some merge from trunk into my subscription refactoring branch, my changes got thrown away (probably due to human error in conflict resolution). I introduced a page test to make sure this won't happen again. The rest of the changes were minor changes that got through before Windmill was required in the test run, and will no longer break now that it is part of the test run.

Also, while fixing broken tests, I took the liberty of cleaning up the bug-branch link windmill test to remove repeatability, as well as clear up some copy-n-paste errors.

Revision history for this message
Tim Penhey (thumper) wrote :

Extra line at 103 of the diff.

ReSTify xx-subscribing-branches.txt, and a missing space for ' >>>' at the end of that file too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/javascript/code/subscription.js'
2--- lib/canonical/launchpad/javascript/code/subscription.js 2009-11-20 16:22:08 +0000
3+++ lib/canonical/launchpad/javascript/code/subscription.js 2010-01-13 03:04:37 +0000
4@@ -40,7 +40,7 @@
5 user_name = me.substring(2);
6
7 // There is no need to set display_name if it exists.
8- if (Y.Lang.isVale(display_name)) {
9+ if (Y.Lang.isValue(display_name)) {
10 return;
11 }
12
13
14=== modified file 'lib/lp/code/stories/branches/xx-subscribing-branches.txt'
15--- lib/lp/code/stories/branches/xx-subscribing-branches.txt 2009-08-13 15:12:16 +0000
16+++ lib/lp/code/stories/branches/xx-subscribing-branches.txt 2010-01-13 03:04:37 +0000
17@@ -1,4 +1,16 @@
18-= Helper Functions =
19+Helper Functions
20+================
21+
22+A quick helper function to list the subscribed people.
23+
24+ >>> def print_subscribers(contents):
25+ ... subscriptions = find_tags_by_class(
26+ ... contents, 'branch-subscribers')[0]
27+ ... if subscriptions == None:
28+ ... print subscriptions
29+ ... return
30+ ... for subscriber in subscriptions.fetch('div'):
31+ ... print extract_text(subscriber.renderContents())
32
33 Another to print the informational message.
34
35@@ -8,7 +20,8 @@
36 ... print extract_text(message[0])
37
38
39-= Subscribing to Branches =
40+Subscribing to Branches
41+=======================
42
43 In order to subscribe to a branch, the user must be logged in.
44
45@@ -25,6 +38,10 @@
46 >>> browser = setupBrowser(auth='Basic no-priv@canonical.com:test')
47 >>> browser.open('http://launchpad.dev/~name12/gnome-terminal/main')
48
49+Initially there should be no subscribers.
50+
51+ >>> print_subscribers(browser.contents)
52+ No subscribers.
53 >>> browser.getLink('Subscribe').click()
54
55 At this stage the defaults that are set for subscriptions
56@@ -45,6 +62,11 @@
57 as name, description and whiteboard.
58 Send email about any code review activity for this branch.
59
60+There should be only one person subscribed to the branch now.
61+
62+ >>> print_subscribers(browser.contents)
63+ No Privileges Person
64+
65 Now, press the back button, and post the subscription form again. We
66 should see a message that we are already subscribed.
67
68@@ -77,6 +99,9 @@
69 Limit the generated diff to 5000 lines.
70 Send email about any code review activity for this branch.
71
72+ >>> print_subscribers(browser.contents)
73+ No Privileges Person
74+
75 The page to edit a person's subscription also allows the user to
76 unsubscribe.
77
78@@ -88,6 +113,8 @@
79
80 >>> print_informational_message(browser.contents)
81 You have unsubscribed from this branch.
82+ >>> print_subscribers(browser.contents)
83+ No subscribers.
84
85 Clicking the back button and then clicking on either Change or
86 Unsubscribe will give a message that we are not subscribed.
87@@ -103,7 +130,8 @@
88 You are not subscribed to this branch.
89
90
91-== Subscribing someone else ==
92+Subscribing someone else
93+========================
94
95 The 'Subscribe' action listed for branches is for subscribing the logged
96 in user. In order to be able to subscribe teams to branches there needs
97@@ -149,6 +177,9 @@
98 Limit the generated diff to 5000 lines.
99 Send email about any code review activity for this branch.
100
101+ >>> print_subscribers(browser.contents)
102+ Mark Shuttleworth
103+
104 Subscribing a team is as simple as putting in the team name.
105
106 >>> browser.getLink('Subscribe someone else').click()
107@@ -185,3 +216,56 @@
108 Limit the generated diff to 1000 lines.
109 Send email about any code review activity for this branch.
110
111+ >>> anon_browser.open(
112+ ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
113+ >>> print_subscribers(anon_browser.contents)
114+ Landscape Developers
115+ Mark Shuttleworth
116+
117+Launchpad administrators can edit anyones branch subsription.
118+
119+ >>> admin_browser.open(
120+ ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
121+ >>> print_subscribers(admin_browser.contents)
122+ Landscape Developers
123+ Mark Shuttleworth
124+
125+
126+Editing a team subscription
127+===========================
128+
129+In order to edit a team subscription the logged in user needs to be
130+a member of the team that is subscribed. There is a link shown in
131+the subscriptions portlet to edit the subscription of a team that
132+the logged in user is a member of.
133+
134+XXX: thumper 2007-06-11
135+There should be a central user subscriptions page. This could then
136+be used to traverse to the branch subscriptions instead of through
137+the branch itself.
138+
139+ >>> browser.open(
140+ ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
141+ >>> print_subscribers(browser.contents)
142+ Landscape Developers
143+ Mark Shuttleworth
144+
145+ >>> browser.getLink(url='+subscription/landscape').click()
146+ >>> main_content = find_main_content(browser.contents)
147+ >>> print extract_text(main_content.h1)
148+ Edit subscription to branch for Landscape Developers
149+
150+From this page the branch subscription can be altered...
151+
152+ >>> browser.getControl('Notification Level').displayValue = [
153+ ... 'No email']
154+ >>> browser.getControl('Change').click()
155+
156+... or unsubscribed from.
157+
158+ >>> browser.getLink(url='+subscription/landscape').click()
159+ >>> browser.getControl('Unsubscribe').click()
160+ >>> print_informational_message(browser.contents)
161+ Landscape Developers has been unsubscribed from this branch.
162+ >>> print_subscribers(browser.contents)
163+ Mark Shuttleworth
164
165=== modified file 'lib/lp/code/templates/branch-portlet-subscribers.pt'
166--- lib/lp/code/templates/branch-portlet-subscribers.pt 2010-01-04 19:36:17 +0000
167+++ lib/lp/code/templates/branch-portlet-subscribers.pt 2010-01-13 03:04:37 +0000
168@@ -23,17 +23,12 @@
169 tal:content="structure link/render"
170 />
171 </div>
172- <h2>Subscribers</h2>
173- <p id="subscriber-list">
174- <noscript>
175- Please enable javascript to view branch subscribers.
176- </noscript>
177- </p>
178- <div id="subscribers-portlet-spinner"
179- style="text-align: center; display: none;">
180- <img src="/@@/spinner" />
181- </div>
182+ </div>
183+
184+ <h2>Subscribers</h2>
185+ <div id="branch-subscribers-outer">
186+ <div tal:replace="structure context/@@+branch-portlet-subscriber-content"
187+ />
188 </div>
189 </div>
190-
191 </div>
192
193=== renamed file 'lib/lp/code/windmill/tests/test_branch_index.py.disabled' => 'lib/lp/code/windmill/tests/test_branch_index.py'
194=== modified file 'lib/lp/code/windmill/tests/test_branch_links.py'
195--- lib/lp/code/windmill/tests/test_branch_links.py 2009-09-29 16:57:39 +0000
196+++ lib/lp/code/windmill/tests/test_branch_links.py 2010-01-13 03:04:37 +0000
197@@ -20,6 +20,21 @@
198
199 layer = CodeWindmillLayer
200
201+ def link_bug_and_assert_success(self, client, bug):
202+ """Link a bug to the branch currently viewed by the client."""
203+ client.click(id=u'linkbug')
204+ client.waits.forElement(id=u'field.bug')
205+ client.type(text=bug, id=u'field.bug')
206+ client.click(xpath=u'//button[@name="buglink.actions.change"]')
207+
208+ client.waits.forElement(id=u'buglink-' + bug, timeout=u'10000')
209+
210+ def unlink_bug_and_assert_success(self, client, bug):
211+ """Unlink a bug to the branch currently viewed by the client."""
212+ client.click(id=u'delete-buglink-' + bug)
213+ client.waits.sleep(milliseconds=3000)
214+ client.asserts.assertNotNode(id=u'buglink-' + bug)
215+
216 def test_inline_branch_bug_link_unlink(self):
217 """Test branch bug links."""
218 client = WindmillTestClient("Branch bug links")
219@@ -30,32 +45,17 @@
220 windmill.settings['TEST_URL'] + '/~mark/firefox/release--0.9.1')
221 client.open(url=start_url)
222 client.waits.forElement(id=u'linkbug', timeout=u'10000')
223- client.click(id=u'linkbug')
224-
225- client.waits.forElement(id=u'field.bug')
226- client.type(text=u'1', id=u'field.bug')
227- client.click(xpath=u'//button[@name="buglink.actions.change"]')
228-
229- client.waits.forElement(id=u'buglink-1', timeout=u'10000')
230- client.asserts.assertText(id=u'linkbug',
231- validator=u'Link to another bug report')
232-
233- client.click(id=u'linkbug')
234- client.waits.forElement(id=u'field.bug')
235- client.type(text=u'2', id=u'field.bug')
236- client.click(xpath=u'//button[@name="buglink.actions.change"]')
237-
238- client.waits.forElement(id=u'buglink-1', timeout=u'10000')
239- client.asserts.assertText(id=u'linkbug',
240- validator=u'Link to another bug report')
241+
242+ self.link_bug_and_assert_success(client, u'1')
243+ client.asserts.assertText(id=u'linkbug',
244+ validator=u'Link to another bug report')
245+ self.link_bug_and_assert_success(client, u'2')
246+
247+ client.waits.forElement(id=u'buglink-2', timeout=u'10000')
248
249 # And now to unlink.
250- client.click(id=u'delete-buglink-1')
251- client.waits.sleep(milliseconds=3000)
252- client.asserts.assertNotNode(id=u'buglink-1')
253- client.click(id=u'delete-buglink-2')
254- client.waits.sleep(milliseconds=3000)
255- client.asserts.assertNotNode(id=u'buglink-2')
256+ self.unlink_bug_and_assert_success(client, u'1')
257+ self.unlink_bug_and_assert_success(client, u'2')
258 client.asserts.assertText(id=u'linkbug',
259 validator=u'Link to a bug report')
260
261
262=== renamed file 'lib/lp/code/windmill/tests/test_branch_subscriptions.py.disabled' => 'lib/lp/code/windmill/tests/test_branch_subscriptions.py'
263=== renamed file 'lib/lp/code/windmill/tests/test_code_review.py.disabled' => 'lib/lp/code/windmill/tests/test_code_review.py'
264--- lib/lp/code/windmill/tests/test_code_review.py.disabled 2009-12-21 08:12:18 +0000
265+++ lib/lp/code/windmill/tests/test_code_review.py 2010-01-13 03:04:37 +0000
266@@ -34,7 +34,7 @@
267 '/~name12/gnome-terminal/klingon/']))
268 client.waits.forPageLoad(timeout=u'10000')
269
270- link = u'//a[@class="menu-link-register_merge sprite merge-proposal"]'
271+ link = u'//a[@class="menu-link-register_merge sprite add"]'
272 client.click(xpath=link)
273 client.type(text=u'~name12/gnome-terminal/main',
274 id=u'field.target_branch.target_branch')