Merge lp:~bjornt/launchpad/bug-415337 into lp:launchpad

Proposed by Björn Tillenius
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~bjornt/launchpad/bug-415337
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~bjornt/launchpad/bug-415337
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+10370@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

Fix the test_filebug_extra_options windmill test to make it pass again.
The layout of the page had changed a bit, and they way the collapsible
work have changed.

The original test tried to make sure that the extra option fields
weren't shown by checking .clientWidth. This doesn't work anymore, it's
always greater than 0. I changed it to check that the div they are in
is hidden instead, which should be good enough.

--
Björn Tillenius | https://launchpad.net/~bjornt

Revision history for this message
Gavin Panella (allenap) wrote :

This looks good.

It's not your fault, but I got a DeprecationWarning when running the
test:

> lib/canonical/database/harness.py:1: DeprecationWarning: Non-ASCII
> character '\xc3' in file
> lib/canonical/launchpad/windmill/testing/lpuser.py on line 71, but
> no encoding declared; see http://www.python.org/peps/pep-0263.html
> for details

I think it's because the encoding declaration has been pushed down to
the fourth line by the new copyright notice. Could you move the
encoding declaration to the top or change line 71 to use an escape
sequence instead?

Gavin.

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

On Wed, Aug 19, 2009 at 10:22:30AM -0000, Gavin Panella wrote:
> Review: Approve
> This looks good.
>
> It's not your fault, but I got a DeprecationWarning when running the
> test:
>
> > lib/canonical/database/harness.py:1: DeprecationWarning: Non-ASCII
> > character '\xc3' in file
> > lib/canonical/launchpad/windmill/testing/lpuser.py on line 71, but
> > no encoding declared; see http://www.python.org/peps/pep-0263.html
> > for details
>
> I think it's because the encoding declaration has been pushed down to
> the fourth line by the new copyright notice. Could you move the
> encoding declaration to the top or change line 71 to use an escape
> sequence instead?

I removed the encoding declaration and changed line 71 to use escape
sequences instead. Having files encoded in a non-ascii encoding is
usually a bad idea.

--
Björn Tillenius | https://launchpad.net/~bjornt

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/windmill/tests/test_bugs/test_filebug_extra_options.py'
2--- lib/lp/bugs/windmill/tests/test_bugs/test_filebug_extra_options.py 2009-07-27 12:39:34 +0000
3+++ lib/lp/bugs/windmill/tests/test_bugs/test_filebug_extra_options.py 2009-08-19 09:55:02 +0000
4@@ -26,7 +26,7 @@
5
6 # No duplicates were found.
7 client.asserts.assertText(
8- xpath=u"//form[@name='launchpadform']//p",
9+ xpath=u"//div[@id='container']//p",
10 validator=u'No similar bug reports were found.')
11
12 # Check out the expander.
13@@ -38,30 +38,27 @@
14 collapsible_area_xpath = (
15 u"//form[@name='launchpadform']"
16 u"//fieldset[contains(.//legend,'Extra options')]")
17+ closed_area_xpath = (
18+ collapsible_area_xpath +
19+ u"/div[@class='collapseWrapper lazr-closed']")
20+ opened_area_xpath = (
21+ collapsible_area_xpath +
22+ u"/div[@class='collapseWrapper lazr-opened']")
23 client.asserts.assertProperty(
24 xpath=collapsible_area_xpath,
25 validator="className|collapsible")
26- client.asserts.assertNode(
27- xpath=collapsible_area_xpath + u"/div[@class='collapsed']")
28+ client.asserts.assertNode(xpath=closed_area_xpath)
29
30 # The extra options are not visible.
31- extra_options_ids = (
32- u"field.tags",
33- u"field.filecontent",
34- u"field.patch",
35- u"field.attachment_description",
36- )
37- for extra_option_id in extra_options_ids:
38- client.asserts.assertElemJS(
39- id=extra_option_id, js=u"element.clientWidth == 0")
40-
41+ client.asserts.assertProperty(
42+ xpath=closed_area_xpath,
43+ validator='style.height|0px')
44 # Click on the legend and it expands.
45 client.click(
46 xpath=collapsible_area_xpath + u"/legend/a")
47- client.waits.forElement(
48- xpath=collapsible_area_xpath + u"/div[@class='expanded']")
49+ client.waits.forElement(xpath=opened_area_xpath)
50
51 # The extra options are visible now.
52- for extra_option_id in extra_options_ids:
53- client.asserts.assertElemJS(
54- id=extra_option_id, js=u"element.clientWidth > 0")
55+ client.asserts.assertElemJS(
56+ xpath=opened_area_xpath,
57+ js='element.style.height != "0px"')