Merge lp:~intellectronica/launchpad/fix-test-mark-duplicate into lp:launchpad

Proposed by Eleanor Berger
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~intellectronica/launchpad/fix-test-mark-duplicate
Merge into: lp:launchpad
Diff against target: 217 lines
1 file modified
lib/lp/bugs/windmill/tests/test_mark_duplicate.py (+110/-92)
To merge this branch: bzr merge lp:~intellectronica/launchpad/fix-test-mark-duplicate
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle code Approve
Review via email: mp+13682@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch converts the windmill test test_mark_duplicate to work with the new windmill infrastructure. The test itself hasn't changed, and it works fine now.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks fine.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== renamed file 'lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py' => 'lib/lp/bugs/windmill/tests/test_mark_duplicate.py'
--- lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py 2009-08-19 11:59:40 +0000
+++ lib/lp/bugs/windmill/tests/test_mark_duplicate.py 2009-10-21 01:55:20 +0000
@@ -1,9 +1,18 @@
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
4"""Test for the bug tag entry UI."""
5
6__metaclass__ = type
7__all__ = []
8
9import unittest
10
11from windmill.authoring import WindmillTestClient
12
4from canonical.launchpad.windmill.testing import constants, lpuser13from canonical.launchpad.windmill.testing import constants, lpuser
514from lp.bugs.windmill.testing import BugsWindmillLayer
6from windmill.authoring import WindmillTestClient15from lp.testing import TestCaseWithFactory
716
8MAIN_FORM_ELEMENT = u'//div[@id="duplicate-form-container"]/table'17MAIN_FORM_ELEMENT = u'//div[@id="duplicate-form-container"]/table'
9FORM_NOT_VISIBLE = (18FORM_NOT_VISIBLE = (
@@ -14,93 +23,102 @@
14 u'//div[@id="duplicate-form-container"]'23 u'//div[@id="duplicate-form-container"]'
15 '//button[@name="field.actions.change"]')24 '//button[@name="field.actions.change"]')
1625
17def test_mark_duplicate_form_overlay():26class TestBugCommenting(TestCaseWithFactory):
18 """Test the mark duplicate action on bug pages.27
1928 layer = BugsWindmillLayer
20 This test ensures that with Javascript enabled, the mark duplicate link29
21 on a bug page uses the formoverlay to update the duplicateof field via30 def test_mark_duplicate_form_overlay(self):
22 the api.31 """Test the mark duplicate action on bug pages.
23 """32
24 client = WindmillTestClient("Bug mark duplicate test")33 This test ensures that with Javascript enabled, the mark duplicate
25 lpuser.SAMPLE_PERSON.ensure_login(client)34 link on a bug page uses the formoverlay to update the duplicateof
2635 field via the api.
27 # Open a bug page and wait for it to finish loading36 """
28 client.open(url=u'http://bugs.launchpad.dev:8085/bugs/15')37 client = WindmillTestClient("Bug mark duplicate test")
29 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)38 lpuser.SAMPLE_PERSON.ensure_login(client)
30 client.waits.forElement(xpath=MAIN_FORM_ELEMENT, timeout=constants.FOR_ELEMENT)39
3140 # Open a bug page and wait for it to finish loading
32 # Initially the form overlay is hidden41 client.open(url=u'http://bugs.launchpad.dev:8085/bugs/15')
33 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)42 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
3443 client.waits.forElement(
35 # Clicking on the mark duplicate link brings up the formoverlay.44 xpath=MAIN_FORM_ELEMENT, timeout=constants.FOR_ELEMENT)
36 # Entering 1 as the duplicate ID changes the duplicate text.45
37 client.click(classname=u'menu-link-mark-dupe')46 # Initially the form overlay is hidden
38 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_VISIBLE)47 client.asserts.assertElemJS(
3948 xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)
40 # Entering the bug id '1' and changing hides the formoverlay49
41 # and updates the mark as duplicate:50 # Clicking on the mark duplicate link brings up the formoverlay.
42 client.type(text=u'1', id=u'field.duplicateof')51 # Entering 1 as the duplicate ID changes the duplicate text.
43 client.click(xpath=CHANGE_BUTTON)52 client.click(classname=u'menu-link-mark-dupe')
44 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)53 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_VISIBLE)
4554
46 # The form "Add a comment" now contains a warning about adding55 # Entering the bug id '1' and changing hides the formoverlay
47 # a comment for a duplicate bug.56 # and updates the mark as duplicate:
48 client.waits.forElement(57 client.type(text=u'1', id=u'field.duplicateof')
49 id='warning-comment-on-duplicate', timeout=constants.FOR_ELEMENT)58 client.click(xpath=CHANGE_BUTTON)
5059 client.asserts.assertElemJS(
51 # The duplicate can be cleared:60 xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)
52 client.click(classname=u'menu-link-mark-dupe')61
53 client.type(text=u'', id=u'field.duplicateof')62 # The form "Add a comment" now contains a warning about adding
54 client.click(xpath=CHANGE_BUTTON)63 # a comment for a duplicate bug.
55 client.waits.forElement(64 client.waits.forElement(
56 xpath=u"//span[@id='mark-duplicate-text']/"65 id='warning-comment-on-duplicate', timeout=constants.FOR_ELEMENT)
57 u"a[contains(., 'Mark as duplicate')]")66
5867 # The duplicate can be cleared:
59 # The warning about commenting on a diplucate bug is now gone.68 client.click(classname=u'menu-link-mark-dupe')
60 client.asserts.assertNotNode(id='warning-comment-on-duplicate')69 client.type(text=u'', id=u'field.duplicateof')
6170 client.click(xpath=CHANGE_BUTTON)
62 # Entering a false bug number results in input validation errors71 client.waits.forElement(
63 client.click(classname=u'menu-link-mark-dupe')72 xpath=u"//span[@id='mark-duplicate-text']/"
64 client.type(text=u'123', id=u'field.duplicateof')73 u"a[contains(., 'Mark as duplicate')]")
65 client.click(xpath=CHANGE_BUTTON)74
66 error_xpath = (75 # The warning about commenting on a diplucate bug is now gone.
67 MAIN_FORM_ELEMENT +76 client.asserts.assertNotNode(id='warning-comment-on-duplicate')
68 "//div[contains(@class, 'yui-lazr-formoverlay-errors')]/ul/li")77
69 client.waits.forElement(xpath=error_xpath)78 # Entering a false bug number results in input validation errors
7079 client.click(classname=u'menu-link-mark-dupe')
71 # Clicking change again brings back the error dialog again80 client.type(text=u'123', id=u'field.duplicateof')
72 # (regression test for bug 347258)81 client.click(xpath=CHANGE_BUTTON)
73 client.click(xpath=CHANGE_BUTTON)82 error_xpath = (
74 client.waits.forElement(xpath=error_xpath)83 MAIN_FORM_ELEMENT +
7584 "//div[contains(@class, 'yui-lazr-formoverlay-errors')]/ul/li")
76 # But entering a correct bug and submitting gets us back to a normal state85 client.waits.forElement(xpath=error_xpath)
77 client.type(text=u'1', id=u'field.duplicateof')86
78 client.click(xpath=CHANGE_BUTTON)87 # Clicking change again brings back the error dialog again
79 client.waits.forElement(88 # (regression test for bug 347258)
80 xpath=u"//span[@id='mark-duplicate-text']/a[contains(., 'bug #1')]")89 client.click(xpath=CHANGE_BUTTON)
8190 client.waits.forElement(xpath=error_xpath)
82 # Finally, clicking on the link to the bug takes you to the master.91
83 client.click(link=u'bug #1')92 # But entering a correct bug and submitting
84 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)93 # gets us back to a normal state
85 client.asserts.assertText(94 client.type(text=u'1', id=u'field.duplicateof')
86 xpath=u"//h1[@id='bug-title']/span[1]",95 client.click(xpath=CHANGE_BUTTON)
87 validator=u'Firefox does not support SVG')96 client.waits.forElement(
8897 xpath=u"//span[@id='mark-duplicate-text']"
89 # When we go back to the page for the duplicate bug...98 u"/a[contains(., 'bug #1')]")
90 client.open(url=u'http://bugs.launchpad.dev:8085/bugs/15')99
91 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)100 # Finally, clicking on the link to the bug takes you to the master.
92 client.waits.forElement(101 client.click(link=u'bug #1')
93 xpath=MAIN_FORM_ELEMENT, timeout=constants.FOR_ELEMENT)102 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
94103 client.asserts.assertText(
95 # ...we see the same warning about commenting on a duplicate bug104 xpath=u"//h1[@id='bug-title']/span[1]",
96 # as the one we saw before.105 validator=u'Firefox does not support SVG')
97 client.asserts.assertNode(id='warning-comment-on-duplicate')106
98107 # When we go back to the page for the duplicate bug...
99 # Once we remove the duplicate mark...108 client.open(url=u'http://bugs.launchpad.dev:8085/bugs/15')
100 client.click(id=u'change_duplicate_bug')109 client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
101 client.type(text=u'', id=u'field.duplicateof')110 client.waits.forElement(
102 client.click(xpath=CHANGE_BUTTON)111 xpath=MAIN_FORM_ELEMENT, timeout=constants.FOR_ELEMENT)
103 client.waits.sleep(milliseconds=constants.SLEEP)112
104113 # ...we see the same warning about commenting on a duplicate bug
105 # ...the warning is gone.114 # as the one we saw before.
106 client.asserts.assertNotNode(id='warning-comment-on-duplicate')115 client.asserts.assertNode(id='warning-comment-on-duplicate')
116
117 # Once we remove the duplicate mark...
118 client.click(id=u'change_duplicate_bug')
119 client.type(text=u'', id=u'field.duplicateof')
120 client.click(xpath=CHANGE_BUTTON)
121 client.waits.sleep(milliseconds=constants.SLEEP)
122
123 # ...the warning is gone.
124 client.asserts.assertNotNode(id='warning-comment-on-duplicate')