Merge lp:~bjornt/launchpad/bug-415870 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-415870
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~bjornt/launchpad/bug-415870
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+10377@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

Make the test_mark_duplicate_form_overlay 20-25 seconds faster by
replacing a bunch of waits.sleep() calls by waits.forElement().

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

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

> + client.waits.forElement(
> + xpath=u"//span[@id='mark-duplicate-text']/"
> + u"a[contains(., 'Mark as duplicate')]")

I wish I'd thought of this trick for a branch I landed earlier in the
week :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py'
--- lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py 2009-06-25 00:40:31 +0000
+++ lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py 2009-08-19 11:59:40 +0000
@@ -42,20 +42,19 @@
42 client.type(text=u'1', id=u'field.duplicateof')42 client.type(text=u'1', id=u'field.duplicateof')
43 client.click(xpath=CHANGE_BUTTON)43 client.click(xpath=CHANGE_BUTTON)
44 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)44 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)
45 client.waits.sleep(milliseconds=constants.SLEEP)
4645
47 # The form "Add a comment" now contains a warning about adding46 # The form "Add a comment" now contains a warning about adding
48 # a comment for a duplicate bug.47 # a comment for a duplicate bug.
49 client.asserts.assertNode(id='warning-comment-on-duplicate')48 client.waits.forElement(
49 id='warning-comment-on-duplicate', timeout=constants.FOR_ELEMENT)
5050
51 # The duplicate can be cleared:51 # The duplicate can be cleared:
52 client.click(classname=u'menu-link-mark-dupe')52 client.click(classname=u'menu-link-mark-dupe')
53 client.type(text=u'', id=u'field.duplicateof')53 client.type(text=u'', id=u'field.duplicateof')
54 client.click(xpath=CHANGE_BUTTON)54 client.click(xpath=CHANGE_BUTTON)
55 client.waits.sleep(milliseconds=constants.SLEEP)55 client.waits.forElement(
56 client.asserts.assertText(56 xpath=u"//span[@id='mark-duplicate-text']/"
57 xpath=u"//span[@id='mark-duplicate-text']/a[1]",57 u"a[contains(., 'Mark as duplicate')]")
58 validator=u'Mark as duplicate')
5958
60 # The warning about commenting on a diplucate bug is now gone.59 # The warning about commenting on a diplucate bug is now gone.
61 client.asserts.assertNotNode(id='warning-comment-on-duplicate')60 client.asserts.assertNotNode(id='warning-comment-on-duplicate')
@@ -64,25 +63,21 @@
64 client.click(classname=u'menu-link-mark-dupe')63 client.click(classname=u'menu-link-mark-dupe')
65 client.type(text=u'123', id=u'field.duplicateof')64 client.type(text=u'123', id=u'field.duplicateof')
66 client.click(xpath=CHANGE_BUTTON)65 client.click(xpath=CHANGE_BUTTON)
67 client.waits.sleep(milliseconds=constants.SLEEP)
68 error_xpath = (66 error_xpath = (
69 MAIN_FORM_ELEMENT +67 MAIN_FORM_ELEMENT +
70 "//div[contains(@class, 'yui-lazr-formoverlay-errors')]/ul/li")68 "//div[contains(@class, 'yui-lazr-formoverlay-errors')]/ul/li")
71 client.asserts.assertNode(xpath=error_xpath)69 client.waits.forElement(xpath=error_xpath)
7270
73 # Clicking change again brings back the error dialog again71 # Clicking change again brings back the error dialog again
74 # (regression test for bug 347258)72 # (regression test for bug 347258)
75 client.click(xpath=CHANGE_BUTTON)73 client.click(xpath=CHANGE_BUTTON)
76 client.waits.sleep(milliseconds=constants.SLEEP)74 client.waits.forElement(xpath=error_xpath)
77 client.asserts.assertNode(xpath=error_xpath)
7875
79 # But entering a correct bug and submitting gets us back to a normal state76 # But entering a correct bug and submitting gets us back to a normal state
80 client.type(text=u'1', id=u'field.duplicateof')77 client.type(text=u'1', id=u'field.duplicateof')
81 client.click(xpath=CHANGE_BUTTON)78 client.click(xpath=CHANGE_BUTTON)
82 client.waits.sleep(milliseconds=constants.SLEEP)79 client.waits.forElement(
83 client.asserts.assertText(80 xpath=u"//span[@id='mark-duplicate-text']/a[contains(., 'bug #1')]")
84 xpath=u"//span[@id='mark-duplicate-text']/a[1]",
85 validator=u'bug #1')
8681
87 # Finally, clicking on the link to the bug takes you to the master.82 # Finally, clicking on the link to the bug takes you to the master.
88 client.click(link=u'bug #1')83 client.click(link=u'bug #1')