Merge lp:~edwin-grubbs/launchpad/bug-430708-registry-windmill-layer into lp:launchpad

Proposed by Edwin Grubbs
Status: Merged
Approved by: Barry Warsaw
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~edwin-grubbs/launchpad/bug-430708-registry-windmill-layer
Merge into: lp:launchpad
Diff against target: 191 lines
3 files modified
Makefile (+1/-0)
lib/lp/registry/windmill/testing.py (+18/-0)
lib/lp/registry/windmill/tests/test_timeline_graph.py (+83/-60)
To merge this branch: bzr merge lp:~edwin-grubbs/launchpad/bug-430708-registry-windmill-layer
Reviewer Review Type Date Requested Status
Barry Warsaw (community) code Approve
Canonical Launchpad Engineering code Pending
Review via email: mp+13148@code.launchpad.net

Commit message

Move test_timeline_graph.py to lib/lp/registry/windmill and covert it to run under ./bin/test.

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Summary
-------

Moved the test_timeline_graph.py to lib/lp/registry/windmill
and made the changes necessary to have it run by ./bin/test
instead of ./bin/lp-windmill.

I added very kludgy looking for-loops to the tests to eliminate
sporadic failures that were occuring from 5% to 10% of the time.

Tests
-----

./bin/test --layer=RegistryWindmillLayer

Demo and Q/A
------------

Not QA-able.

Lint
----

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  Makefile
  lib/lp/registry/windmill/testing.py
  lib/lp/registry/windmill/tests/test_timeline_graph.py

Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Barry,

Thanks for the review. Here is the incremental diff.

{{{
=== modified file 'lib/lp/registry/windmill/tests/test_timeline_graph.py'
--- lib/lp/registry/windmill/tests/test_timeline_graph.py 2009-10-09 21:40:20 +0000
+++ lib/lp/registry/windmill/tests/test_timeline_graph.py 2009-10-09 22:07:54 +0000
@@ -26,7 +26,11 @@
             option=u'style.display|none',
             timeout=u'8000')
         link_xpath = '//div/a[@href="/firefox/trunk"]'
- for i in range(0, 5):
+
+ # waits.forElement() is called multiple times because there
+ # were sporadic errors where waits.forElement() would succeed but
+ # the following assertNode() would fail 5% of the time.
+ for i in range(5):
             self.client.waits.forElement(xpath=link_xpath)
         self.client.asserts.assertNode(xpath=link_xpath)

@@ -54,7 +58,11 @@
             option=u'style.display|block',
             timeout=u'8000')
         self.client.waits.forElement(id=u'timeline-loading', timeout=u'20000')
- for i in range(0, 5):
+
+ # waits.forElementProperty() is called multiple times because there
+ # were sporadic errors where waits.forElement() would succeed but
+ # the following assertProperty() would fail 5% of the time.
+ for i in range(5):
             self.client.waits.forElementProperty(
                 id=u'timeline-loading',
                 option=u'style.display|none')
}}}

Revision history for this message
Barry Warsaw (barry) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2009-10-07 09:55:24 +0000
+++ Makefile 2009-10-09 22:59:15 +0000
@@ -92,6 +92,7 @@
92 @echo92 @echo
93 bin/test $(VERBOSITY) --layer=BugsWindmillLayer93 bin/test $(VERBOSITY) --layer=BugsWindmillLayer
94 bin/test $(VERBOSITY) --layer=CodeWindmillLayer94 bin/test $(VERBOSITY) --layer=CodeWindmillLayer
95 bin/test $(VERBOSITY) --layer=RegistryWindmillLayer
95 bin/test $(VERBOSITY) --layer=SoyuzWindmillLayer96 bin/test $(VERBOSITY) --layer=SoyuzWindmillLayer
9697
97jscheck_functest: build98jscheck_functest: build
9899
=== added directory 'lib/lp/registry/windmill'
=== added file 'lib/lp/registry/windmill/__init__.py'
=== added file 'lib/lp/registry/windmill/testing.py'
--- lib/lp/registry/windmill/testing.py 1970-01-01 00:00:00 +0000
+++ lib/lp/registry/windmill/testing.py 2009-10-09 22:59:15 +0000
@@ -0,0 +1,18 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4"""Registry-specific testing infrastructure for Windmill."""
5
6__metaclass__ = type
7__all__ = [
8 'RegistryWindmillLayer',
9 ]
10
11
12from canonical.testing.layers import BaseWindmillLayer
13
14
15class RegistryWindmillLayer(BaseWindmillLayer):
16 """Layer for Registry Windmill tests."""
17
18 base_url = 'http://launchpad.dev:8085/'
019
=== added directory 'lib/lp/registry/windmill/tests'
=== added file 'lib/lp/registry/windmill/tests/__init__.py'
=== renamed file 'lib/canonical/launchpad/windmill/tests/test_registry/test_timeline_graph.py' => 'lib/lp/registry/windmill/tests/test_timeline_graph.py'
--- lib/canonical/launchpad/windmill/tests/test_registry/test_timeline_graph.py 2009-07-17 00:26:05 +0000
+++ lib/lp/registry/windmill/tests/test_timeline_graph.py 2009-10-09 22:59:15 +0000
@@ -1,65 +1,88 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4import unittest
5
4from windmill.authoring import WindmillTestClient6from windmill.authoring import WindmillTestClient
57
6from canonical.launchpad.windmill.testing import lpuser8from lp.registry.windmill.testing import RegistryWindmillLayer
79from lp.testing import TestCaseWithFactory
810
9def test_timeline_graph():11class TestTimelineGraph(TestCaseWithFactory):
10 """Test timeline graph on /$project/+timeline-graph page."""12
1113 layer = RegistryWindmillLayer
12 client = WindmillTestClient('TimelineGraph')14
1315 def setUp(self):
14 client.open(url=u'http://launchpad.dev:8085/firefox/+timeline-graph')16 self.client = WindmillTestClient('TimelineGraph')
15 client.waits.forElement(id=u'spinner', timeout=u'20000')17
16 client.waits.forElementProperty(18 def test_timeline_graph(self):
17 id=u'spinner',19 """Test timeline graph on /$project/+timeline-graph page."""
18 option=u'style.display|none',20
19 timeout=u'8000')21 self.client.open(
20 client.asserts.assertNode(xpath='//div/a[@href="/firefox/trunk"]')22 url=u'http://launchpad.dev:8085/firefox/+timeline-graph')
2123 self.client.waits.forElement(id=u'spinner', timeout=u'20000')
22def test_project_timeline_graph():24 self.client.waits.forElementProperty(
23 """Test that the timeline graph loads on /$project page."""25 id=u'spinner',
2426 option=u'style.display|none',
25 client = WindmillTestClient('TimelineGraph')27 timeout=u'8000')
26 client.open(url=u'http://launchpad.dev:8085/firefox')28 link_xpath = '//div/a[@href="/firefox/trunk"]'
2729
28 client.waits.forElement(id=u'timeline-loading', timeout=u'20000')30 # waits.forElement() is called multiple times because there
29 client.waits.forElementProperty(31 # were sporadic errors where waits.forElement() would succeed but
30 id=u'timeline-iframe',32 # the following assertNode() would fail 5% of the time.
31 option=u'style.display|block',33 for i in range(5):
32 timeout=u'8000')34 self.client.waits.forElement(xpath=link_xpath)
33 client.asserts.assertProperty(35 self.client.asserts.assertNode(xpath=link_xpath)
34 id=u'timeline-loading',36
35 validator=u'style.display|none')37 def test_project_timeline_graph(self):
3638 """Test that the timeline graph loads on /$project page."""
37def test_series_timeline_graph():39
38 """Test that the timeline graph loads on /$project/$series page."""40 self.client.open(url=u'http://launchpad.dev:8085/firefox')
3941
40 client = WindmillTestClient('TimelineGraph')42 self.client.waits.forElement(id=u'timeline-loading', timeout=u'20000')
41 client.open(url=u'http://launchpad.dev:8085/firefox/trunk')43 self.client.waits.forElementProperty(
4244 id=u'timeline-iframe',
43 client.waits.forElement(id=u'timeline-loading', timeout=u'20000')45 option=u'style.display|block',
44 client.waits.forElementProperty(46 timeout=u'8000')
45 id=u'timeline-iframe',47 self.client.asserts.assertProperty(
46 option=u'style.display|block',48 id=u'timeline-loading',
47 timeout=u'8000')49 validator=u'style.display|none')
48 client.asserts.assertProperty(50
49 id=u'timeline-loading',51 def test_series_timeline_graph(self):
50 validator=u'style.display|none')52 """Test that the timeline graph loads on /$project/$series page."""
5153
52def test_all_series_timeline_graph():54 self.client.open(url=u'http://launchpad.dev:8085/firefox/trunk')
53 """Test that the timeline graph loads on /$project/+series page."""55
5456 self.client.waits.forElementProperty(
55 client = WindmillTestClient('TimelineGraph')57 id=u'timeline-iframe',
56 client.open(url=u'http://launchpad.dev:8085/firefox/+series')58 option=u'style.display|block',
5759 timeout=u'8000')
58 client.waits.forElement(id=u'timeline-loading', timeout=u'20000')60 self.client.waits.forElement(id=u'timeline-loading', timeout=u'20000')
59 client.waits.forElementProperty(61
60 id=u'timeline-iframe',62 # waits.forElementProperty() is called multiple times because there
61 option=u'style.display|block',63 # were sporadic errors where waits.forElement() would succeed but
62 timeout=u'8000')64 # the following assertProperty() would fail 5% of the time.
63 client.asserts.assertProperty(65 for i in range(5):
64 id=u'timeline-loading',66 self.client.waits.forElementProperty(
65 validator=u'style.display|none')67 id=u'timeline-loading',
68 option=u'style.display|none')
69 self.client.asserts.assertProperty(
70 id=u'timeline-loading',
71 validator=u'style.display|none')
72
73 def test_all_series_timeline_graph(self):
74 """Test that the timeline graph loads on /$project/+series page."""
75
76 self.client.open(url=u'http://launchpad.dev:8085/firefox/+series')
77
78 self.client.waits.forElement(id=u'timeline-loading', timeout=u'20000')
79 self.client.waits.forElementProperty(
80 id=u'timeline-iframe',
81 option=u'style.display|block',
82 timeout=u'8000')
83 self.client.asserts.assertProperty(
84 id=u'timeline-loading',
85 validator=u'style.display|none')
86
87def test_suite():
88 return unittest.TestLoader().loadTestsFromName(__name__)