← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/fix-test_inline_recipe_daily_build into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/fix-test_inline_recipe_daily_build into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #753240 in Launchpad itself: "test_inline_recipe_daily_build disabled"
  https://bugs.launchpad.net/launchpad/+bug/753240

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/fix-test_inline_recipe_daily_build/+merge/61050

A small tweak to a test that was disabled to hopefully make it more robust.

The test_inline_recipe_daily_build() test was disabled due to spurious failure. I tried it locally and couldn't get it to fail (tried several times). I looked at the code and there was:

client.waits.forElement(
    jquery=u'("div#edit-build_daily a.editicon.sprite.edit")',
    timeout=FOR_ELEMENT)

The page is actually rendered with a span not a div. And I've found that waits.forElement using jquery can often return false positive matches if the jquery expression is not 100% kosher. So I just removed the div qualifier:

client.waits.forElement(
    jquery=u'("#edit-build_daily a.editicon.sprite.edit")',
    timeout=FOR_ELEMENT)

I'm not sure why it was written originally using a div selector expression when the page renders a span element. Maybe something changed. But in any case, the element id is sufficient to use in the selector; we really don't need to specify the element type.

I'm not 10000% sure this fix is definitive since the test worked locally before the change. But the change is good in any case.

-- 
https://code.launchpad.net/~wallyworld/launchpad/fix-test_inline_recipe_daily_build/+merge/61050
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/fix-test_inline_recipe_daily_build into lp:launchpad.
=== modified file 'lib/lp/code/windmill/tests/test_recipe_index.py'
--- lib/lp/code/windmill/tests/test_recipe_index.py	2011-04-07 07:14:00 +0000
+++ lib/lp/code/windmill/tests/test_recipe_index.py	2011-05-16 00:49:25 +0000
@@ -22,8 +22,7 @@
     layer = CodeWindmillLayer
     suite_name = "Recipe daily build flag setting"
 
-    # Disabled due to spurious failures (bug #753240).
-    def disabled_test_inline_recipe_daily_build(self):
+    def test_inline_recipe_daily_build(self):
         eric = self.factory.makePerson(
             name="eric", displayname="Eric the Viking", password="test",
             email="eric@xxxxxxxxxxx")
@@ -36,7 +35,7 @@
             classname=u'yui3-ichoicelist-content', timeout=FOR_ELEMENT)
         client.click(link=u'Built daily')
         client.waits.forElement(
-            jquery=u'("div#edit-build_daily a.editicon.sprite.edit")',
+            jquery=u'("#edit-build_daily a.editicon.sprite.edit")',
             timeout=FOR_ELEMENT)
         client.asserts.assertTextIn(
             id=u'edit-build_daily', validator=u'Built daily')