Merge lp://staging/~intellectronica/launchpad/fix-test-bug-tags-entry into lp://staging/launchpad

Proposed by Eleanor Berger
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~intellectronica/launchpad/fix-test-bug-tags-entry
Merge into: lp://staging/launchpad
Diff against target: 166 lines
2 files modified
lib/lp/bugs/windmill/tests/test_bug_tags_entry.py (+77/-0)
lib/lp/bugs/windmill/tests/test_bugs/test_bug_tags_entry.py (+0/-80)
To merge this branch: bzr merge lp://staging/~intellectronica/launchpad/fix-test-bug-tags-entry
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+13678@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This fixes bug #456315 by converting the test to the newer windmill infrastructure and converting the setup code to use the LaunchpadObjectFactory.

Revision history for this message
Paul Hummer (rockstar) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'lib/lp/bugs/windmill/tests/test_bug_tags_entry.py'
--- lib/lp/bugs/windmill/tests/test_bug_tags_entry.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/windmill/tests/test_bug_tags_entry.py 2009-10-20 22:40:26 +0000
@@ -0,0 +1,77 @@
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"""Test for the bug tag entry UI."""
5
6__metaclass__ = type
7__all__ = []
8
9import transaction
10import unittest
11
12from windmill.authoring import WindmillTestClient
13
14from canonical.launchpad.webapp import canonical_url
15from canonical.launchpad.windmill.testing import lpuser
16from lp.bugs.windmill.testing import BugsWindmillLayer
17from lp.testing import TestCaseWithFactory
18
19from zope.security.proxy import removeSecurityProxy
20
21class TestBugTagsEntry(TestCaseWithFactory):
22
23 layer = BugsWindmillLayer
24
25 def test_bug_tags_entry(self):
26 """Test bug tags inline, auto-completing UI."""
27 client = WindmillTestClient('Bug tags entry test')
28
29 # First, we add some official tags to test with
30
31 product = self.factory.makeProduct()
32 removeSecurityProxy(product).official_bug_tags = [
33 u'eenie', u'meenie', u'meinie', u'moe']
34 bug = self.factory.makeBug(product=product)
35 removeSecurityProxy(bug).tags = ['unofficial-tag']
36 # XXX Make the testing canonical_url available as a global utility
37 bug_url = canonical_url(bug).replace(
38 'https', 'http').replace('.dev/', '.dev:8085/')
39 transaction.commit()
40
41 lpuser.FOO_BAR.ensure_login(client)
42
43 # Now let's tag a bug using the auto-complete widget
44
45 client.open(url=bug_url)
46 client.waits.forPageLoad(timeout=u'300000')
47 client.waits.sleep(milliseconds=u'8000')
48
49 # XXX intellectronica 2009-05-26:
50 # We (almost) consistently get an error on the following line
51 # where instead of trigerring the onclick event handler we navigate
52 # to the link's URL.
53
54 client.click(id=u'edit-tags-trigger')
55 client.waits.forElement(id=u'tag-input', timeout=u'8000')
56 client.type(text=u'ee', id=u'tag-input')
57 client.waits.sleep(milliseconds=u'1000')
58 client.asserts.assertNode(classname=u'yui-autocomplete-list')
59 client.click(id=u'item0')
60 client.click(id=u'edit-tags-ok')
61 client.waits.sleep(milliseconds=u'8000')
62 client.asserts.assertText(id=u'tag-list', validator=u'eenie')
63
64 # Test that anonymous users are prompted to log in.
65
66 lpuser.ANONYMOUS.ensure_login(client)
67 client.open(url=bug_url)
68 client.waits.forPageLoad(timeout=u'50000')
69 client.waits.sleep(milliseconds=u'8000')
70 client.click(id=u'edit-tags-trigger')
71 client.waits.forPageLoad(timeout=u'50000')
72 client.asserts.assertJS(
73 js=u'window.location.href.indexOf("+login") > 0')
74
75
76def test_suite():
77 return unittest.TestLoader().loadTestsFromName(__name__)
078
=== removed file 'lib/lp/bugs/windmill/tests/test_bugs/test_bug_tags_entry.py'
--- lib/lp/bugs/windmill/tests/test_bugs/test_bug_tags_entry.py 2009-06-25 00:40:31 +0000
+++ lib/lp/bugs/windmill/tests/test_bugs/test_bug_tags_entry.py 1970-01-01 00:00:00 +0000
@@ -1,80 +0,0 @@
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"""Test for the bug tag entry UI."""
5
6__metaclass__ = type
7__all__ = []
8
9from windmill.authoring import WindmillTestClient
10
11from canonical.launchpad.windmill.testing import lpuser
12
13def test_bug_tags_entry():
14 """Test bug tags inline, auto-completing UI."""
15 client = WindmillTestClient('Bug tags entry test')
16
17 # First, we add some official tags to test with
18
19 lpuser.FOO_BAR.ensure_login(client)
20
21 client.open(url='http://bugs.launchpad.dev:8085/firefox')
22 client.waits.forPageLoad(timeout=u'100000')
23 client.waits.sleep(milliseconds=u'8000')
24
25 client.click(link=u'Edit official tags')
26 client.waits.forPageLoad(timeout=u'100000')
27 client.waits.sleep(milliseconds=u'8000')
28
29 client.type(text=u'eenie', id=u'new-tag-text')
30 client.click(id=u'new-tag-add')
31 client.type(text=u'meenie', id=u'new-tag-text')
32 client.click(id=u'new-tag-add')
33 client.type(text=u'meinie', id=u'new-tag-text')
34 client.click(id=u'new-tag-add')
35 client.type(text=u'moe', id=u'new-tag-text')
36 client.click(id=u'new-tag-add')
37 # if the tags already exist the save button might be disabled.
38 # make sure it's enabled so that we can complete the test.
39 client.asserts.assertJS(js=u"""(function(){
40 document.getElementById('save-button').disabled = false;
41 return true;
42 }());
43 """)
44 client.click(id=u'save-button')
45 client.waits.forPageLoad(timeout=u'100000')
46 client.asserts.assertJS(
47 js=u'window.location == "http://bugs.launchpad.dev:8085/firefox"')
48
49 # Now let's tag a bug using the auto-complete widget
50
51 client.open(url='http://bugs.launchpad.dev:8085/firefox/+bug/5')
52 client.waits.forPageLoad(timeout=u'300000')
53 client.waits.sleep(milliseconds=u'8000')
54
55 # XXX intellectronica 2009-05-26:
56 # We (almost) consistently get an error on the following line
57 # where instead of trigerring the onclick event handler we navigate
58 # to the link's URL.
59
60 client.click(id=u'edit-tags-trigger')
61 client.waits.forElement(id=u'tag-input', timeout=u'8000')
62 client.type(text=u'ee', id=u'tag-input')
63 client.waits.sleep(milliseconds=u'1000')
64 client.asserts.assertNode(classname=u'yui-autocomplete-list')
65 client.click(id=u'item0')
66 client.click(id=u'edit-tags-ok')
67 client.waits.sleep(milliseconds=u'8000')
68 client.asserts.assertText(id=u'tag-list', validator=u'eenie')
69
70 # Test that anonymous users are prompted to log in.
71
72 lpuser.ANONYMOUS.ensure_login(client)
73 client.open(url='http://bugs.launchpad.dev:8085/firefox/+bug/5')
74 client.waits.forPageLoad(timeout=u'50000')
75 client.waits.sleep(milliseconds=u'8000')
76 client.click(id=u'edit-tags-trigger')
77 client.waits.forPageLoad(timeout=u'50000')
78 client.asserts.assertJS(
79 js=u'window.location == "http://bugs.launchpad.dev:8085/firefox/+bug/5/+edit/+login"')
80