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
=== modified file 'lib/canonical/launchpad/javascript/code/subscription.js'
--- lib/canonical/launchpad/javascript/code/subscription.js 2009-11-20 16:22:08 +0000
+++ lib/canonical/launchpad/javascript/code/subscription.js 2010-01-13 03:04:37 +0000
@@ -40,7 +40,7 @@
40 user_name = me.substring(2);40 user_name = me.substring(2);
4141
42 // There is no need to set display_name if it exists.42 // There is no need to set display_name if it exists.
43 if (Y.Lang.isVale(display_name)) {43 if (Y.Lang.isValue(display_name)) {
44 return;44 return;
45 }45 }
4646
4747
=== modified file 'lib/lp/code/stories/branches/xx-subscribing-branches.txt'
--- lib/lp/code/stories/branches/xx-subscribing-branches.txt 2009-08-13 15:12:16 +0000
+++ lib/lp/code/stories/branches/xx-subscribing-branches.txt 2010-01-13 03:04:37 +0000
@@ -1,4 +1,16 @@
1= Helper Functions =1Helper Functions
2================
3
4A quick helper function to list the subscribed people.
5
6 >>> def print_subscribers(contents):
7 ... subscriptions = find_tags_by_class(
8 ... contents, 'branch-subscribers')[0]
9 ... if subscriptions == None:
10 ... print subscriptions
11 ... return
12 ... for subscriber in subscriptions.fetch('div'):
13 ... print extract_text(subscriber.renderContents())
214
3Another to print the informational message.15Another to print the informational message.
416
@@ -8,7 +20,8 @@
8 ... print extract_text(message[0])20 ... print extract_text(message[0])
921
1022
11= Subscribing to Branches =23Subscribing to Branches
24=======================
1225
13In order to subscribe to a branch, the user must be logged in.26In order to subscribe to a branch, the user must be logged in.
1427
@@ -25,6 +38,10 @@
25 >>> browser = setupBrowser(auth='Basic no-priv@canonical.com:test')38 >>> browser = setupBrowser(auth='Basic no-priv@canonical.com:test')
26 >>> browser.open('http://launchpad.dev/~name12/gnome-terminal/main')39 >>> browser.open('http://launchpad.dev/~name12/gnome-terminal/main')
2740
41Initially there should be no subscribers.
42
43 >>> print_subscribers(browser.contents)
44 No subscribers.
28 >>> browser.getLink('Subscribe').click()45 >>> browser.getLink('Subscribe').click()
2946
30At this stage the defaults that are set for subscriptions47At this stage the defaults that are set for subscriptions
@@ -45,6 +62,11 @@
45 as name, description and whiteboard.62 as name, description and whiteboard.
46 Send email about any code review activity for this branch.63 Send email about any code review activity for this branch.
4764
65There should be only one person subscribed to the branch now.
66
67 >>> print_subscribers(browser.contents)
68 No Privileges Person
69
48Now, press the back button, and post the subscription form again. We70Now, press the back button, and post the subscription form again. We
49should see a message that we are already subscribed.71should see a message that we are already subscribed.
5072
@@ -77,6 +99,9 @@
77 Limit the generated diff to 5000 lines.99 Limit the generated diff to 5000 lines.
78 Send email about any code review activity for this branch.100 Send email about any code review activity for this branch.
79101
102 >>> print_subscribers(browser.contents)
103 No Privileges Person
104
80The page to edit a person's subscription also allows the user to105The page to edit a person's subscription also allows the user to
81unsubscribe.106unsubscribe.
82107
@@ -88,6 +113,8 @@
88113
89 >>> print_informational_message(browser.contents)114 >>> print_informational_message(browser.contents)
90 You have unsubscribed from this branch.115 You have unsubscribed from this branch.
116 >>> print_subscribers(browser.contents)
117 No subscribers.
91118
92Clicking the back button and then clicking on either Change or119Clicking the back button and then clicking on either Change or
93Unsubscribe will give a message that we are not subscribed.120Unsubscribe will give a message that we are not subscribed.
@@ -103,7 +130,8 @@
103 You are not subscribed to this branch.130 You are not subscribed to this branch.
104131
105132
106== Subscribing someone else ==133Subscribing someone else
134========================
107135
108The 'Subscribe' action listed for branches is for subscribing the logged136The 'Subscribe' action listed for branches is for subscribing the logged
109in user. In order to be able to subscribe teams to branches there needs137in user. In order to be able to subscribe teams to branches there needs
@@ -149,6 +177,9 @@
149 Limit the generated diff to 5000 lines.177 Limit the generated diff to 5000 lines.
150 Send email about any code review activity for this branch.178 Send email about any code review activity for this branch.
151179
180 >>> print_subscribers(browser.contents)
181 Mark Shuttleworth
182
152Subscribing a team is as simple as putting in the team name.183Subscribing a team is as simple as putting in the team name.
153184
154 >>> browser.getLink('Subscribe someone else').click()185 >>> browser.getLink('Subscribe someone else').click()
@@ -185,3 +216,56 @@
185 Limit the generated diff to 1000 lines.216 Limit the generated diff to 1000 lines.
186 Send email about any code review activity for this branch.217 Send email about any code review activity for this branch.
187218
219 >>> anon_browser.open(
220 ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
221 >>> print_subscribers(anon_browser.contents)
222 Landscape Developers
223 Mark Shuttleworth
224
225Launchpad administrators can edit anyones branch subsription.
226
227 >>> admin_browser.open(
228 ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
229 >>> print_subscribers(admin_browser.contents)
230 Landscape Developers
231 Mark Shuttleworth
232
233
234Editing a team subscription
235===========================
236
237In order to edit a team subscription the logged in user needs to be
238a member of the team that is subscribed. There is a link shown in
239the subscriptions portlet to edit the subscription of a team that
240the logged in user is a member of.
241
242XXX: thumper 2007-06-11
243There should be a central user subscriptions page. This could then
244be used to traverse to the branch subscriptions instead of through
245the branch itself.
246
247 >>> browser.open(
248 ... 'http://code.launchpad.dev/~name12/gnome-terminal/main')
249 >>> print_subscribers(browser.contents)
250 Landscape Developers
251 Mark Shuttleworth
252
253 >>> browser.getLink(url='+subscription/landscape').click()
254 >>> main_content = find_main_content(browser.contents)
255 >>> print extract_text(main_content.h1)
256 Edit subscription to branch for Landscape Developers
257
258From this page the branch subscription can be altered...
259
260 >>> browser.getControl('Notification Level').displayValue = [
261 ... 'No email']
262 >>> browser.getControl('Change').click()
263
264... or unsubscribed from.
265
266 >>> browser.getLink(url='+subscription/landscape').click()
267 >>> browser.getControl('Unsubscribe').click()
268 >>> print_informational_message(browser.contents)
269 Landscape Developers has been unsubscribed from this branch.
270 >>> print_subscribers(browser.contents)
271 Mark Shuttleworth
188272
=== modified file 'lib/lp/code/templates/branch-portlet-subscribers.pt'
--- lib/lp/code/templates/branch-portlet-subscribers.pt 2010-01-04 19:36:17 +0000
+++ lib/lp/code/templates/branch-portlet-subscribers.pt 2010-01-13 03:04:37 +0000
@@ -23,17 +23,12 @@
23 tal:content="structure link/render"23 tal:content="structure link/render"
24 />24 />
25 </div>25 </div>
26 <h2>Subscribers</h2>26 </div>
27 <p id="subscriber-list">27
28 <noscript>28 <h2>Subscribers</h2>
29 Please enable javascript to view branch subscribers.29 <div id="branch-subscribers-outer">
30 </noscript>30 <div tal:replace="structure context/@@+branch-portlet-subscriber-content"
31 </p>31 />
32 <div id="subscribers-portlet-spinner"
33 style="text-align: center; display: none;">
34 <img src="/@@/spinner" />
35 </div>
36 </div>32 </div>
37 </div>33 </div>
38
39</div>34</div>
4035
=== renamed file 'lib/lp/code/windmill/tests/test_branch_index.py.disabled' => 'lib/lp/code/windmill/tests/test_branch_index.py'
=== modified file 'lib/lp/code/windmill/tests/test_branch_links.py'
--- lib/lp/code/windmill/tests/test_branch_links.py 2009-09-29 16:57:39 +0000
+++ lib/lp/code/windmill/tests/test_branch_links.py 2010-01-13 03:04:37 +0000
@@ -20,6 +20,21 @@
2020
21 layer = CodeWindmillLayer21 layer = CodeWindmillLayer
2222
23 def link_bug_and_assert_success(self, client, bug):
24 """Link a bug to the branch currently viewed by the client."""
25 client.click(id=u'linkbug')
26 client.waits.forElement(id=u'field.bug')
27 client.type(text=bug, id=u'field.bug')
28 client.click(xpath=u'//button[@name="buglink.actions.change"]')
29
30 client.waits.forElement(id=u'buglink-' + bug, timeout=u'10000')
31
32 def unlink_bug_and_assert_success(self, client, bug):
33 """Unlink a bug to the branch currently viewed by the client."""
34 client.click(id=u'delete-buglink-' + bug)
35 client.waits.sleep(milliseconds=3000)
36 client.asserts.assertNotNode(id=u'buglink-' + bug)
37
23 def test_inline_branch_bug_link_unlink(self):38 def test_inline_branch_bug_link_unlink(self):
24 """Test branch bug links."""39 """Test branch bug links."""
25 client = WindmillTestClient("Branch bug links")40 client = WindmillTestClient("Branch bug links")
@@ -30,32 +45,17 @@
30 windmill.settings['TEST_URL'] + '/~mark/firefox/release--0.9.1')45 windmill.settings['TEST_URL'] + '/~mark/firefox/release--0.9.1')
31 client.open(url=start_url)46 client.open(url=start_url)
32 client.waits.forElement(id=u'linkbug', timeout=u'10000')47 client.waits.forElement(id=u'linkbug', timeout=u'10000')
33 client.click(id=u'linkbug')48
3449 self.link_bug_and_assert_success(client, u'1')
35 client.waits.forElement(id=u'field.bug')50 client.asserts.assertText(id=u'linkbug',
36 client.type(text=u'1', id=u'field.bug')51 validator=u'Link to another bug report')
37 client.click(xpath=u'//button[@name="buglink.actions.change"]')52 self.link_bug_and_assert_success(client, u'2')
3853
39 client.waits.forElement(id=u'buglink-1', timeout=u'10000')54 client.waits.forElement(id=u'buglink-2', timeout=u'10000')
40 client.asserts.assertText(id=u'linkbug',
41 validator=u'Link to another bug report')
42
43 client.click(id=u'linkbug')
44 client.waits.forElement(id=u'field.bug')
45 client.type(text=u'2', id=u'field.bug')
46 client.click(xpath=u'//button[@name="buglink.actions.change"]')
47
48 client.waits.forElement(id=u'buglink-1', timeout=u'10000')
49 client.asserts.assertText(id=u'linkbug',
50 validator=u'Link to another bug report')
5155
52 # And now to unlink.56 # And now to unlink.
53 client.click(id=u'delete-buglink-1')57 self.unlink_bug_and_assert_success(client, u'1')
54 client.waits.sleep(milliseconds=3000)58 self.unlink_bug_and_assert_success(client, u'2')
55 client.asserts.assertNotNode(id=u'buglink-1')
56 client.click(id=u'delete-buglink-2')
57 client.waits.sleep(milliseconds=3000)
58 client.asserts.assertNotNode(id=u'buglink-2')
59 client.asserts.assertText(id=u'linkbug',59 client.asserts.assertText(id=u'linkbug',
60 validator=u'Link to a bug report')60 validator=u'Link to a bug report')
6161
6262
=== renamed file 'lib/lp/code/windmill/tests/test_branch_subscriptions.py.disabled' => 'lib/lp/code/windmill/tests/test_branch_subscriptions.py'
=== renamed file 'lib/lp/code/windmill/tests/test_code_review.py.disabled' => 'lib/lp/code/windmill/tests/test_code_review.py'
--- lib/lp/code/windmill/tests/test_code_review.py.disabled 2009-12-21 08:12:18 +0000
+++ lib/lp/code/windmill/tests/test_code_review.py 2010-01-13 03:04:37 +0000
@@ -34,7 +34,7 @@
34 '/~name12/gnome-terminal/klingon/']))34 '/~name12/gnome-terminal/klingon/']))
35 client.waits.forPageLoad(timeout=u'10000')35 client.waits.forPageLoad(timeout=u'10000')
3636
37 link = u'//a[@class="menu-link-register_merge sprite merge-proposal"]'37 link = u'//a[@class="menu-link-register_merge sprite add"]'
38 client.click(xpath=link)38 client.click(xpath=link)
39 client.type(text=u'~name12/gnome-terminal/main',39 client.type(text=u'~name12/gnome-terminal/main',
40 id=u'field.target_branch.target_branch')40 id=u'field.target_branch.target_branch')