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
1=== modified file 'lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py'
2--- lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py 2009-06-25 00:40:31 +0000
3+++ lib/lp/bugs/windmill/tests/test_bugs/test_mark_duplicate.py 2009-08-19 11:59:40 +0000
4@@ -42,20 +42,19 @@
5 client.type(text=u'1', id=u'field.duplicateof')
6 client.click(xpath=CHANGE_BUTTON)
7 client.asserts.assertElemJS(xpath=MAIN_FORM_ELEMENT, js=FORM_NOT_VISIBLE)
8- client.waits.sleep(milliseconds=constants.SLEEP)
9
10 # The form "Add a comment" now contains a warning about adding
11 # a comment for a duplicate bug.
12- client.asserts.assertNode(id='warning-comment-on-duplicate')
13+ client.waits.forElement(
14+ id='warning-comment-on-duplicate', timeout=constants.FOR_ELEMENT)
15
16 # The duplicate can be cleared:
17 client.click(classname=u'menu-link-mark-dupe')
18 client.type(text=u'', id=u'field.duplicateof')
19 client.click(xpath=CHANGE_BUTTON)
20- client.waits.sleep(milliseconds=constants.SLEEP)
21- client.asserts.assertText(
22- xpath=u"//span[@id='mark-duplicate-text']/a[1]",
23- validator=u'Mark as duplicate')
24+ client.waits.forElement(
25+ xpath=u"//span[@id='mark-duplicate-text']/"
26+ u"a[contains(., 'Mark as duplicate')]")
27
28 # The warning about commenting on a diplucate bug is now gone.
29 client.asserts.assertNotNode(id='warning-comment-on-duplicate')
30@@ -64,25 +63,21 @@
31 client.click(classname=u'menu-link-mark-dupe')
32 client.type(text=u'123', id=u'field.duplicateof')
33 client.click(xpath=CHANGE_BUTTON)
34- client.waits.sleep(milliseconds=constants.SLEEP)
35 error_xpath = (
36 MAIN_FORM_ELEMENT +
37 "//div[contains(@class, 'yui-lazr-formoverlay-errors')]/ul/li")
38- client.asserts.assertNode(xpath=error_xpath)
39+ client.waits.forElement(xpath=error_xpath)
40
41 # Clicking change again brings back the error dialog again
42 # (regression test for bug 347258)
43 client.click(xpath=CHANGE_BUTTON)
44- client.waits.sleep(milliseconds=constants.SLEEP)
45- client.asserts.assertNode(xpath=error_xpath)
46+ client.waits.forElement(xpath=error_xpath)
47
48 # But entering a correct bug and submitting gets us back to a normal state
49 client.type(text=u'1', id=u'field.duplicateof')
50 client.click(xpath=CHANGE_BUTTON)
51- client.waits.sleep(milliseconds=constants.SLEEP)
52- client.asserts.assertText(
53- xpath=u"//span[@id='mark-duplicate-text']/a[1]",
54- validator=u'bug #1')
55+ client.waits.forElement(
56+ xpath=u"//span[@id='mark-duplicate-text']/a[contains(., 'bug #1')]")
57
58 # Finally, clicking on the link to the bug takes you to the master.
59 client.click(link=u'bug #1')