launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #05492
changes to the TestPPAInlineEditing
I think I have landed a fix for failing TestPPAInlineEditing test. The
testcase used looked flawed.
The assertNode and assertText after the click() assumed a near
instantaneous change that inserts a node into the tree with text the
user input *before* the server call. The page is reloaded to see if the
object was updated.
The operation does not work that way. The node already exists, the
callback just updates the text, the first assert cannot fail. The second
assert can (and does) fail because the text is updated *after* the
server update--I am surprised this has not failed more often since there
is no waiting for the change. The second block is redundant.
The problem in crafting this test is that waits.forElement() could not
be used since the node already exists. I simplified the test to check
for the changed text in a waits.forElement(). waits.forElement() is a
form of assert, so asserts.assertText() is not needed.
=== modified file 'lib/canonical/launchpad/windmill/testing/widgets.py'
--- lib/canonical/launchpad/windmill/testing/widgets.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/windmill/testing/widgets.py 2010-11-07 18:20:52 +0000
@@ -173,19 +173,9 @@
client.type(
xpath=widget_base + '//textarea', text=self.new_value)
client.click(xpath=widget_base + '//button[last()]')
- client.asserts.assertNode(
- xpath=widget_base + '/span[1]')
- client.asserts.assertText(
- xpath=widget_base + '/span[1]', validator=self.new_value)
-
- # And make sure it's actually saved on the server.
- client.open(url=self.url)
- client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
client.waits.forElement(
- xpath=widget_base + '/span[1]',
+ xpath=widget_base + '/span[1][text()="' + self.new_value + '"]',
timeout=constants.FOR_ELEMENT)
- client.asserts.assertText(
- xpath=widget_base + '/span[1]', validator=self.new_value)
--
__Curtis C. Hovey_________
http://launchpad.net/
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups